当模糊查询过多时,mybatis会报错,但在mysql数据库直接搜索不会报错、从网上查询这样写就可以了,直接上代码
<select id="findmergeEvent" parameterType="java.util.Map"
resultType="MergeEvent">
select id,
preeventid,
preeventname,
serial,
count,
autovoicestatus,
eventid,
mergestatus,
whodo,
mergetime,
eventdirection
from mergeEvent
where 1=1
<if
test="startTime != null and startTime != ''">
AND mergetime >= #{startTime}
</if>
<if
test="endTime != null and endTime != ''">
AND #{endTime} >= mergetime
</if>
<if
test="queryLike != null and queryLike != ''">
and (
</if>
<if test="queryLike != null and queryLike != ''">
preeventid like BINARY "%"#{mergeEvent.preeventid}"%"
or serial like BINARY "%"#{mergeEvent.serial}"%"
or preeventname like BINARY "%"#{mergeEvent.preeventname}"%"
or mergetime like BINARY "%"#{mergeEvent.mergetime}"%"
or eventid like BINARY "%"#{mergeEvent.eventid}"%"
or whodo like BINARY "%"#{mergeEvent.whodo}"%"
or endtime like BINARY "%"#{mergeEvent.endtime}"%"
</if>
<if test="(mergeEvent.mergestatus != null and mergeEvent.mergestatus != '' or mergeEvent.mergestatus ==0) and sb!='15' and mergeEvent.mergestatus!=-1">
or mergestatus = #{mergeEvent.mergestatus}
</if>
<!-- <if test="(mergeEvent.mergestatus != null and mergeEvent.mergestatus == 2) and sb!='15'">
or mergestatus = 0
</if>
<if test="(mergeEvent.mergestatus != null and mergeEvent.mergestatus == 1) and sb!='15'">
or mergestatus = 1
</if> -->
<if test="(mergeEvent.mergestatus != null and mergeEvent.mergestatus != '' or mergeEvent.mergestatus ==0) and sb=='15'">
or mergestatus = 0 or autovoicestatus=2
</if>
<if test="(mergeEvent.autovoicestatus != null and mergeEvent.autovoicestatus != '' or mergeEvent.autovoicestatus==0) and sb!='24' and mergeEvent.autovoicestatus!=-1">
or autovoicestatus = #{mergeEvent.autovoicestatus}
</if>
<if test="(mergeEvent.autovoicestatus != null and mergeEvent.autovoicestatus != '' or mergeEvent.autovoicestatus==0) and sb=='24'">
or mergestatus = 1 or autovoicestatus=1
</if>
<if test="(mergeEvent.eventdirection != null and mergeEvent.eventdirection != '' or mergeEvent.eventdirection==0) and sb!='67' and mergeEvent.eventdirection!=-1">
or eventdirection = #{mergeEvent.eventdirection}
</if>
<if test="(mergeEvent.eventdirection != null and mergeEvent.eventdirection != '' or mergeEvent.eventdirection==0) and sb=='67'">
or eventdirection = 2 or eventdirection=3
</if>
<if test="(mergeEvent.qualify != null and mergeEvent.qualify != '' or mergeEvent.qualify==0) and sb!='89' and mergeEvent.qualify != -1">
or qualify=#{mergeEvent.qualify}
</if>
<if test="(mergeEvent.qualify != null and mergeEvent.qualify != '' or mergeEvent.qualify==0) and sb=='89'">
or qualify = 1 or qualify=2
</if>
<if
test="queryLike != null and queryLike != ''">
)
</if>
and eventid != '00400130002'
ORDER BY id desc
limit
#{mergeEvent.startPos},#{mergeEvent.pageSize}
这样就不会报错了