<?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.huimv.admin.mapper.ProdSaleMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.huimv.admin.entity.ProdSale">
        <id column="id" property="id"/>
        <result column="sale_money" property="saleMoney"/>
        <result column="sale_quantity" property="saleQuantity"/>
        <result column="creat_time" property="creatTime"/>
        <result column="farm_id" property="farmId"/>
        <result column="other1" property="other1"/>
        <result column="other2" property="other2"/>
        <result column="other3" property="other3"/>
    </resultMap>

    <select id="listMonth" resultType="com.huimv.admin.entity.ProdSale">

select IFNULL(SUM(sale_quantity),'0') 'saleQuantity',creat_time FROM prod_sale
     ${ew.customSqlSegment}
GROUP BY DATE_FORMAT(creat_time,'%Y-%m')
ORDER BY creat_time ASC
    </select>

    <select id="listYear" resultType="com.huimv.admin.entity.ProdSale">

select IFNULL(SUM(sale_quantity),'0') 'saleQuantity',creat_time FROM prod_sale
     ${ew.customSqlSegment}
GROUP BY DATE_FORMAT(creat_time,'%Y')
ORDER BY creat_time ASC
    </select>
</mapper>
