摘要:
1、 概述 2、if元素(非常常用) 3、choose、when、otherwise元素 多个条件选一个,优先级高的放在上面。 例: 4、where元素 与if连用 多条件查询 例: 5、trim元素(动态增加) 有时候我们要去掉一些特殊的SQL语法,比如常见的and、or,此时可以使用trim元素 阅读全文
posted @ 2021-01-21 15:43
Master_Sun
阅读(363)
评论(0)
推荐(0)
摘要:
mybatis的配置文件分为 核心配置文件 和 mapper配置文件 1、核心配置文件 (1)environments元素 (2)mappers元素 mappers的存在就是要对写好的mapper和xml进行统一管理 要不然系统怎么知道我写了哪些mapper 核心配置文件要写上: 每个Mapper接 阅读全文
posted @ 2021-01-21 12:46
Master_Sun
阅读(80)
评论(0)
推荐(0)
摘要:
(1)思考: <select id="getUsersByParams" resultType="java.util.HashMap"> select id,username,password from user where username = #{name} </select> resultTy 阅读全文
posted @ 2021-01-21 12:23
Master_Sun
阅读(52)
评论(0)
推荐(0)
摘要:
详细:https://blog.csdn.net/mrqiang9001/article/details/79520436 一个参数,但是是数组,必须加@Param 见梳理11 foreach元素 例子: 阅读全文
posted @ 2021-01-21 11:05
Master_Sun
阅读(96)
评论(0)
推荐(0)
摘要:
map可以代替任何的实体类,所以当我们数据比较复杂时,可以适当考虑使用map来完成相关工作 1、写sql <select id="getUsersByParams" resultType="map"> select id,username,password from user where usern 阅读全文
posted @ 2021-01-21 10:54
Master_Sun
阅读(213)
评论(0)
推荐(0)
摘要:
如果有索引,前面的%不要加 例子: 或者 阅读全文
posted @ 2021-01-21 10:44
Master_Sun
阅读(54)
评论(0)
推荐(0)
摘要:
1、接口中添加注解 public interface AdminMapper { /** * 保存管理员 * @param admin * @return */ @Insert("insert into admin (username,password) values (#{username},#{ 阅读全文
posted @ 2021-01-21 10:30
Master_Sun
阅读(75)
评论(0)
推荐(0)

浙公网安备 33010602011771号