经过我一套乱七八糟毫无思路地查找后,发现不是Mybatis的原因,原来是SQL server不支持CONCAT函数,直接用加号连接就好
1 2 3 4 5 6 7 8 | < select id = "getByPage" resultType = "com.test.domain.Users" parameterType = "com.test.Param" > SELECT * FROM tb_users where isdeleted=1 < if test = "name!=null and name!=''" > AND nickname LIKE CONCAT('%', '${name}', '%') </ if > ORDER BY createtime DESC limit #{fromIndex},#{count} </ select > |
以上为个人经验,希望能给大家一个参考,也希望大家多多支持脚本之家。