<?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.environ.eco.mapper.EggDataMapper">

    <select id="getAllDay" resultType="com.huimv.environ.eco.entity.eggvo.EggVo">

     SELECT i , ROUND(SUM(a.wtr) ,2)wtrTdy  , ROUND(SUM(a.ft),2) ftDoTalTdy ,a.upload_time ,a.t_cur tCur,a.h_r hR FROM (
        SELECT
        i , DATE_FORMAT(upload_time,'%Y-%m-%d %H')  upload_time, MAX(wtr_tdy) wtr,MAX(ft_do_tal_tdy) ft, t_cur, h_r

        FROM `egg_data`
   ${ew.customSqlSegment}
 GROUP BY DATE_FORMAT(upload_time,'%Y-%m-%d %H')  ,i) a GROUP BY  a.upload_time

    </select>
    <select id="getAllWeek" resultType="com.huimv.environ.eco.entity.eggvo.EggVo">

     SELECT i ,ROUND(SUM(a.wtr) ,2)wtrTdy  , ROUND(SUM(a.ft),2)  ftDoTalTdy ,a.upload_time  ,a.t_cur tCur,a.h_r hR  FROM (
        SELECT
        i , DATE_FORMAT(upload_time,'%Y-%m-%d')  upload_time, MAX(wtr_tdy) wtr,MAX(ft_do_tal_tdy) ft,t_cur, h_r

        FROM `egg_data`

          ${ew.customSqlSegment}
         GROUP BY DATE_FORMAT(upload_time,'%Y-%m-%d')  ,i) a GROUP BY  a.upload_time

    </select>
    <select id="getAllDayFood" resultType="com.huimv.environ.eco.entity.eggvo.EggVo">
           SELECT
        i , DATE_FORMAT(upload_time,'%Y-%m-%d %H')  uploadTime,ROUND(MAX(wtr_tdy),2) wtrTdy,ROUND(MAX(ft_do_tal_tdy),2) ftDoTalTdy

        FROM `egg_data`
   ${ew.customSqlSegment}
 GROUP BY DATE_FORMAT(upload_time,'%Y-%m-%d %H')  ,i
    </select>
    <select id="getAllWeekFood" resultType="com.huimv.environ.eco.entity.eggvo.EggVo">
          SELECT
        i , DATE_FORMAT(upload_time,'%Y-%m-%d')  uploadTime,ROUND(MAX(wtr_tdy),2) wtrTdy,ROUND(MAX(ft_do_tal_tdy),2) ftDoTalTdy

        FROM `egg_data`

          ${ew.customSqlSegment}
         GROUP BY DATE_FORMAT(upload_time,'%Y-%m-%d')  ,i
    </select>
</mapper>
