mybatis xml文件中的大于、小于、及like模糊查询的写法
2017-07-06 15:57
429 查看
原文链接:blog.csdn.net/wangshuang1631/article/details/53488188
在xml中,特殊符号的转义写法如下:
也可以使用
MySQL like的写法:
1.传入参数中直接加入%%
2.bind标签
3.CONCAT
在xml中,特殊符号的转义写法如下:
< < > > <> <> & & ' ' " "1
也可以使用
<![CDATA[ ]]>符号进行说明,将此类符号不进行解析
<![CDATA[ sql语句 ]]>1
MySQL like的写法:
1.传入参数中直接加入%%
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>
2.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
3.CONCAT
like concat('%',#{param},'%')
相关文章推荐
- mybatis xml文件中的大于、小于、及like模糊查询的写法
- mybatis的xml中特殊转义字符和模糊查询like的写法
- MyBatis 3模糊查询(like)写法(转)
- mybatis xml中的小于的写法,like模糊查询的写法
- MyBatis xml文件中的大于、小于等符号写法
- Mybatis模糊查询之like写法
- mybatis的 like模糊查询的安全写法
- MyBatis中的大于、小于、like等符号写法
- myBatis的xml大于小于不等于模糊查询
- Mybatis中mapper模糊查询语句LIKE
- mybatis 模糊查询的写法(注:网上转载,分享)
- 【mybaits】Mybatis中模糊查询的各种写法
- mybatis做like模糊查询
- Mybatis中oracle、mysql、db2、sql server的like模糊查询
- MyBatis Like模糊查询参考解决策略
- mybatis xml 文件中like模糊查询
- MyBatis的like模糊查询
- 模糊查询在mybatis配置xml文件中的写法
- Mybatis中oracle、mysql、db2、sql server的like模糊查询
- Mybatis like查询的写法