
<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语法条件 WHERE 子句代码示例
上面是“MyBatis动态 SQL语法多条件 AND/OR 语句代码示例”的全面内容,想了解更多关于 mysql 内容,请继续关注web建站教程。
当前网址:https://m.ipkd.cn/webs_12107.html
声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!

推荐一款高质量的MP4视频素材网站——Coverr
袋鼠参谋APP最新版
233网校:一家专注于在线职业教育考试的综合性考证平台
飞瓜数据官网:一款专注于短视频及直播领域的数据分析工具
红船ppt:一款应用于党课教育、革命传统教育、企业文化宣传等PPT
一站式AIGC视频创作,只需输入文字即可生成3D数字人视频——有言AI数字人