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方法更新逻辑删除字段了?

阅读 2.8k
1 个回答

image.png

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

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题