<foreach collection="list" item="item" separator="UNION ALL">
SELECT
#{item.topName} AS deptName,
#{item.topId} AS deptId,
sum(case when a.count >= a.limitCount then 1 else 0 end) manZu,
sum(case when a.count < a.limitCount then 1 else 0 end) noManZu
FROM (
SELECT
mineId,
sum( limit_count ) limitCount,
sum(count) count
FROM
`v_camera_standard_check`
GROUP BY
mineId) a
where
1=1
<foreach collection="item.mineIds" item="it" separator="," open="AND a.mineId IN (" close=")" >
#{it}
</foreach>
</foreach>
mybatis中的foreach循环
最新推荐文章于 2025-04-27 15:21:32 发布