动态SQL(choose, when, otherwise)
来源:互联网 发布:深圳软件免费培训 编辑:程序博客网 时间:2024/06/06 00:49
概要
1.读者在阅读博客前可以事先阅读MyBatis3.4官方文档
2.本篇博客用于解决在使用MyBatis3.4时可能出现的困惑
choose标签
1.先看一段MyBatis3.4官方文档的例子
<select id="findActiveBlogLike" resultType="Blog"> SELECT * FROM BLOG WHERE state = ‘ACTIVE’ <choose> <when test="title != null"> AND title like #{title} </when> <when test="author != null and author.name != null"> AND author_name like #{author.name} </when> <otherwise> AND featured = 1 </otherwise> </choose></select>
2.choose标签在使用时等价于java中的if else
if(...){ ... }else if(...){ ... }else{ ...}
参考文档
http://blog.csdn.net/ABCD898989/article/category/6076264
http://blog.csdn.net/abcd898989/article/details/51222452
阅读全文
0 0
- 动态SQL(choose, when, otherwise)
- 动态查询--(choose,when,otherwise)
- mybatis学习之路----动态sql之choose when otherwise
- MyBatis-动态SQL的if、choose、when、otherwise、trim、where、set、foreach使用
- MyBatis-动态SQL的if、choose、when、otherwise、trim、where、set、foreach使用
- Mybatis最入门---动态查询(choose,when,otherwise)
- Mybatis最入门---动态查询(choose,when,otherwise)
- Mybatis最入门---动态查询(choose,when,otherwise)
- mabatis标签 choose (when, otherwise)
- MyBatis choose(when, otherwise)标签
- 自定义choose,when,otherwise标签
- Mybatis choose (when, otherwise)标签
- Mybatis choose (when, otherwise)标签
- Mybatis 动态加载sql when otherwise choose 理解成if else 条件中可以把传来的参数当变量
- xsl:choose, xsl:when 和 xsl:otherwise
- JSTL:--choose,when,otherwise标签实例
- [c.y.j]mybatis choose when otherwise
- c:choose、c:when、c:otherwise 使用
- 连接ftp出现 331 Please specify the password 的解决办法
- 第九周——项目1——二叉树算法库
- IntelliJ-IDEA常用设置
- Alluxio安装与配置
- 第五周 项目3
- 动态SQL(choose, when, otherwise)
- 了解BDTC 2017四大看点:外籍讲师、早鸟票正式公布
- HBase集群监控那些事儿
- Linux重启tomcat脚本
- iOS 11 自定义UINavigationBar适配问题,导航条向上偏移20点问题
- 网站大全
- NODEjs 从数据库读取blob格式存储的图片
- jmeter:Jmeter3.1 使用技巧
- 在CentOS 7中搭建PPTP、L2TP、IPSec服务