1、模糊查询
select * from t_user t1 where t1.username like CONCAT(CONCAT('%',#{username,jdbcType=VARCHAR}), '%')
select * from t_user t1 where t1.username like CONCAT(#{username,jdbcType=VARCHAR}, '%')
select * from t_user t1 where t1.username like CONCAT('%',#{username,jdbcType=VARCHAR})
2、报错:The content of elements must consist of well-formed character data or markup.
原因:
在mybatis的映射文件中出现了特殊字符:<,>等等。
2.1 用<![CDATA[ select * from tb_users where id<=100 ]]>包裹着
2.2 或者,<代替< >代替> select * from tb_users where id <=100