caused by: org.apache.ibatis.ognl.parseexception: encountered " "and “” at line 1
错误代码:
<select id="selectaccountlist" resultmap="baseresultmap">
select ct.customer_name customername,sam.city_code,sam.user_name,sam.account_name
from sys_account_manager sam left join sys_customer ct on ct.id = sam.customer_id
where sam.deleted = 0
<if test="customername != null and customername != '' ">
and ct.customer_name like concat('%',#{customername},'%')
</if>
<if test="citycode != null and citycode != '' ">
and locate(#{citycode},sam.city_code)
</if>
order by status,account_validity_time desc
</select>
正确代码:
原因是:
if条件中and为大写,大写不能识别,应改为小写。
<select id="selectaccountlist" resultmap="baseresultmap">
select ct.customer_name customername,sam.city_code,sam.user_name,sam.account_name
from sys_account_manager sam left join sys_customer ct on ct.id = sam.customer_id
where sam.deleted = 0
<if test="customername != null and customername != '' ">
and ct.customer_name like concat('%',#{customername},'%')
</if>
<if test="citycode != null and citycode != '' ">
and locate(#{citycode},sam.city_code)
</if>
order by status,account_validity_time desc
</select>