//1 mybatis处理不同字符串
String s1 = null, s2 = "";
// mapper对于这两种情况判断不同,下面语句可以排除这两种情况
<if test="str != null and str != ''"></if>
//2 判断集合时候为空
if test="arr != null and arr.size > 0"></if>
//3 判断数字大于0
<if test="num != null and num gt 0"></if>
<if test="num != null and num == 0"></if>
//4 判断字符串是否包含某字符
<if test="str.indexOf('abc') != -1"></if>
//5 判断字符串是否等于某字符
<if test="str != null and str == 'abc'.toString()"></if>
<if test='str != null and str == "abc"'></if>
//6 处理时间
<if test="date != null">
DATE = #{date, jdbcType=DATE}
</if>
mybatis mapper判断if条件写法
免责声明:文章转载自《mybatis mapper判断if条件写法》仅用于学习参考。如对内容有疑问,请及时联系本站处理。
上篇com.android.org.bouncycastle.jce.exception.ExtCertPathValidatorExceptionSSH 免密码登陆下篇
宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=