首页 > 学院 > 开发设计 > 正文

mybatis choose标签的用法

2019-11-08 02:30:33
字体:
来源:转载
供稿:网友

先上代码:

<choose>   <when test="BEGINTIME != null and BEGINTIME != '' and ENDTIME != null and ENDTIME != ''">      AND time BETWEEN #{BEGINTIME, jdbcType=VARCHAR} AND #{ENDTIME, jdbcType=VARCHAR}   </when>   <when test="BEGINTIME != null and BEGINTIME != ''">      <![CDATA[ AND time  > #{BEGINTIME, jdbcType=TIMESTAMP} ]]>   </when>   <when test="ENDTIME != null and ENDTIME != ''">      <![CDATA[ AND time  < #{ENDTIME, jdbcType=TIMESTAMP} ]]>   </when>   <otherwise></otherwise>  </choose> choose标签与if标签不同,前者之间是或(or)的关系,后者之间是与(and)的关系,choose标签类似于java中的switch语句

choose-switch

when-case

otherwise-default


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表