mybatis如何进行like模糊查询?
1、使用bind标签:
<if test="params.ewbNo!=null">
<bind name="pattern" value="'%' + params.ewbNo +'%'" />
and e.ewb_no like #{pattern}
</if>

2、在代码参数中直接加入%%:
params.put("ewbNo","%"+request.getStringValue("ewbNo")+"%");

3、在sql语句中进行使用concat连接
<if test="params.ewbNo!=null"> e.ewb_no LIKE concat(concat('%',#{params.ewbNo}),'%')</if>

4、使用bind结果查看。

5、使用在代码参数中直接加入%%查看输出sql

6、使用concat查看输出的sql结果。

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
阅读量:120
阅读量:116
阅读量:173
阅读量:65
阅读量:71