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>


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM