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

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.huimv.admin.entity.EnvDeviceOnline">
        <id column="id" property="id" />
        <result column="farm_id" property="farmId" />
        <result column="device_on" property="deviceOn" />
        <result column="device_off" property="deviceOff" />
        <result column="now_month" property="nowMonth" />
        <result column="now_year" property="nowYear" />
        <result column="creat_time" property="creatTime" />
        <result column="online_rate" property="onlineRate" />
        <result column="ohter1" property="ohter1" />
        <result column="ohter2" property="ohter2" />
        <result column="ohter3" property="ohter3" />
    </resultMap>

    <select id="list" resultType="com.huimv.admin.entity.EnvDeviceOnline">
        SELECT a.*  FROM `env_device_online` a
--         INNER JOIN
--         (select max(creat_time) da FROM `env_device_online` where farm_id='${farmId}' and
--         creat_time >'${dateTime}'
        ${ew.customSqlSegment}
        GROUP BY DATE_FORMAT(creat_time,'%Y-%m-%d'))
        order creat_time asc
--         AS b ON a.creat_time=b.da
    </select>
</mapper>
