mybatis
小鬼妹妹编程史
我是小鬼,傻傻的小鬼
展开
-
mybatis提取<where><if></if><where>
在mapper.xml文件中如果有多个查询条件是相同的,可以提取处相同部分,封装起来,哪里使用哪里调用 eg: select * from product where 1=1 <if test="productNo != null and productNo != ''"> and p.productNo like '%${productNo}%' </if> <if test="prod原创 2021-10-22 10:08:53 · 824 阅读 · 0 评论 -
springboot 整合mybatis 环境搭建
1、引入依赖 spring相关依赖:spring-boot-starter-web mysql 驱动 druid 数据源 mybatis相关依赖:mybatis-spring-boot-starter <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring...原创 2021-10-11 14:37:28 · 116 阅读 · 0 评论 -
mybatis 数据库字段与实体类属性不一致 java 下划线转驼峰命名 mybatis 配置开启自动驼峰命名规则(camel-case)映射
背景 : 数据库字段是用下划线命名规则。但是后端实体类是用的驼峰命名。 mybatis 默认关闭自动驼峰命名规则映射。(将这个配置打开即可) 方法如下: 文件:application.properties 中 查看有没有如下配置 :该配置值设为true(默认值为false),表示开启自动驼峰命名映射。 #是否开启自动驼峰命名规则(camel-case)映射 (即数据库中是下划线...原创 2020-04-26 15:34:06 · 1250 阅读 · 0 评论