ibatis isNotNull isNotEmptyの違い
1772 ワード
属性がnullでないかどうかを確認します
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>
http://huangqiqing123.iteye.com/blog/1668963