2020年10月18日

springboot + mybatis plus使用insert 语句并返回主键

摘要: mapper文件 映射文件中在insert中设置useGeneratedKeys为true,keyProperty设置为主键名称 INSERT INTO employees (emp_name, emp_age, emp_no, hire_date, sal, deptno, mgr, user_name, email, phone... 阅读全文

posted @ 2020-10-18 23:51 白衣风云 阅读(20235) 评论(0) 推荐(0) 编辑

PostgreSQL数据类型转换

摘要: 当前端传过来的数据类型和数据库里的数据类型不一致时,需要在数据插入进行数据类型 使用 CAST() 函数 CAST ( expression AS type ) --- 例如 select cast(233 as numeric); mapper文件中 INSERT INTO employees (emp_name, emp_age, e... 阅读全文

posted @ 2020-10-18 23:38 白衣风云 阅读(5755) 评论(0) 推荐(0) 编辑

Cause: org.postgresql.util.PSQLException: 栏位索引超过许可范围:13,栏位数:12

摘要: Cause: org.postgresql.util.PSQLException: 栏位索引超过许可范围:13,栏位数:12。 这个报错的原因是在mapper文件中的sql语书写错误 INSERT INTO employees (emp_name, emp_age, emp_no, hire_date, sal, deptno, mgr, ... 阅读全文

posted @ 2020-10-18 20:29 白衣风云 阅读(3203) 评论(0) 推荐(0) 编辑

springboot 开启事务回滚

摘要: 在数据库操作时如果发生异常,回滚的方法在方法上添加注解@Transactional,作用域是方法级的参考资料:https://www.cnblogs.com/c2g5201314/p/13163097.html 来自为知笔记(Wiz) 阅读全文

posted @ 2020-10-18 20:22 白衣风云 阅读(346) 评论(0) 推荐(0) 编辑

导航