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

    <select id="listDay" resultType="com.huimv.admin.entity.vo.WriteEnvDataVo">
    SELECT Convert((IFNULL(AVG(temp),'0')),DECIMAL(10,2)) 'envTemp',Convert((IFNULL(AVG(hum),'0')),DECIMAL(10,2)) 'envHum',create_time FROM write_env_data
    ${ew.customSqlSegment}
    group BY DATE_FORMAT(create_time,'%Y-%m-%d')
    ORDER BY create_time ASC
    </select>


    <select id="listDay2" resultType="com.huimv.admin.entity.vo.WriteEnvDataVo">
    SELECT Convert((IFNULL(AVG(temp),'0')),DECIMAL(10,2)) 'envTemp',Convert((IFNULL(AVG(hum),'0')),DECIMAL(10,2)) 'envHum',create_time FROM write_env_data
    ${ew.customSqlSegment}
    group BY DATE_FORMAT(create_time,'%Y-%m-%d %H')
    ORDER BY create_time ASC
    </select>

    <select id="listNow" resultType="com.huimv.admin.entity.vo.WriteEnvDataVo">
    SELECT Convert((IFNULL(temp,'0')),DECIMAL(10,2)) 'envTemp',Convert((IFNULL(hum,'0')),DECIMAL(10,2)) 'envHum',create_time FROM write_env_data
    ${ew.customSqlSegment}
    ORDER BY create_time ASC
    </select>
</mapper>
