mybatis的<choose>和<when>、<otherwise>标签

SELECT
<choose>
<when test='timeType=="yy"'>
TO_CHAR(REPORT_TIME,'yyyy')
</when>
<when test='timeType=="mm"'>
TO_CHAR(REPORT_TIME,'yyyy-MM-dd')
</when>
<when test='timeType=="dd"'>
TO_CHAR(REPORT_TIME,'yyyy-MM-dd')
</when>
</choose>
RQ,
<choose>
<when test='isAll != null and isAll == 1'>
SUM(TOTAL)
</when>
<otherwise>
SUM(GROW_TOTAL)
</otherwise>
</choose>
NUM
FROM REPORT_EMPLOYEE

posted on 2017-11-30 14:05  小甜瓜安东泥  阅读(3821)  评论(0编辑  收藏  举报