<select id="findUser" resultType="User">
select * from users
<where>
<choose>
<when test="id != null">
and id = #{id}
</when>
<when test="email != null">
and email = #{email}
</when>
<otherwise>
and username = #{username}
</otherwise>
</choose>
</where>
</select>
以上是编程学习网小编为您介绍的“MyBatis动态 SQL语法多条件 AND/OR 语句代码示例”的全面内容,想了解更多关于 mysql 内容,请继续关注编程基础学习网。
沃梦达教程
本文标题为:MyBatis动态 SQL语法多条件 AND/OR 语句代码示例
猜你喜欢
- Redis之key的淘汰策略 2024-03-02
- mysql语法如何实现命令行关闭和服务关闭 2024-12-15
- 互联网公司面试经常会问的Redis题目 2023-09-11
- MySQL 索引和数据表该如何维护 2023-12-19
- MYSQL大表改字段慢问题如何解决 2024-03-02
- PostgreSQL逻辑复制解密原理解析 2023-07-21
- redis应用场景 2023-09-13
- openGauss数据库共享存储特性概述 2023-12-20
- Redis ZREVRANGEBYSCORE命令 2024-02-23
- redis的应用场景 为什么用redis 2024-03-02