Error background:
It is necessary to determine whether the time type is in the form of ”, and then an error appears invalid comparison: java.time.LocalDateTime and java.lang.String.
Cause of error:
<if test="(search.startTime != null or search.startTime != '') and (search.endTime != null or search.endTime != '' )">
Reason of error:
This error is caused by a problem with the mybatis version. In this version, the time cannot be compared with an empty string. 3.3.* version should have this problem.
Solution:
Delete the following paragraph
search.startTime != ''
Date comparison can use date method:
<if test="startTime != null">
and date(a.start_time) <![CDATA[>=]]>date(#{startTime,jdbcType=TIMESTAMP})
</if>
<if test="endTime != null ">
and date(a.end_time ) <![CDATA[<=]]> date(#{endTime,jdbcType=TIMESTAMP})
</if>