<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bonus.zlpt.bigscreen.mapper.MaOrderInfoMapper">

    <select id="selectMaOrderInfoList" resultType="com.bonus.zlpt.bigscreen.domain.vo.MaOrderInfoVo">
        SELECT
            CASE
                WHEN MONTH(STR_TO_DATE(time, '%Y-%m-%d')) = 1 THEN '一月'
                WHEN MONTH(STR_TO_DATE(time, '%Y-%m-%d')) = 2 THEN '二月'
                WHEN MONTH(STR_TO_DATE(time, '%Y-%m-%d')) = 3 THEN '三月'
                WHEN MONTH(STR_TO_DATE(time, '%Y-%m-%d')) = 4 THEN '四月'
                WHEN MONTH(STR_TO_DATE(time, '%Y-%m-%d')) = 5 THEN '五月'
                WHEN MONTH(STR_TO_DATE(time, '%Y-%m-%d')) = 6 THEN '六月'
                WHEN MONTH(STR_TO_DATE(time, '%Y-%m-%d')) = 7 THEN '七月'
                WHEN MONTH(STR_TO_DATE(time, '%Y-%m-%d')) = 8 THEN '八月'
                WHEN MONTH(STR_TO_DATE(time, '%Y-%m-%d')) = 9 THEN '九月'
                WHEN MONTH(STR_TO_DATE(time, '%Y-%m-%d')) = 10 THEN '十月'
                WHEN MONTH(STR_TO_DATE(time, '%Y-%m-%d')) = 11 THEN '十一月'
                WHEN MONTH(STR_TO_DATE(time, '%Y-%m-%d')) = 12 THEN '十二月'
       END AS month,
       COUNT(*) AS count
       FROM ma_order_info
       GROUP BY month
       ORDER BY month
    </select>

    <select id="selecttodayList" resultType="com.bonus.zlpt.bigscreen.domain.vo.MaOrderVo">
        SELECT COUNT(*) AS count,
        SUM(cost) AS money
        FROM ma_order_info
        WHERE DATE(time) = CURDATE()
    </select>
</mapper>