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

    <select id="listWrite" resultType="com.huimv.admin.entity.vo.WriteProtDataVo">
        select Convert((IFNULL(AVG(FLOW),'0')),DECIMAL(10,2)) 'flow',
        Convert((IFNULL(AVG(NH3N),'0')),DECIMAL(10,2)) 'nhn3',
        Convert((IFNULL(AVG(TP),'0')),DECIMAL(10,2)) 'tp',
        Convert((IFNULL(AVG(TN),'0')),DECIMAL(10,2)) 'tn',
        Convert((IFNULL(AVG(cod),'0')),DECIMAL(10,2)) 'cod',
        Convert((IFNULL(AVG(ph),'0')),DECIMAL(10,2)) 'ph',create_date,loction_type from write_prot_data
        ${ew.customSqlSegment}
        group BY DATE_FORMAT(create_date,'%Y-%m-%d')
        ORDER BY create_date ASC
    </select>
    <select id="listWriteYear" resultType="com.huimv.admin.entity.vo.WriteProtDataVo">
        select Convert((IFNULL(AVG(FLOW),'0')),DECIMAL(10,2)) 'flow',
        Convert((IFNULL(AVG(NH3N),'0')),DECIMAL(10,2)) 'nhn3',
        Convert((IFNULL(AVG(TP),'0')),DECIMAL(10,2)) 'tp',
        Convert((IFNULL(AVG(TN),'0')),DECIMAL(10,2)) 'tn',
        Convert((IFNULL(AVG(cod),'0')),DECIMAL(10,2)) 'cod',
        Convert((IFNULL(AVG(ph),'0')),DECIMAL(10,2)) 'ph',create_date,loction_type from write_prot_data
        ${ew.customSqlSegment}
        group BY DATE_FORMAT(create_date,'%Y-%m')
        ORDER BY create_date ASC
    </select>
</mapper>
