首页 > 代码库 > Mybatis转义字符

Mybatis转义字符

Mybatis的sql语句中需要用到‘>‘或者‘<‘时,不能直接使用。

 

&lt;      <    小于号
&gt;      >    大于号
&amp;     &&apos;        单引号
&quot;    ‘‘   双引号

 

例如查询汽车价格小于一万元的语句

select * from car where car_price_new &lt; 10000

 

另外,使用like语句

查询订单中name的like语句

 select * from orderEntity where order_name like  CONCAT(%-,#{value},-%) 

 

Mybatis转义字符