Mybatis mapper.xml 判断条件写法注意
来源:互联网 发布:做服装设计用什么软件 编辑:程序博客网 时间:2024/05/18 03:19
1.判断String是否为空
<if test="stringParam != null and stringParam != ''"></if>
2.判断Integer是否大于0
3.判断List是否不为空<if test="idParam !=null and idParam gt 0"></if>
<if test="listParam !=null and listParam.size >0"></if>
4.判断String是否以某特定字符(比如此处的"user")开头
<if test="stringParam.indexOf('user') != -1"></if>5.判断字符串是否等于特定字符(比如此处的user)
<if test='stringParam != null and stringParam == "user"'></if>
注意不能使用此写法 <if test="stringParam != null and stringParam != 'user'"></if> 即最外边用双引号,里边用单引号,此写法会抱java.lang.NumberFormatException异常
如果要用这个写法要<if test="stringParam != null and stringParam != 'user'.toString()"></if>
转载Mark
阅读全文
0 0
- Mybatis mapper.xml 判断条件写法注意
- MyBatis Mapper.xml各种判断
- MyBatis Mapper.xml各种判断
- mybatis 模糊查询 mapper.xml的写法
- mybatis映射文件mapper.xml的写法。
- mybatis批量insert的mapper xml写法
- mybatis中mapper进行if条件判断
- mybatis mapper.xml 区间查询条件
- Mybatis中Mapper.xml文件中的update语句写法
- mybatis中mapper.xml中模糊查询写法
- MyBatis中的mapper.xml文件需要注意的
- mybatis,XMl文件判断条件出错
- mybatis Mapper.xml 详解
- mybatis mapper.xml
- Mybatis(五)-Mapper.xml
- mybatis:Mapper XML Files
- Mybatis-mapper-xml-基础
- mybatis mapper.xml详解
- ubuntu eclipse+jdk配置
- 深入理解JVM之了解内存区域
- SpringBoot Learning ——day01
- 剑指offer第29题(最小的k个数字)
- 【转】安卓 SD卡写入文件后不能立即显示被写入的文件解决方法
- Mybatis mapper.xml 判断条件写法注意
- python unicode字符串
- CSS 添加数据
- dockerfile部署运行
- linux 下各errno的意义
- Chinese Text Detection and Recognition
- Andrioid Framework中添加系统服务
- 看到我文章的如果觉得好的话帮我订一下谢谢
- Hadoop 安装