今天查看日志的时候发现多次出现如下的异常,查阅了资料后发现IN语句中写的表达式的最大数量不能超过1000。

解决方法: 1. 拆分IN里面的条件,将表达式的数量控制在1000以内,然后通过OR语句连接。

                2.作为子查询。

我使用了第二种方法:

<if test="createBy != null and createBy.name != null and createBy.name != ''">
	AND a.create_by in (select u.id as "createBy.id" FROM sys_user u where u.name LIKE 
		<if test="dbName == 'oracle'">'%'||#{createBy.name}||'%'</if>
		<if test="dbName == 'mssql'">'%'+#{createBy.name}+'%'</if>
		<if test="dbName == 'mysql'">concat('%',#{createBy.name},'%')</if>
	)
</if>

  

第一种方法有时间再试

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-07-14
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-11
猜你喜欢
  • 2022-12-23
  • 2022-01-04
  • 2022-12-23
  • 2021-10-11
  • 2021-06-26
相关资源
相似解决方案