<choose> <when test="dateFlag=='day'"> CONVERT(VARCHAR(10), FRI.INVOICE_DATE, 120) AS CREATED_ON, </when> <when test="dateFlag=='month'"> CONVERT(VARCHAR(7), FRI.INVOICE_DATE, 120) AS CREATED_ON, </when> <when test="dateFlag=='week'"> STR(YEAR(FRI.INVOICE_DATE), 4) + '第' + datename(week, FRI.INVOICE_DATE) + '周' AS CREATED_ON, </when> <when test="dateFlag=='season'"> STR(YEAR(FRI.INVOICE_DATE), 4) + '第' + datename(quarter, FRI.INVOICE_DATE) + '季' AS CREATED_ON, </when> <when test="dateFlag=='year'"> YEAR(FRI.INVOICE_DATE) AS CREATED_ON, </when> <when test="dateFlag=='half'"> STR(YEAR(FRI.INVOICE_DATE), 4) + (CASE WHEN MONTH(FRI.INVOICE_DATE) < 7 THEN '上半年' ELSE '下半年' END) AS CREATED_ON, </when> <otherwise> CONVERT(VARCHAR(10), FRI.INVOICE_DATE, 120) AS CREATED_ON, </otherwise> </choose>