Toggle navigation
VA伐木累
社区
VA伐木累
Proxy
JSON
BASE64
MyGit
登录
注册
×
登录
邮箱
密码
忘记密码?
Mybaties<if>标签的坑
•发布于
•作者
liuzy
•945 次浏览
•最后一次编辑是
•来自
技术
**场景:** ```java // 在Mapper里面传入字符串 List
findList(String keywords); ``` **状况:** ``` // 1.使用value
select * from user
where username like concat('%',#{value},'%')
// 隐藏问题,当keywords为空字符串时,依然会进入IF内。 // 2.使用_parameter
select * from user
where username like concat('%',#{_parameter},'%')
// 正确! // 3.使用keywords
select * from user
where username like concat('%',#{keywords},'%')
// 报错,不能运行 ``` **使用_parameter好像体验不是很爽,想用value又使空字符串判断正确怎么办呢?** ```java // 这样就可以了 List
findList(@Param("value") String keywords); ```
0 回复
作者
liuzy
积分: 841
“ 黑眼圈圈男 ”
无人回复话题
SonarQube 9.4 + PostgreSQL
shell倒计时
日常网络巧技
使用ssh创建socks5代理服务
NodeJS集群demo
作者其他话题
SonarQube 9.4 + PostgreSQL
shell倒计时
日常网络巧技
使用ssh创建socks5代理服务
NodeJS集群demo
回到顶部
友情链接:
JFinal
©2015 Powered by
jfinalbbs
沪ICP备15012258号