useridList 里的数据超过1000时会报:
列表中的最大表达式数为 1000
SELECT
count(1) as formNum
FROM
TB_ZS_LECTURE_PLAN o
left join (select * from vw_zs_teaching_course
) d on d.UUID = o.TEACHING_COURSE_UUID
WHERE
o.LECTURE_STATUS = '3' and d.TERM = #{term}
and o.CREATE_BY in
<foreach collection="useridList" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
and o.IS_DELETE='0'
and o.org=#{org}
如何解决
在mybatis中的xml中改为
SELECT
count(1) as formNum
FROM
TB_ZS_LECTURE_PLAN o
left join (select * from vw_zs_teaching_course
) d on d.UUID = o.TEACHING_COURSE_UUID
WHERE
o.LECTURE_STATUS = '3' and d.TERM = #{term}
and o.IS_DELETE='0'
and o.org=#{org}
and (o.create_by in <trim suffixOverrides=" OR o.create_by in()">
<foreach collection="useridList" item="item" index="index" open="(" close=")">
<if test="index != 0">
<choose>
<when test="index % 1000 == 999">) OR o.create_by in (</when>
<otherwise>,</otherwise>
</choose>
</if>
#{item,jdbcType=VARCHAR}
</foreach>
</trim>)