<select id="testList" resultType="YourBeanVo">
SELECT
c.*
FROM
table_sheet c
WHERE c.sheet_id IN
<foreach collection="idList" index="index" item="item" open="(" close=")">
<if test="index != 0">
<choose>
<when test="index % 1000 == 999"> ) OR c.sheet_id IN( </when>
<otherwise>,</otherwise>
</choose>
</if>
#{item}
</foreach>
<if test='ids != null and ids !="" '>
and c.id in
<foreach item="id" collection='ids.split(",")' open="(" separator="," close=")">
#{id}
</foreach>
</if>
order by c.create_time desc
</select>
mybatis 处理 in 语句过长
最新推荐文章于 2024-04-30 16:31:26 发布