where-if中if不能识别大写AND,OR
2018-12-24 本文已影响0人
帮我的鸵鸟盖个章
mybatis报错:Caused by: org.apache.ibatis.ognl.ParseException: Encountered " <IDENT> "AND "" at line 1
报错代码:
`<select id="countByMapRt" resultType="java.lang.Long">
SELECT COUNT(1) FROM epc_letter_notice t1
<where>
t1.is_delete = 0
<if test="countryArea != null AND countryArea != ''">
AND t1.share_place LIKE concat('%',#{countryArea},'%')
</if>
</where>
</select>`
产生错误的原因是if条件中AND
为大写,应改为小写。大写不能识别
`<select id="countByMapRt" resultType="java.lang.Long">
SELECT COUNT(1) FROM epc_letter_notice t1
<where>
t1.is_delete = 0
<if test="countryArea != null and countryArea != ''">
AND t1.share_place LIKE concat('%',#{countryArea},'%')
</if>
</where>
</select>`