0
我在我的sql映射文件中有以下查询,它在为FIELD3生成的SQL查询中使用OR。这是Integer
ibatis使用IN而不是OR
<select id="myCriteria" parameterClass="mySearchCriteria" resultMap="generated_MyResult">
select * from MY_TABLE where MY_TABLE.FIELD1 = 1
<dynamic>
<isNotNull prepend="and" property="field2">
MY_TABLE.FIELD2 = $field2$
</isNotNull>
<isNotNull prepend="and" property="field3_list">
<iterate close=")" conjunction="or" open="(" property="meIds">
MY_TABLE.FIELD3= $field3_list[]$
</iterate>
</isNotNull>
</dynamic>
</select>
如果我想用IN代替或List
,iterate
被删除,下方将工作?
<select id="myCriteria" parameterClass="mySearchCriteria" resultMap="generated_MyResult">
select * from MY_TABLE where MY_TABLE.FIELD1 = 1
<dynamic>
<isNotNull prepend="and" property="field2">
MY_TABLE.FIELD2 = $field2$
</isNotNull>
<isNotNull prepend="and" property="field3_list">
MY_TABLE.FIELD3 IN $field3_list[]$
</isNotNull>
</dynamic>
</select>
'isNotEmpty'也在内部检查'isNotNull'吗? – Sridhar 2014-11-03 10:04:41
是的,来自doc:'检查一个Collection,String属性的值是否不为空且不为空(“”或size()<1).'(https://ibatis.apache.org/docs /java/pdf/iBATIS-SqlMaps-2_en.pdf) – 2014-11-03 10:26:54