<!--多个条件,进行信息查询 -->
<select id="getUserList" 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>
mybatis choose when
最新推荐文章于 2023-12-13 21:11:09 发布