mybatis注解绑定参数和CDATA符号无需再转义
1.需要使用注解
Caused by: org.apache.ibatis.binding.BindingException: Parameter 'startTime' not found. Available parameters are [arg1, arg0, param1, param2]
List<GetCarEntity> queryGetCar(String startTime, String endTime);
需要使用注解
List<GetCarEntity> queryGetCar(@Param("startTime")String startTime, @Param("endTime")String endTime);
2.< 修改成: < <![CDATA[ ]]>
### 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 '= '2024-10-28 23:59:59'
AND t4.is_effective = 1
AND t3.status > 8 AND t3' at line 123
; 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 '= '2024-10-28 23:59:59'
AND t4.is_effective = 1
AND t3.status > 8 AND t3' at line 123
> 大于号
WHERE t2.`status` <![CDATA[ > ]]> 64
3.1.字段过长,去掉赋值 或者需要将数据库字段扩容。
### Error updating database. Cause: com.mysql.cj.jdbc.exceptions.MysqlDataTruncation: Data truncation: Data too long for column 'operator_id' at row 1
### The error may involve com.order.mapper.OrderDetailMapper.updateByPrimaryKeySelective-Inline
### The error occurred while setting parameters
### SQL: update order_detail SET `order_no` = ?, `mem_no` = ?, `operator_id` = ?, `update_op` = ? where id = ?
### Cause: com.mysql.cj.jdbc.exceptions.MysqlDataTruncation: Data truncation: Data too long for column 'operator_id' at row 1
; SQL []; DATA truncation: DATA too LONG FOR COLUMN 'operator_id' AT ROW 1; nested exception IS com.mysql.cj.jdbc.exceptions.MysqlDataTruncation: DATA truncation: DATA too LONG FOR COLUMN 'operator_id' AT ROW 1