mybatis模糊查询写法
来源:互联网 发布:淘宝优惠券采集软件 编辑:程序博客网 时间:2024/05/24 05:32
Mybatis模糊查询写法(我推荐第一种和第二种)
1.${...} 代替 #{...} SELECT * FROM tableName WHERE name LIKE '%${text}%';
2. 参数中直接加入%%
param.setUsername("%CD%");
param.setPassword("%11%");
<select id="selectPersons" resultType="person" parameterType="person">select id,sex,age,username,password from person where true <if test="username!=null"> AND username LIKE #{username}</if><if test="password!=null">AND password LIKE #{password}</if></select>
3. bind标签
<select id="selectPersons" resultType="person" parameterType="person"> <bind name="pattern" value="'%' + _parameter.username + '%'" /> select id,sex,age,username,password from person where username LIKE #{pattern}</select>
4. CONCAT
where username LIKE concat(concat('%',#{username}),'%')
阅读全文
0 0
- mybatis模糊查询写法
- mybatis模糊查询写法
- Mybatis模糊查询的写法
- Mybatis中模糊查询的各种写法
- Mybatis中模糊查询的各种写法
- mybatis 模糊查询 mapper.xml的写法
- Mybatis中模糊查询的各种写法
- Mybatis中模糊查询的各种写法
- Mybatis中模糊查询的各种写法
- Mybatis中模糊查询的各种写法
- Mybatis中模糊查询的各种写法
- Mybatis中模糊查询的各种写法
- Mybatis中模糊查询的写法总结
- Mybatis中模糊查询的各种写法
- Mybatis中模糊查询的各种写法
- Mybatis中模糊查询的各种写法
- Mybatis中模糊查询的各种写法
- Mybatis中模糊查询的各种写法
- 【行有不得者,皆反求诸己】本土心理学——一个小培训的一点思考
- Series && DataFrame
- 定时器系列—被誉为神器的requestAnimationFrame
- Windows下的OSG环境配置注意事项
- 官方发布的ThinkPHP3.1快速入门教程系列
- mybatis模糊查询写法
- Python学习笔记(五)——日期和时间
- 常用的正则表达式
- android的多点触摸效果
- 2017.7.8~2017.7.9总结
- 数据库金额方面存储
- LeetCode 74. Search a 2D Matrix
- JavaScript 基础知识
- 笔记:新手的Hive指南