<isNotNull>
检查属性是否不为null
<isNotEmpty>
检查Collection.size()的值,属性的String或String.valueOf()值,是否不为null或不为空(“”或size() > 0)
----------------------使用----------------------
- <!-- 分页查询返回列表 -->
- <select id="getUserPrivacyPage" parameterClass="map" resultClass="hashmap">
- select uid,`key`,`value` from ts_user_privacy
- <dynamic prepend="WHERE">
- <isNotEmpty prepend="AND" property="uid">
- uid=#uid#
- </isNotEmpty>
- <isNotEmpty prepend="AND" property="key">
- key=#key#
- </isNotEmpty>
- <isNotEmpty prepend="AND" property="value">
- value=#value#
- </isNotEmpty>
- </dynamic>
- <isNotEmpty prepend="order by " property="_order">
- $_order$
- </isNotEmpty>
- <isNotEmpty prepend="limit " property="_limit">
- #_limit._pstart#,#_limit._psize#
- </isNotEmpty>
- </select>
<!-- 修改记录 -->
- <update id="updateUserPrivacy" parameterClass="map">
- update ts_user_privacy
- <dynamic prepend="set">
- <isNotNull prepend="," property="value"> `value`=#value# </isNotNull>
- </dynamic>
- where uid=#uid# AND `key`=#key#
- </update>