<!--多个条件,进行信息查询 -->
<select resultType="userListArray" >
select * from user where 1=1
<choose>
<when test="userName!=null and userName!='' ">
and userName like concat('%',#{userName},'%')
</when>
<when test="usercode!=null and usercode!='' ">
and usercode like concat('%',#{usercode},'%')
</when>
<otherwise>
and year(creationDate)=year(#{creationDate})
</otherwise>
</choose>
</select>
相关文章
- 定义band字段在 Mybatis中关于OGNL表达式会出现冲突Malformed OGNL expression
- mybatis choose when
- Modify the average program to promote for intergers repeatedly.stop when a nagetive number is entere
- 【Java代码审计 | 第三篇】SQL注入之Hibernate、MyBatis-MyBatis 的两种写法
- 若依(RuoYi)整合mybatis-plus,亲测有效
- MyBatis-Plus 与 Redis
- mybatis-plus中and和or的使用
- SQL 结合CASE WHEN 实现二维统计
- mybatis plus 限制查询个数
- Mybatis的mapper文件中$和#的区别