【记录一下,list情况】
<select id="getEmployeesListParams" resultType="Employees">
select *
from EMPLOYEES e
where e.EMPLOYEE_ID in
<foreach collection="employeeIds" item="employeeId" index="index"
open="(" close=")" separator=",">
#{employeeId}
</foreach>
</select>
集合循环查询结果,union all(着重separator属性)
<select id="getProductEnableNumberInfos" resultMap="productMap" >
SELECT * from (
<foreach collection="conditions.list" item="item" index="index" separator="union all">
SELECT XXX
</foreach>
) alias WHERE alias.WMST_ENABLED_NUMBER>0;
</select>
感谢:http://blog.csdn.net/small____fish/article/details/8029030/