반응형
ex)
SELECT * FROM job where (name1 = 'key1' or name2 = 'key2') and name3 = 'key3'
-------------------------------------------------------
<select id="job" parameterClass="Map">
SELECT *
FROM jobs
<dynamic prepend="WHERE">
<isNotNull prepend="AND" removeFirstPrepend="true" open="(" close=")" >
<isNotEmpty prepend="OR" property="key1">
name1 = #key1#
</isNotEmpty>
<isNotEmpty prepend="OR" property="key2">
name2 = #key2#
</isNotEmpty>
</isNotNull>
<isNotEmpty prepend="AND" property="key3">
name3 = #key3#
</isNotEmpty>
</dynamic>
</select>