您的位置:首页 > 其它

mybatis 查询参数为集合list、数组、map的情况

2017-02-22 17:50 501 查看
【记录一下,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/
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: