这是一套标签, 功能类似于 switch...case...

 1 <select id="sel1" resultType="User">
 2         select * from tb_user
 3         <where>
 4             <choose>
 5                 <when test="user != null and user != ''">
 6                     and user = #{user}
 7                 </when>
 8                 <when test="passwd != null and passwd != ''">
 9                     and passwd = #{passwd}
10                 </when>
11                 <otherwise>
12                     and 1 = 1
13                 </otherwise>
14             </choose>
15         </where>
16 </select>      

 

相关文章:

  • 2021-10-27
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-03-09
  • 2021-09-13
  • 2022-12-23
猜你喜欢
  • 2021-09-19
  • 2021-10-06
  • 2021-10-07
  • 2022-12-23
  • 2021-09-25
  • 2022-12-23
相关资源
相似解决方案