ibatis中choose标签使用

论坛 期权论坛 脚本     
匿名网站用户   2020-12-21 09:34   11   0

choose标签是按顺序判断其内部when标签中的test条件出否成立,如果有一个成立,则 choose 结束。当 choose 中所有 when 的条件都不满则时,则执行 otherwise 中的sql。

<choose>

<when test="datetype=='lastVerifyDate'">

<!-- 最新确收时间范围 -->

<if test="datestart != null and datestart!=''"> AND lastVerifyDate &gt;= #{datestart} </if>

<if test="dateend != null and dateend!=''"> AND lastVerifyDate &lt;=#{dateend} </if>

</when>

<otherwise>

<!-- 注册时间范围 -->

<if test="datestart != null and datestart!=''"> AND registeDate &gt;= #{datestart} </if>

<if test="dateend != null and dateend!=''"> AND registeDate &lt;=#{dateend} </if>

</otherwise>

</choose>

分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:1136255
帖子:227251
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP