标签:不同 state res mode where result from otherwise sele
根据状态不同进行查询
<select id="selectUserByState" resultType="com.bz.model.entity.User"> SELECT * FROM user WHERE 1=1 <choose> <when test="state == 1"> AND name = #{name1} </when> <otherwise> AND name = #{name2} </otherwise> </choose> </select>
<select id="selectUserByState" resultType="com.bz.model.entity.User"> SELECT * FROM user WHERE 1=1 <choose> <when test="state == 1"> AND name = #{name1} </when> <when test="state == 2"> AND name = #{name2} </when> <otherwise> AND name = #{name3} </otherwise> </choose> </select>
MyBatis中if - else if - else 的使用
标签:不同 state res mode where result from otherwise sele
原文地址:https://www.cnblogs.com/buzheng/p/12485464.html