![](https://img-blog.csdnimg.cn/20201014180756923.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
mybatis-plus
Atm猿
撸代码中。。。。。。
展开
-
mybatis-plus使用selectById查询时表的主键不是id字段的解决办法
一、背景项目:Springboot mybatis-plus mysql今天项目中新建了一张表,表的主键是area_code,在程序中直接使用mybatis-plus内置的selectById方法进行表数据查询,查询时直接报错:运行时异常: Invalid bound statement (not found): com.huanong.avatar.shuidi.mapper.SdWeatherThresholdMapper.selectById二、原因mybatis的selectById原创 2020-10-30 11:44:35 · 12018 阅读 · 4 评论 -
通过xml文件写sql执行报是sql异常错误:org.springframework.jdbc.UncategorizedSQLException
一、背景今天通过xml配置文件写了一个sql,调用的时候报错:org.springframework.jdbc.UncategorizedSQLException:### Error querying database.Cause: java.sql.SQLException: sql injection violation, syntax error: ERROR. pos 181, line 11, column 9,该报错是sql注入错误,sql异常,无法查询二、原因应为x..原创 2020-10-21 17:44:46 · 533 阅读 · 0 评论 -
Mybatisplus 使用updateBatchById()方法无法更新为null的字段
一、问题: 今天在开发中遇见一个问题就是当我使用mybatisplus的updateBatchById方法时,我将表的某一个属性值赋null,然后调用updateBatchById方法,返回true,去数据库一查数据,却发现数据还是原来的值。二、原因: 该问题其实是MyBatis-Plus对字段的验证策略导致的,MyBatis-Plus默认进行了不是全量更新的策略,如果对某字段赋值为null了,那么updateBatchById()更新时自动忽略该字段。三、解决 通过上...原创 2020-10-09 18:16:11 · 19293 阅读 · 0 评论