<select id="queryUserLikeUserName" resultType="cn.itcast.pojo.User">
select * from tb_user where sex=1
<if test="userName!=null and userName.trim()!=''"> <!-- userName是@Param传递的参数 -->
and user_name like '%'□#{userName}'%' 
                                        注意这里的单引号和百分号  中间的 □ 表示空格  一定要加 否则无法查询和识别% 拼接        如果用双引号就没问题

</if>>

 

相关文章:

  • 2021-06-22
  • 2021-10-28
  • 2022-12-23
  • 2021-07-03
  • 2021-05-08
  • 2021-05-27
  • 2021-05-26
  • 2022-12-23
猜你喜欢
  • 2021-12-26
  • 2021-09-29
  • 2021-09-19
  • 2021-11-27
  • 2022-12-23
  • 2021-12-24
  • 2022-12-23
相关资源
相似解决方案