<?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.ProdProductionMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.huimv.admin.entity.ProdProduction">
        <id column="id" property="id"/>
        <result column="CFCHL" property="cfchl"/>
        <result column="BYCHL" property="bychl"/>
        <result column="FZCHL" property="fzchl"/>
        <result column="QRDPL" property="qrdpl"/>
        <result column="PZFML" property="pzfml"/>
        <result column="PJWCZS" property="pjwczs"/>
        <result column="PJWCHZS" property="pjwchzs"/>
        <result column="PJWCZCZS" property="pjwczczs"/>
        <result column="WDNZZS" property="wdnzzs"/>
        <result column="PJWDNZ" property="pjwdnz"/>
        <result column="FCCTS" property="fccts"/>
        <result column="SCWS" property="scws"/>
        <result column="PSY" property="psy"/>
        <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="listDay" resultType="com.huimv.admin.entity.ProdProduction">
        SELECT Convert((IFNULL(AVG(CFCHL),'0')),DECIMAL(10,2)) 'cfchl'
         ,Convert((IFNULL(AVG(BYCHL),'0')),DECIMAL(10,2)) 'bychl',
         Convert((IFNULL(AVG(FZCHL),'0')),DECIMAL(10,2)) 'fzchl',
         Convert((IFNULL(AVG(QRDPL),'0')),DECIMAL(10,2)) 'qrdpl',
         Convert((IFNULL(AVG(PJWDNZ),'0')),DECIMAL(10,2)) 'pjwdnz',
         Convert((IFNULL(AVG(PJWCZS),'0')),DECIMAL(10,2)) 'pjwczs',
         Convert((IFNULL(AVG(PJWCHZS),'0')),DECIMAL(10,2)) 'pjwchzs',
         Convert((IFNULL(AVG(PJWCZCZS),'0')),DECIMAL(10,2)) 'pjwczczs',
         Convert((IFNULL(AVG(WDNZZS),'0')),DECIMAL(10,2)) 'wdnzzs',
         creat_time
         FROM prod_production
         ${ew.customSqlSegment}
         GROUP BY DATE_FORMAT(creat_time,'%Y-%m-%d')
         ORDER BY creat_time ASC
    </select>
</mapper>
