MyBatis中choose when正确写法

时间:2018-12-22 19:30:04   收藏:0   阅读:763
<choose>
    <when test="scoreRange!=null and scoreRange eq 1">
        AND sc.score <![CDATA[ < ]]> 60
    </when>
    <when test="scoreRange!=null and scoreRange eq 2">
        AND (sc.score <![CDATA[ >= ]]> 60 AND sc.score <![CDATA[ <= ]]> 70 )
    </when>
    <when test="scoreRange!=null and scoreRange eq 3">
        AND (sc.score <![CDATA[ >= ]]> 70 AND sc.score <![CDATA[ <= ]]> 80 )
    </when>
    <when test="scoreRange!=null and scoreRange eq 4">
        AND (sc.score <![CDATA[ >= ]]> 80 AND sc.score <![CDATA[ <= ]]> 90 )
    </when>
    <when test="scoreRange!=null and scoreRange eq 5">
        AND sc.score <![CDATA[ > ]]> 90
    </when>
    <otherwise>
    </otherwise>
</choose>

原文:https://www.cnblogs.com/tangyouwei/p/Mybatis.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!