扫码关注官方订阅号
mybatis的<if test>判断标签有没有类似sql的like '%text%'模糊匹配的?如果没有,那么有没有方法可以做到在mybatis里条件判断并模糊匹配字符串?
没有,你只能在sql中拼了比如:
<select id="findActiveBlogWithTitleLike" resultType="Blog"> SELECT * FROM BLOG WHERE state = ‘ACTIVE’ <if test="title != null"> AND title like #{title} </if> </select>
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
没有,你只能在sql中拼了
比如: