mybatis 不同条件拼接不同sql
Mybatis总结2020 https://blog.csdn.net/libusi001/article/details/100066086 一、简单举例:不同条件拼接不同sql
</where>
ORDER BY
<if test="name != null and name !='' and name == '1'.toString()">
dept DESC
</if>
<if test="name != null and name !='' and name == '2'.toString()">
type DESC
</if>
二、Postman访问
三、注意事项
前言:
name代码为String,
XML 代码为: <if test="name != null and name !='' and name == '1'.toString()">
- postman入参可以为”name”: “1”,或”name”: 1
- ‘1’需要加上单引号
- 加单引号后为字符,类型为Charactor
有用请点赞,养成良好习惯!
疑问、交流、鼓励请留言!
还没有评论,来说两句吧...