<?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.ruoyi.project.aspen.mapper.TDashboarddayelecMapper">
    
    <resultMap type="TDashboarddayelec" id="TDashboarddayelecResult">
        <result property="id"    column="id"    />
        <result property="delFlag"    column="del_flag"    />
        <result property="createrCode"    column="creater_code"    />
        <result property="createdate"    column="createdate"    />
        <result property="updaterCode"    column="updater_code"    />
        <result property="updatedate"    column="updatedate"    />
        <result property="gtg1Lv"    column="gtg1_lv"    />
        <result property="gtg1Wr"    column="gtg1_wr"    />
        <result property="gtg2Lv"    column="gtg2_lv"    />
        <result property="gtg2Wr"    column="gtg2_wr"    />
        <result property="gtg3Lv"    column="gtg3_lv"    />
        <result property="gtg3Wr"    column="gtg3_wr"    />
        <result property="stg1Lv"    column="stg1_lv"    />
        <result property="stg1Wr"    column="stg1_wr"    />
        <result property="mwhLv"    column="mwh_lv"    />
        <result property="mwhWr"    column="mwh_wr"    />
        <result property="hhp"    column="hhp"    />
        <result property="hp"    column="hp"    />
        <result property="lp"    column="lp"    />
        <result property="mp"    column="mp"    />
        <result property="totalConsumption"    column="total_consumption"    />
        <result property="hhpNum"    column="hhp_num"    />
        <result property="hhpTemp"    column="hhp_temp"    />
        <result property="hpNum"    column="hp_num"    />
        <result property="hpTemp"    column="hp_temp"    />
        <result property="lpNum"    column="lp_num"    />
        <result property="lpTemp"    column="lp_temp"    />
        <result property="mpNum"    column="mp_num"    />
        <result property="mpTemp"    column="mp_temp"    />
        <result property="shihua"    column="shihua"    />
        <result property="shiyou"    column="shiyou"    />
        <result property="shunshiliang"    column="shunshiliang"    />
        <result property="ypg"    column="ypg"    />
        <result property="daodianliang"    column="daodianliang"    />
        <result property="eveLec"    column="eve_lec"    />
        <result property="fenggucha"    column="fenggucha"    />
        <result property="bycElec"    column="byc_elec"    />
        <result property="bocElec"    column="boc_elec"    />
        <result property="dataDate"    column="data_date"    />
        <result property="dateDay"    column="date_day"    />
        <result property="deptName" column="dept_name" />
    </resultMap>

    <sql id="selectTDashboarddayelecVo">
        <!-- 王子文 2022年4月15日 修改 -->
        <!-- select d.id, d.del_flag, d.creater_code, d.createdate, d.updater_code, d.updatedate, d.gtg1_lv, d.gtg1_wr, d.gtg2_lv, d.gtg2_wr, d.gtg3_lv, d.gtg3_wr, d.stg1_lv, d.stg1_wr, d.mwh_lv, d.mwh_wr, d.hhp, d.hp, d.lp, d.mp, d.total_consumption, d.hhp_num, d.hhp_temp, d.hp_num, d.hp_temp, d.lp_num, d.lp_temp, d.mp_num, d.mp_temp, d.shihua, d.shiyou, d.shunshiliang, d.ypg, d.daodianliang, d.eve_lec, d.fenggucha, d.byc_elec, d.boc_elec, d.data_date, d.date_day ,s.dept_name from t_dashboarddayelec d left join sys_dept s on s.dept_id = d.dept_id -->
        select
            id,
            del_flag,
            creater_code,
            createdate,
            updater_code,
            updatedate,
            gtg1_lv,
            gtg1_wr,
            gtg2_lv,
            gtg2_wr,
            gtg3_lv,
            gtg3_wr,
            stg1_lv,
            stg1_wr,
            mwh_lv,
            mwh_wr,
            hhp,
            hp,
            lp,
            mp,
            total_consumption,
            hhp_num,
            hhp_temp,
            hp_num,
            hp_temp,
            lp_num,
            lp_temp,
            mp_num,
            mp_temp,
            shihua,
            shiyou,
            shunshiliang,
            ypg,
            daodianliang,
            eve_lec,
            fenggucha,
            byc_elec,
            boc_elec,
            data_date,
            date_day
        from
            t_dashboarddayelec
    </sql>

    <select id="selectTDashboarddayelecList" parameterType="TDashboarddayelec" resultMap="TDashboarddayelecResult">
        <include refid="selectTDashboarddayelecVo"/>
        <where>  
            <if test="createrCode != null  and createrCode != ''"> and creater_code = #{createrCode}</if>
            <if test="createdate != null "> and createdate = #{createdate}</if>
            <if test="updaterCode != null  and updaterCode != ''"> and updater_code = #{updaterCode}</if>
            <if test="updatedate != null "> and updatedate = #{updatedate}</if>
            <if test="gtg1Lv != null  and gtg1Lv != ''"> and gtg1_lv = #{gtg1Lv}</if>
            <if test="gtg1Wr != null  and gtg1Wr != ''"> and gtg1_wr = #{gtg1Wr}</if>
            <if test="gtg2Lv != null  and gtg2Lv != ''"> and gtg2_lv = #{gtg2Lv}</if>
            <if test="gtg2Wr != null  and gtg2Wr != ''"> and gtg2_wr = #{gtg2Wr}</if>
            <if test="gtg3Lv != null  and gtg3Lv != ''"> and gtg3_lv = #{gtg3Lv}</if>
            <if test="gtg3Wr != null  and gtg3Wr != ''"> and gtg3_wr = #{gtg3Wr}</if>
            <if test="stg1Lv != null  and stg1Lv != ''"> and stg1_lv = #{stg1Lv}</if>
            <if test="stg1Wr != null  and stg1Wr != ''"> and stg1_wr = #{stg1Wr}</if>
            <if test="mwhLv != null  and mwhLv != ''"> and mwh_lv = #{mwhLv}</if>
            <if test="mwhWr != null  and mwhWr != ''"> and mwh_wr = #{mwhWr}</if>
            <if test="hhp != null  and hhp != ''"> and hhp = #{hhp}</if>
            <if test="hp != null  and hp != ''"> and hp = #{hp}</if>
            <if test="lp != null  and lp != ''"> and lp = #{lp}</if>
            <if test="mp != null  and mp != ''"> and mp = #{mp}</if>
            <if test="totalConsumption != null  and totalConsumption != ''"> and total_consumption = #{totalConsumption}</if>
            <if test="hhpNum != null "> and hhp_num = #{hhpNum}</if>
            <if test="hhpTemp != null  and hhpTemp != ''"> and hhp_temp = #{hhpTemp}</if>
            <if test="hpNum != null  and hpNum != ''"> and hp_num = #{hpNum}</if>
            <if test="hpTemp != null  and hpTemp != ''"> and hp_temp = #{hpTemp}</if>
            <if test="lpNum != null "> and lp_num = #{lpNum}</if>
            <if test="lpTemp != null  and lpTemp != ''"> and lp_temp = #{lpTemp}</if>
            <if test="mpNum != null "> and mp_num = #{mpNum}</if>
            <if test="mpTemp != null  and mpTemp != ''"> and mp_temp = #{mpTemp}</if>
            <if test="shihua != null  and shihua != ''"> and shihua = #{shihua}</if>
            <if test="shiyou != null  and shiyou != ''"> and shiyou = #{shiyou}</if>
            <if test="shunshiliang != null  and shunshiliang != ''"> and shunshiliang = #{shunshiliang}</if>
            <if test="ypg != null  and ypg != ''"> and ypg = #{ypg}</if>
            <if test="daodianliang != null  and daodianliang != ''"> and daodianliang = #{daodianliang}</if>
            <if test="eveLec != null  and eveLec != ''"> and eve_lec = #{eveLec}</if>
            <if test="fenggucha != null  and fenggucha != ''"> and fenggucha = #{fenggucha}</if>
            <if test="bycElec != null  and bycElec != ''"> and byc_elec = #{bycElec}</if>
            <if test="bocElec != null  and bocElec != ''"> and boc_elec = #{bocElec}</if>
            <if test="dataDate != null "> and data_date = #{dataDate}</if>
            <if test="dateDay != null  and dateDay != ''"> and date_day = #{dateDay}</if>
            <!-- 王子文 2022年4月15日 修改 -->
            <!-- and d.del_flag = 0  -->
            and del_flag = 0
        </where>
        <!-- 数据范围过滤 -->
        ${params.dataScope}
    </select>
    
    <select id="selectTDashboarddayelecById" parameterType="Long" resultMap="TDashboarddayelecResult">
        <include refid="selectTDashboarddayelecVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertTDashboarddayelec" parameterType="TDashboarddayelec">
        <selectKey keyProperty="id" resultType="long" order="BEFORE">
            SELECT seq_t_dashboarddayelec.NEXTVAL as id FROM DUAL
        </selectKey>
        insert into t_dashboarddayelec
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="delFlag != null">del_flag,</if>
            <if test="createrCode != null">creater_code,</if>
            <if test="createdate != null">createdate,</if>
            <if test="updaterCode != null">updater_code,</if>
            <if test="updatedate != null">updatedate,</if>
            <if test="gtg1Lv != null">gtg1_lv,</if>
            <if test="gtg1Wr != null">gtg1_wr,</if>
            <if test="gtg2Lv != null">gtg2_lv,</if>
            <if test="gtg2Wr != null">gtg2_wr,</if>
            <if test="gtg3Lv != null">gtg3_lv,</if>
            <if test="gtg3Wr != null">gtg3_wr,</if>
            <if test="stg1Lv != null">stg1_lv,</if>
            <if test="stg1Wr != null">stg1_wr,</if>
            <if test="mwhLv != null">mwh_lv,</if>
            <if test="mwhWr != null">mwh_wr,</if>
            <if test="hhp != null">hhp,</if>
            <if test="hp != null">hp,</if>
            <if test="lp != null">lp,</if>
            <if test="mp != null">mp,</if>
            <if test="totalConsumption != null">total_consumption,</if>
            <if test="hhpNum != null">hhp_num,</if>
            <if test="hhpTemp != null">hhp_temp,</if>
            <if test="hpNum != null">hp_num,</if>
            <if test="hpTemp != null">hp_temp,</if>
            <if test="lpNum != null">lp_num,</if>
            <if test="lpTemp != null">lp_temp,</if>
            <if test="mpNum != null">mp_num,</if>
            <if test="mpTemp != null">mp_temp,</if>
            <if test="shihua != null">shihua,</if>
            <if test="shiyou != null">shiyou,</if>
            <if test="shunshiliang != null">shunshiliang,</if>
            <if test="ypg != null">ypg,</if>
            <if test="daodianliang != null">daodianliang,</if>
            <if test="eveLec != null">eve_lec,</if>
            <if test="fenggucha != null">fenggucha,</if>
            <if test="bycElec != null">byc_elec,</if>
            <if test="bocElec != null">boc_elec,</if>
            <if test="dataDate != null">data_date,</if>
            <if test="dateDay != null">date_day,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="delFlag != null">#{delFlag},</if>
            <if test="createrCode != null">#{createrCode},</if>
            <if test="createdate != null">#{createdate},</if>
            <if test="updaterCode != null">#{updaterCode},</if>
            <if test="updatedate != null">#{updatedate},</if>
            <if test="gtg1Lv != null">#{gtg1Lv},</if>
            <if test="gtg1Wr != null">#{gtg1Wr},</if>
            <if test="gtg2Lv != null">#{gtg2Lv},</if>
            <if test="gtg2Wr != null">#{gtg2Wr},</if>
            <if test="gtg3Lv != null">#{gtg3Lv},</if>
            <if test="gtg3Wr != null">#{gtg3Wr},</if>
            <if test="stg1Lv != null">#{stg1Lv},</if>
            <if test="stg1Wr != null">#{stg1Wr},</if>
            <if test="mwhLv != null">#{mwhLv},</if>
            <if test="mwhWr != null">#{mwhWr},</if>
            <if test="hhp != null">#{hhp},</if>
            <if test="hp != null">#{hp},</if>
            <if test="lp != null">#{lp},</if>
            <if test="mp != null">#{mp},</if>
            <if test="totalConsumption != null">#{totalConsumption},</if>
            <if test="hhpNum != null">#{hhpNum},</if>
            <if test="hhpTemp != null">#{hhpTemp},</if>
            <if test="hpNum != null">#{hpNum},</if>
            <if test="hpTemp != null">#{hpTemp},</if>
            <if test="lpNum != null">#{lpNum},</if>
            <if test="lpTemp != null">#{lpTemp},</if>
            <if test="mpNum != null">#{mpNum},</if>
            <if test="mpTemp != null">#{mpTemp},</if>
            <if test="shihua != null">#{shihua},</if>
            <if test="shiyou != null">#{shiyou},</if>
            <if test="shunshiliang != null">#{shunshiliang},</if>
            <if test="ypg != null">#{ypg},</if>
            <if test="daodianliang != null">#{daodianliang},</if>
            <if test="eveLec != null">#{eveLec},</if>
            <if test="fenggucha != null">#{fenggucha},</if>
            <if test="bycElec != null">#{bycElec},</if>
            <if test="bocElec != null">#{bocElec},</if>
            <if test="dataDate != null">#{dataDate},</if>
            <if test="dateDay != null">#{dateDay},</if>
         </trim>
    </insert>

    <update id="updateTDashboarddayelec" parameterType="TDashboarddayelec">
        update t_dashboarddayelec
        <trim prefix="SET" suffixOverrides=",">
            <if test="delFlag != null">del_flag = #{delFlag},</if>
            <if test="createrCode != null">creater_code = #{createrCode},</if>
            <if test="createdate != null">createdate = #{createdate},</if>
            <if test="updaterCode != null">updater_code = #{updaterCode},</if>
            <if test="updatedate != null">updatedate = #{updatedate},</if>
            <if test="gtg1Lv != null">gtg1_lv = #{gtg1Lv},</if>
            <if test="gtg1Wr != null">gtg1_wr = #{gtg1Wr},</if>
            <if test="gtg2Lv != null">gtg2_lv = #{gtg2Lv},</if>
            <if test="gtg2Wr != null">gtg2_wr = #{gtg2Wr},</if>
            <if test="gtg3Lv != null">gtg3_lv = #{gtg3Lv},</if>
            <if test="gtg3Wr != null">gtg3_wr = #{gtg3Wr},</if>
            <if test="stg1Lv != null">stg1_lv = #{stg1Lv},</if>
            <if test="stg1Wr != null">stg1_wr = #{stg1Wr},</if>
            <if test="mwhLv != null">mwh_lv = #{mwhLv},</if>
            <if test="mwhWr != null">mwh_wr = #{mwhWr},</if>
            <if test="hhp != null">hhp = #{hhp},</if>
            <if test="hp != null">hp = #{hp},</if>
            <if test="lp != null">lp = #{lp},</if>
            <if test="mp != null">mp = #{mp},</if>
            <if test="totalConsumption != null">total_consumption = #{totalConsumption},</if>
            <if test="hhpNum != null">hhp_num = #{hhpNum},</if>
            <if test="hhpTemp != null">hhp_temp = #{hhpTemp},</if>
            <if test="hpNum != null">hp_num = #{hpNum},</if>
            <if test="hpTemp != null">hp_temp = #{hpTemp},</if>
            <if test="lpNum != null">lp_num = #{lpNum},</if>
            <if test="lpTemp != null">lp_temp = #{lpTemp},</if>
            <if test="mpNum != null">mp_num = #{mpNum},</if>
            <if test="mpTemp != null">mp_temp = #{mpTemp},</if>
            <if test="shihua != null">shihua = #{shihua},</if>
            <if test="shiyou != null">shiyou = #{shiyou},</if>
            <if test="shunshiliang != null">shunshiliang = #{shunshiliang},</if>
            <if test="ypg != null">ypg = #{ypg},</if>
            <if test="daodianliang != null">daodianliang = #{daodianliang},</if>
            <if test="eveLec != null">eve_lec = #{eveLec},</if>
            <if test="fenggucha != null">fenggucha = #{fenggucha},</if>
            <if test="bycElec != null">byc_elec = #{bycElec},</if>
            <if test="bocElec != null">boc_elec = #{bocElec},</if>
            <if test="dataDate != null">data_date = #{dataDate},</if>
            <if test="dateDay != null">date_day = #{dateDay},</if>
        </trim>
        where id = #{id}
    </update>

    <update id="deleteTDashboarddayelecById" parameterType="Long">
        update t_dashboarddayelec set del_flag = 2 where id = #{id}
    </update>

    <update id="deleteTDashboarddayelecByIds" parameterType="String">
        update t_dashboarddayelec set del_flag = 2 where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </update>

    <select id="selectLast" parameterType="TDashboarddayelec" resultMap="TDashboarddayelecResult">
        select * from ( select * from t_dashboarddayelec where del_flag = 0 order by id desc ) WHERE ROWNUM = 1
    </select>

    <select id="selectMonth" parameterType="TDashboarddayelec" resultMap="TDashboarddayelecResult">
        select * from ( select * from t_dashboarddayelec where del_flag = 0 order by id asc ) WHERE 32 > ROWNUM
    </select>

    <select id="selectWeek" parameterType="TDashboarddayelec" resultMap="TDashboarddayelecResult">
        select * from ( select * from t_dashboarddayelec where del_flag = 0 order by id asc ) WHERE 8 > ROWNUM
    </select>

    <select id="selecctfiftyday" parameterType="TDashboarddayelec" resultMap="TDashboarddayelecResult">
        select * from ( select * from t_dashboarddayelec where del_flag = 0 order by id asc ) WHERE 50 > ROWNUM
    </select>
    
</mapper>