方式一:只需在mapper的映射文件中的查询条件增加以下查询语句即可
<if test="book!= null and book != ''"> and book like concat('%', #{book}, '%')</if>
方式二:使用占位符 #{value}
和 SQL 字符串参数传递模糊条件
List<User> users = userMapper.selectByCondition("name like #{value}");
方式一:只需在mapper的映射文件中的查询条件增加以下查询语句即可
<if test="book!= null and book != ''"> and book like concat('%', #{book}, '%')</if>
方式二:使用占位符 #{value}
和 SQL 字符串参数传递模糊条件
List<User> users = userMapper.selectByCondition("name like #{value}");