Mybatis使用lte报错使用case when报错
一、mybatis使用lte报错
解决方式
方法一: 转义字符
< | <= | > | >= | & | ' | '' |
< | <= | > | >= | & | ' | " |
方法二:<![CDATA[sql语句]]>
name <![CDATA[<=]]> #{name}
二、mybatis case when 报错
错误示范:
select *
from tablename
where id=1
case
when name is not null
then and name = 'jenken'
end
正确示范
select *
from tablename
where id=1
and name =
case
when name is not null
then 'jenken'
else 'jenken2'
end
三、Mybatis使用if else
choose
select * from tablename
<where><choose><when test="path != null">and t.is_delete = 0 </when><otherwise>and t.is_delete = 1</otherwise></choose>
</where>