iBatis支持集合循环, 但是如何做到双重循环, 请见下例子

例子描述:

需要去三张结构相同的表中获取信息, 需要将信息拼合去重后返回

入参数据类型: Map<String,Object>,   regions  = List<OrderRegionNum>

class OrderRegionNums{
String regionSchema
String regionCode
List<Integer> orderNums
}

 

注意的是在标签中的property属性中使用时:不需要加 $或者#  直接regions[].orderNums
<select ></select>

----------------------------------------------------------------------------------------------------------------------

<isNotEmpty prepend="and" property="marketShopAuthFlatAreaDtos">
<iterate property="marketShopAuthFlatAreaDtos" conjunction="or">
project_id in
<iterate conjunction=',' property="marketShopAuthFlatAreaDtos[].projectIds" open="(" close=")">
#marketShopAuthFlatAreaDtos[].projectIds[]#</iterate>
AND
(
1!=1
<isNotEmpty prepend="or" property="marketShopAuthFlatAreaDtos[].provinceNodes" >
shop_address_province in
<iterate conjunction=',' property="marketShopAuthFlatAreaDtos[].provinceNodes" open="(" close=")">
#marketShopAuthFlatAreaDtos[].provinceNodes[].nodeCode#</iterate>

</isNotEmpty>
<isNotEmpty prepend="or" property="marketShopAuthFlatAreaDtos[].cityNodes">
shop_address_city in
<iterate conjunction=',' property="marketShopAuthFlatAreaDtos[].cityNodes" open="(" close=")">
#marketShopAuthFlatAreaDtos[].cityNodes[].nodeCode#</iterate>

</isNotEmpty>

<isNotEmpty prepend="or" property="marketShopAuthFlatAreaDtos[].countyNodes">

shop_address_country in
<iterate conjunction=',' property="marketShopAuthFlatAreaDtos[].countyNodes" open="(" close=")">
#marketShopAuthFlatAreaDtos[].countyNodes[].nodeCode#</iterate>

</isNotEmpty>
<isNotEmpty prepend="or" property="marketShopAuthFlatAreaDtos[].townNodes">

shop_address_street in
<iterate conjunction=',' property="marketShopAuthFlatAreaDtos[].townNodes" open="(" close=")">
#marketShopAuthFlatAreaDtos[].townNodes[].nodeCode#</iterate>

</isNotEmpty>
)
</iterate>

</isNotEmpty>



------------------------------------------------------------------------------------------------------------
<sql ></sql>

相关文章: