2019.01.13 / 22:33
[Mybatis] Foreach List¸¦ HashMapÀ¸·Î Àü´Þ¹Þ¾ÒÀ» °æ¿ì
hanulbit
Ãßõ ¼ö 269
<select id="getCount" parameterType="java.util.HashMap" resultType="int">
SELECT count(a.obj_id)
FROM (
select * from dwg_gis_mapper map, dwg_gis_object obj
where obj.obj_id = map.obj_id
<if test="ObjectID != null and ObjectID != null">
and map.obj_id = #{ObjectID}
</if>
<if test="objList != null and objList != ''">
and map.obj_id in
<foreach collection="objList" item="obj" separator="," open="(" close=")">
#{obj.objId}
</foreach>
</if>
) a
</select>
SELECT count(a.obj_id)
FROM (
select * from dwg_gis_mapper map, dwg_gis_object obj
where obj.obj_id = map.obj_id
<if test="ObjectID != null and ObjectID != null">
and map.obj_id = #{ObjectID}
</if>
<if test="objList != null and objList != ''">
and map.obj_id in
<foreach collection="objList" item="obj" separator="," open="(" close=")">
#{obj.objId}
</foreach>
</if>
) a
</select>
·Î ó¸®ÇÑ´Ù.objList´Â Map¿¡ key °ªÀ̸ç obj´Â foreach¿¡¼ »ç¿ëÇÒ key°ªÀÌ´Ù.