Mybatis中 if test 判断数值字符串注意项
2017-11-08 11:20
344 查看
<if test="cutList != null"> <if test="isInterrupt == '1'.toString() "> AND A.basic_id IN ( <foreach collection="cutList" item="item" index="index" separator="," > #{item} </foreach> ) </if> <if test="isInterrupt == '0'.toString() "> AND A.basic_id NOT IN ( <foreach collection="cutList" item="item" index="index" separator="," > #{item} </foreach> ) </if> </if>
1. Mybatis中 if test 判断数值字符串注意项
if test 判断是否为某一数值字符串时需在数值字符串后加上toString()方法如:
<if test="isInterrupt == '1'.toString() ">
2. Mybatis中遍历list入参
此处还有个知识点是mybatis使用foreach标签来遍历入参list。如:
<if test="isInterrupt == '1'.toString() "> AND A.basic_id IN ( <foreach collection="cutList" item="item" index="index" separator="," > #{item} </foreach> ) </if>
这里IN 的()可以直接用open="(" close=")"属性设置
<foreach collection="cutList" item="item" index="index" open="(" close=")" separator="," >
相关文章推荐
- Struts2 用 s:if test 判断属性和字符串相等时 注意双引号和单引号的使用
- Struts2 用 s:if test 判断属性和字符串相等时 注意双引号和单引号的使用
- Struts2 用 s:if test 判断属性和字符串相等时 注意双引号和单引号的使用 以及%{} ${}%{#}的使用
- Struts2 用 s:if test 判断属性和字符串相等时 注意双引号和单引号的使用
- Struts2 用 s:if test 判断属性和字符串相等时 注意双引号和单引号的使用
- Mybatis if test 判断数字时需要注意
- Struts2 用 s:if test 判断属性和字符串相等时 注意双引号和单引号的使用
- MyBatis if test 字符串判断问题
- Struts2 用 s:if test 判断属性和字符串相等时 注意双引号和单引号的使用
- Struts2 用 s:if test 判断属性和字符串相等时 注意双引号和单引号的使用 以及%{} ${}%{#}的使用
- Struts2 用 s:if test 判断属性和字符串相等时 注意双引号和单引号的使用
- Mybatis if test 判断数字时需要注意
- Struts2 用 s:if test 判断属性和字符串相等时 注意双引号和单引号的使用
- Struts2 用 s:if test 判断属性和字符串相等时 注意双引号和单引号的使用
- Struts2 用 s:if test 判断属性和字符串相等时 注意双引号和单引号的使用
- Struts2 用 s:if test 判断属性和字符串相等时 注意双引号和单引号的使用
- mybatis 里面使用<if test=""> 判断,当后台传的值是数字字符串时,怎么处理
- Struts2 用 s:if test 判断属性和字符串相等时 注意双引号和单引号的使用
- Mybatis if test 判断数字时需要注意
- Mybatis if test 动态判断数字时需要注意的问题