您的位置:首页 > 数据库

mybatis之sql总结

2016-02-25 14:30 183 查看
版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。 本文链接:https://blog.csdn.net/Jqing_Chen/article/details/50737472

1.相等的情况

<if test="property!= null and property!= '' ">

and column = #{property}

</if>

2.相似的情况

<if test="property!= null" >
AND column like CONCAT('%',#{property},'%')
</if>

3.CDATA标签内的会被文本解析,如

<if test="property!= null" >
<![CDATA[

and column>= #{property}]]>

</if>

4.时间比较大小

<if test="exeTime != null">

<![CDATA[

and date(exe_time) >= date(#{exeTime})]]>
</if>

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: