确认

  • [X] 我使用的版本是最新版, 并且使用插件确认过项目里无依赖版本冲突
  • [X] 我已经在 issue 中搜索过, 确认问题没有被提出过
  • [X] 我已经修改标题, 将标题中的 描述 替换为遇到的问题

当前程序版本

3.5.9

问题描述

[错误报告]: 描述 逻辑删除字段为LocalDateTime时,设置logic-not-delete-value: null查询报错

MySQL版本: 5.7

mp设置: mybatis-plus: # 支持统配符 * 或者 ; 分割 typeAliasesPackage: com.bornya.esg.entity configuration: cache-enabled: true global-config: db-config: logic-delete-field: deleteAt # 全局逻辑删除字段名 logic-delete-value: now() # 逻辑已删除值 logic-not-delete-value: null # 逻辑未删除值

实体字段设置: /* * 删除时间 / @TableLogic LocalDateTime deleteAt;

预期SQL: WHERE id = #{id} AND delete_at IS NULL 最终SQL: WHERE id = #{id} AND delete_at =

详细堆栈日志

### Error querying 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 '' at line 1
### The error may exist in com/bornya/esg/dbmapper/MetricLatestViewMapper.java (best guess)
### The error may involve defaultParameterMap
### The error occurred while setting parameters
### SQL: SELECT id,vid,is_required,cluster_id,nature_type,metric_types,name,description,scoring_method,score_point,metric_fields,weight,create_at,update_at,delete_at FROM metric_latest_view WHERE id=? AND delete_at=
### 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 '' at line 1
; bad SQL grammar []

Comment From: hellojingbo

springboot版本:3.2.4

Comment From: miemieYaho

null需要转义符包裹