MyBatis中choose when正确写法
Posted 远方的灯塔
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了MyBatis中choose when正确写法相关的知识,希望对你有一定的参考价值。
<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>
以上是关于MyBatis中choose when正确写法的主要内容,如果未能解决你的问题,请参考以下文章
求解mybatis choose 标签使用为啥只能执行第一个<when>语句