| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 | <?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.welampiot.dao.LampInfoLogDao">    <delete id="deleteByLampId">        delete from lamp_info_log where lampid=#{lampId};    </delete>    <select id="getListByVO" parameterType="com.welampiot.vo.LampLogVO" resultType="com.welampiot.dto.LampInfoLogDTO">        select gridvolt as voltage,gridcurr as current,grid_active_power as power,dim_value as dimValue,updatetime as updateTime from lamp_info_log where lampid=#{lampId}        <if test="startDate != null">            and updateTime >= #{startDate}        </if>        <if test="endDate != null">            and updateTime <= #{endDate}        </if>        order by updatetime DESC    </select>        <select id="getDayEleUsedList" resultType="LampInfoLogDTO">        SELECT            SUM(A.minEle) AS sumMinEle,            SUM(A.maxEle) AS sumMaxEle,            SUM(A.minSave) AS sumMinSave,            SUM(A.maxSave) AS sumMaxSave,            SUM(A.minLightTime) AS sumMinLightTime,            SUM(A.maxLightTime) AS sumMaxLightTime,            DATE_FORMAT(A.minTime,'%Y-%m-%d %H:00:00') AS updateTime        FROM            (SELECT MIN(l.used_energy_total) AS minEle,                    MAX(l.used_energy_total) AS maxEle,                    MIN(l.work_time_total) AS minLightTime,                    MAX(l.work_time_total) AS maxLightTime,                    MIN(l.total_ele_save) AS minSave,                    MAX(l.total_ele_save) AS maxSave,                    l.updatetime AS minTime            FROM lamp_info_log l            LEFT JOIN lampinfo l1            ON l.lampid = l1.id            WHERE l.updatetime <![CDATA[ >= ]]> DATE_FORMAT(NOW(), '%Y-%m-%d 00:00:00')            AND l.updatetime <![CDATA[ <= ]]> DATE_FORMAT(NOW(), '%Y-%m-%d 23:59:59')            <choose>                <when test="type == 0 and value != 0">                    AND l.lampid = #{value}                </when>                <when test="type == 1 and value != 0">                    AND l1.sectionid = #{value}                </when>                <when test="type == 2 and value != 0">                    AND l1.areaid = #{value}                </when>            </choose>            GROUP BY DATE_FORMAT(l.updatetime, '%Y-%m-%d %H'),l.lampid) AS A        GROUP BY DATE_FORMAT(A.minTime,'%Y-%m-%d %H')    </select>    <delete id="deleteLampInfoLogData">        delete        from lamp_info_log        where lampid = #{lampId}        <if test="startDate != null and startDate != ''">            and updatetime <![CDATA[ >= ]]> #{startDate}        </if>        <if test="endDate != null and endDate != ''">            and updatetime <![CDATA[ <= ]]> #{endDate}        </if>    </delete></mapper>
 |