MyBatisPlus在@Select中使用Like

描述

当自定义@SELECT语句后,直接传wrapper到方法上不行.

解决思路

普通用法

1
2
@select(“select*from user where name = #{name}”)
List selectUserByName(String name)

like 用法

1
2
3
4

@Select(“select*from userf where name like CONCAT(’%’,#{s},’%’)”)
List selectLikename(String s);

concat拼接字符串

CONCAT(’%’,#{0},’%’)”) 不能直接用 ‘%#{s}%’

本文地址: https://github.com/maxzhao-it/blog/post/47890/