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"&爿讥旌护gt; e.ewb_no LIKE concat(concat('%',#{params.ewbNo}),'%')</if>
4、使用bind结果查看。
5、使用在代码参数中直接加入%%查看输出sql
6、使用concat查看输出的sql结果。
声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
阅读量:42
阅读量:58
阅读量:75
阅读量:55
阅读量:62