随笔分类 -  Mybatis

摘要:在 MyBatis-Plus 中,使用updateById,null字段并不会更新,其实是和更新的策略有关,当然,也有插入策略。 1、调整全局策略(会对所有的字段都忽略判断,如果一些字段不想要修改,但是传值的时候没有传递过来,就会被更新为null) mybatis-plus: global-conf 阅读全文
posted @ 2024-05-15 14:42 唏嘘- 阅读(3532) 评论(0) 推荐(0) 编辑
摘要:mybatis-plus: type-enums-package: #对应实体类所在的包 mapper-locations: #mapper 映射文件 configuration: # 配置控制台sql打印 log-impl: org.apache.ibatis.logging.stdout.Std 阅读全文
posted @ 2023-05-29 13:59 唏嘘- 阅读(35) 评论(0) 推荐(0) 编辑
摘要:问题描述:当传入的 status值为0 时,不进入 if 判断 <select id="selectAll" parameterType="com.imes.domain.entities.User" resultMap="BaseResultMap"> select * from user <wh 阅读全文
posted @ 2022-02-16 15:08 唏嘘- 阅读(728) 评论(0) 推荐(0) 编辑
摘要:正确写法: <if test="userCode != null and userCode !='' and userCode !='admin'.toString()"> 或者 <if test='userCode != null and userCode !="" and userCode != 阅读全文
posted @ 2022-02-14 11:19 唏嘘- 阅读(293) 评论(0) 推荐(0) 编辑
摘要:spring 整合 mybatis 报错日志 Exception in thread "main" org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.Persiste 阅读全文
posted @ 2021-10-10 08:27 唏嘘- 阅读(1131) 评论(0) 推荐(0) 编辑
摘要:spring 整合 mybatis 报错信息 Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.mybatis.spring.SqlSessio 阅读全文
posted @ 2021-10-10 08:18 唏嘘- 阅读(857) 评论(0) 推荐(0) 编辑
摘要:spring 整合 mybatis 报错信息 java.lang.NoClassDefFoundError: org/apache/commons/pool/KeyedObjectPoolFactory 找不到commons-pool, 添加commons-pool-1.6依赖 <dependenc 阅读全文
posted @ 2021-10-10 08:14 唏嘘- 阅读(177) 评论(0) 推荐(0) 编辑
摘要:spring 整合 mybatis 查询数据库报错 java.lang.NoClassDefFoundError: org/springframework/dao/support/DaoSupport 缺少jar包 添加如下jar包 <dependency> <groupId>org.springf 阅读全文
posted @ 2021-10-10 08:11 唏嘘- 阅读(902) 评论(0) 推荐(0) 编辑
摘要:一:直接定义函数进行处理 public static String escapeStr(String str) { if (StringUtils.isEmpty(str)) { str = str.replaceAll("\\\\", "\\\\\\\\"); str = str.replaceA 阅读全文
posted @ 2021-08-13 11:52 唏嘘- 阅读(2016) 评论(0) 推荐(0) 编辑
摘要:Mybatis-Plus 使用 数据库不存在的字段,可在实体类的属性加上 @TableField 注解 @TableField(exist=false) 阅读全文
posted @ 2021-07-19 16:00 唏嘘- 阅读(1085) 评论(0) 推荐(0) 编辑
摘要:1、oracle 方式一: select name from staff <where> <if test="name != null"> name like '%'|| #{name} ||'%' </if> </where> 方式二: select name from staff <where> 阅读全文
posted @ 2021-07-19 11:34 唏嘘- 阅读(82) 评论(0) 推荐(0) 编辑
摘要:错误代码: mapper接口: List<MeetingDeploy> resultTypeList(List<String> codes); mapper.xml: select * from meeting_deploy where meeting_code IN <foreach item=" 阅读全文
posted @ 2021-07-16 11:08 唏嘘- 阅读(4394) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示