ibatis动态标签 iterate

<select id="selectAccount" resultMap="AccountResult"
parameterClass="Map">
select * from ACCOUNT
<dynamic>
<isNotNull prepend="keyWords">
<iterate prepend="where ACC_ID in" property="keyWords" open="("
conjunction="," close=")" removeFirstPrepend="false">
#keyWords[]#
</iterate>
</isNotNull>
</dynamic>
</select>

 

假如有参数:
Map<String,String[]> map = new HashMap<String,String[]>();
map.put("keyWords", new String[]{"1", "3", "4" });

 

生成的SQL语句为:select * from ACCOUNT where ACC_ID in (1, 3, 4)

你可能感兴趣的:(ibatis,dynamic,动态,iterate)