zoukankan      html  css  js  c++  java
  • 五、动态SQL(<choose><when><otherwise>)

    一、<choose><when><otherwise>

    这是一套标签, 功能类似于 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>      
  • 相关阅读:
    MD5 Hashing in Java
    Caching in Presto
    ORC 文件存储格式
    Presto 性能优化点
    数据分页问题
    ES
    ES
    ES
    ES
    ES
  • 原文地址:https://www.cnblogs.com/qiaoxin11/p/12855531.html
Copyright © 2011-2022 走看看