mybatis-plus逻辑删除问题

mybatis-plus:

mapper-locations: classpath:/mapper/**/*.xml

global-config:

db-config:

id-type: auto

logic-delete-field: showStatus

logic-delete-value: 0

logic-not-delete-value: 1 # 逻辑未删除值(默认为 0)

mybatis配置了全局的逻辑删除后,再想通过自带的updataById方法更新showStatus字段报错

\r\n### Error updating database.  Cause: java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE brand_id=13  AND show_status=1' at line 1\r\n### The error may exist in com/atguigu/gulimall/product/dao/BrandDao.java (best guess)\r\n### The error may involve com.atguigu.gulimall.product.dao.BrandDao.updateById-Inline\r\n### The error occurred while setting parameters\r\n### SQL: UPDATE pms_brand    WHERE brand_id=?  AND show_status=1\r\n### Cause: java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE brand_id=13  AND show_status=1' at line 1\n; bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE brand_id=13  AND show_status=1' at line 1",

这是配置全局的逻辑删除后就不能再使用updateById方法更新逻辑删除字段了?


回答:

应该是你调用updateById(T t) t对象所有属性全部为null导致

以上是 mybatis-plus逻辑删除问题 的全部内容, 来源链接: utcz.com/p/944215.html

回到顶部