MyBatis--------Oracle超过1000条的问题

select * from test_table
where 1 = 1 
 <!-- IdList -->
 <if test="IdList != null and IdList.size > 0">
    AND PK_ID IN
    <!-- 处理in的集合超过1000条时Oracle不支持的情况 -->
    <trim suffixOverrides=" OR PK_ID IN()"> <!-- 表示删除最后一个条件 -->
        <foreach collection="IdList" item="Id" index="index" open="(" close=")">
            <if test="index != 0">
                <choose>
                    <when test="index % 1000 == 999">) OR PK_ID IN (</when>
                    <otherwise>,</otherwise>
                </choose>
            </if>
            #{Id}
        </foreach>
    </trim>
 </if>
           <!-- 处理in的集合超过1000条时Oracle不支持的情况 -->
                    <trim suffixOverrides=" OR user_account IN()"> <!-- 表示删除最后一个条件 -->
                        <foreach collection="stuList" item="userAccount" index="index" open="(" close=")">
                            <if test="index != 0">
                                <choose>
                                    <when test="index % 1000 == 999">) OR user_account IN (</when>
                                    <otherwise>,</otherwise>
                                </choose>
                            </if>
                            #{userAccount}
                        </foreach>
                    </trim>

 

posted @ 2022-07-17 12:13  小大宇  阅读(143)  评论(0编辑  收藏  举报