Notice
Recent Posts
Recent Comments
Link
«   2025/06   »
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30
Tags
more
Archives
Today
Total
관리 메뉴

메모장

MyBatis foreach 본문

DataBase

MyBatis foreach

doopang 2024. 11. 11. 18:15
# IN
<when test="id" != null and id != ''">
    AND (
        <foreach collection="ids" item="item" separator="," open="(" close=")">
            #{item}
        </foreach>
    )
</when>

# OR
<when test="id" != null and id != ''">
    AND (
        <foreach collection="ids" item="item" separator="OR">
            #{item}
        </foreach>
    )
</when>

# MyBatis update foreach 설정
jdbc:mysql://localhost:3306/test?allowMultiQueries=true