2.ibatis动态查询
iBATIS动态查询的实现主要是在iBATIS中使用安全的拼接语句,动态查询
iBATIS比JDBC的优势之一,安全高效
iBATIS动态查询实例:
一、ibatis2.x
1.
<dynamic prepend="where 1 = 1">
<isNotEmpty property="bean属性">
and lower(b.字段名) like lower('%$字段名$%')
</isNotEmpty>
<isNotEqual property="fromTime" compareValue="0">
and submitTime >= #fromTime#
</isNotEqual>
<isNotEqual property="toTime" compareValue="0">
<![CDATA[
and submitTime <= #toTime#
]]>
</isNotEqual>
</dynamic>
order by s.lastUpdateTime desc )