<?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.fastbee.deviceData.mapper.DeviceRealtimedataPhotovoltaicMapper">

    <resultMap type="DeviceRealtimedataPhotovoltaic" id="DeviceRealtimedataPhotovoltaicResult">
        <result property="id"    column="id"    />
        <result property="deviceId"    column="device_id"    />
        <result property="airTemp"    column="air_temp"    />
        <result property="mppTemp"    column="mpp_temp"    />
        <result property="batteryCap"    column="battery_cap"    />
        <result property="batteryVolt"    column="battery_volt"    />
        <result property="batteryCur"    column="battery_cur"    />
        <result property="batteryPower"    column="battery_power"    />
        <result property="loadVolt"    column="load_volt"    />
        <result property="loadCur"    column="load_cur"    />
        <result property="loadPower"    column="load_power"    />
        <result property="photVolt"    column="phot_volt"    />
        <result property="photCur"    column="phot_cur"    />
        <result property="photPower"    column="phot_power"    />
        <result property="cumChargeDay"    column="cum_charge_day"    />
        <result property="cumChargeMon"    column="cum_charge_mon"    />
        <result property="cumChargeYear"    column="cum_charge_year"    />
        <result property="cumChargeAll"    column="cum_charge_all"    />
        <result property="cumEleDay"    column="cum_ele_day"    />
        <result property="cumEleMon"    column="cum_ele_mon"    />
        <result property="cumEleYear"    column="cum_ele_year"    />
        <result property="cumEleAll"    column="cum_ele_all"    />
        <result property="shoudong"    column="shoudong"    />
        <result property="control"    column="control"    />
        <result property="airTemp2"    column="air_temp_2"    />
        <result property="mppTemp2"    column="mpp_temp_2"    />
        <result property="batteryCap2"    column="battery_cap_2"    />
        <result property="batteryVolt2"    column="battery_volt_2"    />
        <result property="batteryCur2"    column="battery_cur_2"    />
        <result property="batteryPower2"    column="battery_power_2"    />
        <result property="loadVolt2"    column="load_volt_2"    />
        <result property="loadCur2"    column="load_cur_2"    />
        <result property="loadPower2"    column="load_power_2"    />
        <result property="photVolt2"    column="phot_volt_2"    />
        <result property="photCur2"    column="phot_cur_2"    />
        <result property="photPower2"    column="phot_power_2"    />
        <result property="cumChargeDay2"    column="cum_charge_day_2"    />
        <result property="cumChargeMon2"    column="cum_charge_mon_2"    />
        <result property="cumChargeYear2"    column="cum_charge_year_2"    />
        <result property="cumChargeAll2"    column="cum_charge_all_2"    />
        <result property="cumEleDay2"    column="cum_ele_day_2"    />
        <result property="cumEleYear2"    column="cum_ele_year_2"    />
        <result property="cumEleAll2"    column="cum_ele_all_2"    />
        <result property="shoudong2"    column="shoudong_2"    />
        <result property="control2"    column="control_2"    />
        <result property="cumEleMon2"    column="cum_ele_mon_2"    />
        <result property="saveTime"    column="save_time"    />
        <result property="realTime"    column="real_time"    />
    </resultMap>

    <sql id="selectDeviceRealtimedataPhotovoltaicVo">
        select id, device_id, air_temp, mpp_temp, battery_cap, battery_volt, battery_cur, battery_power, load_volt, load_cur, load_power, phot_volt, phot_cur, phot_power, cum_charge_day, cum_charge_mon, cum_charge_year, cum_charge_all, cum_ele_day, cum_ele_mon, cum_ele_year, cum_ele_all, shoudong, control, air_temp_2, mpp_temp_2, battery_cap_2, battery_volt_2, battery_cur_2, battery_power_2, load_volt_2, load_cur_2, load_power_2, phot_volt_2, phot_cur_2, phot_power_2, cum_charge_day_2, cum_charge_mon_2, cum_charge_year_2, cum_charge_all_2, cum_ele_day_2, cum_ele_year_2, cum_ele_all_2, shoudong_2, control_2, cum_ele_mon_2, save_time, real_time from iot_device_realtimedata_photovoltaic
    </sql>

    <select id="selectDeviceRealtimedataPhotovoltaicList" parameterType="DeviceRealtimedataPhotovoltaic" resultMap="DeviceRealtimedataPhotovoltaicResult">
        <include refid="selectDeviceRealtimedataPhotovoltaicVo"/>
        <where>
            <if test="deviceId != null  and deviceId != ''"> and device_id = #{deviceId}</if>
            <if test="airTemp != null "> and air_temp = #{airTemp}</if>
            <if test="mppTemp != null "> and mpp_temp = #{mppTemp}</if>
            <if test="batteryCap != null "> and battery_cap = #{batteryCap}</if>
            <if test="batteryVolt != null "> and battery_volt = #{batteryVolt}</if>
            <if test="batteryCur != null "> and battery_cur = #{batteryCur}</if>
            <if test="batteryPower != null "> and battery_power = #{batteryPower}</if>
            <if test="loadVolt != null "> and load_volt = #{loadVolt}</if>
            <if test="loadCur != null "> and load_cur = #{loadCur}</if>
            <if test="loadPower != null "> and load_power = #{loadPower}</if>
            <if test="photVolt != null "> and phot_volt = #{photVolt}</if>
            <if test="photCur != null "> and phot_cur = #{photCur}</if>
            <if test="photPower != null "> and phot_power = #{photPower}</if>
            <if test="cumChargeDay != null "> and cum_charge_day = #{cumChargeDay}</if>
            <if test="cumChargeMon != null "> and cum_charge_mon = #{cumChargeMon}</if>
            <if test="cumChargeYear != null "> and cum_charge_year = #{cumChargeYear}</if>
            <if test="cumChargeAll != null "> and cum_charge_all = #{cumChargeAll}</if>
            <if test="cumEleDay != null "> and cum_ele_day = #{cumEleDay}</if>
            <if test="cumEleMon != null "> and cum_ele_mon = #{cumEleMon}</if>
            <if test="cumEleYear != null "> and cum_ele_year = #{cumEleYear}</if>
            <if test="cumEleAll != null "> and cum_ele_all = #{cumEleAll}</if>
            <if test="shoudong != null "> and shoudong = #{shoudong}</if>
            <if test="control != null "> and control = #{control}</if>
            <if test="airTemp2 != null "> and air_temp_2 = #{airTemp2}</if>
            <if test="mppTemp2 != null "> and mpp_temp_2 = #{mppTemp2}</if>
            <if test="batteryCap2 != null "> and battery_cap_2 = #{batteryCap2}</if>
            <if test="batteryVolt2 != null "> and battery_volt_2 = #{batteryVolt2}</if>
            <if test="batteryCur2 != null "> and battery_cur_2 = #{batteryCur2}</if>
            <if test="batteryPower2 != null "> and battery_power_2 = #{batteryPower2}</if>
            <if test="loadVolt2 != null "> and load_volt_2 = #{loadVolt2}</if>
            <if test="loadCur2 != null "> and load_cur_2 = #{loadCur2}</if>
            <if test="loadPower2 != null "> and load_power_2 = #{loadPower2}</if>
            <if test="photVolt2 != null "> and phot_volt_2 = #{photVolt2}</if>
            <if test="photCur2 != null "> and phot_cur_2 = #{photCur2}</if>
            <if test="photPower2 != null "> and phot_power_2 = #{photPower2}</if>
            <if test="cumChargeDay2 != null "> and cum_charge_day_2 = #{cumChargeDay2}</if>
            <if test="cumChargeMon2 != null "> and cum_charge_mon_2 = #{cumChargeMon2}</if>
            <if test="cumChargeYear2 != null "> and cum_charge_year_2 = #{cumChargeYear2}</if>
            <if test="cumChargeAll2 != null "> and cum_charge_all_2 = #{cumChargeAll2}</if>
            <if test="cumEleDay2 != null "> and cum_ele_day_2 = #{cumEleDay2}</if>
            <if test="cumEleYear2 != null "> and cum_ele_year_2 = #{cumEleYear2}</if>
            <if test="cumEleAll2 != null "> and cum_ele_all_2 = #{cumEleAll2}</if>
            <if test="shoudong2 != null "> and shoudong_2 = #{shoudong2}</if>
            <if test="control2 != null "> and control_2 = #{control2}</if>
            <if test="cumEleMon2 != null "> and cum_ele_mon_2 = #{cumEleMon2}</if>
            <if test="saveTime != null "> and save_time = #{saveTime}</if>
            <if test="realTime != null "> and real_time = #{realTime}</if>
        </where>
    </select>

    <select id="selectDeviceRealtimedataPhotovoltaicById" parameterType="Long" resultMap="DeviceRealtimedataPhotovoltaicResult">
        <include refid="selectDeviceRealtimedataPhotovoltaicVo"/>
        where id = #{id}
    </select>

    <insert id="insertDeviceRealtimedataPhotovoltaic" parameterType="DeviceRealtimedataPhotovoltaic" useGeneratedKeys="true" keyProperty="id">
        insert into iot_device_realtimedata_photovoltaic
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="deviceId != null">device_id,</if>
            <if test="airTemp != null">air_temp,</if>
            <if test="mppTemp != null">mpp_temp,</if>
            <if test="batteryCap != null">battery_cap,</if>
            <if test="batteryVolt != null">battery_volt,</if>
            <if test="batteryCur != null">battery_cur,</if>
            <if test="batteryPower != null">battery_power,</if>
            <if test="loadVolt != null">load_volt,</if>
            <if test="loadCur != null">load_cur,</if>
            <if test="loadPower != null">load_power,</if>
            <if test="photVolt != null">phot_volt,</if>
            <if test="photCur != null">phot_cur,</if>
            <if test="photPower != null">phot_power,</if>
            <if test="cumChargeDay != null">cum_charge_day,</if>
            <if test="cumChargeMon != null">cum_charge_mon,</if>
            <if test="cumChargeYear != null">cum_charge_year,</if>
            <if test="cumChargeAll != null">cum_charge_all,</if>
            <if test="cumEleDay != null">cum_ele_day,</if>
            <if test="cumEleMon != null">cum_ele_mon,</if>
            <if test="cumEleYear != null">cum_ele_year,</if>
            <if test="cumEleAll != null">cum_ele_all,</if>
            <if test="shoudong != null">shoudong,</if>
            <if test="control != null">control,</if>
            <if test="airTemp2 != null">air_temp_2,</if>
            <if test="mppTemp2 != null">mpp_temp_2,</if>
            <if test="batteryCap2 != null">battery_cap_2,</if>
            <if test="batteryVolt2 != null">battery_volt_2,</if>
            <if test="batteryCur2 != null">battery_cur_2,</if>
            <if test="batteryPower2 != null">battery_power_2,</if>
            <if test="loadVolt2 != null">load_volt_2,</if>
            <if test="loadCur2 != null">load_cur_2,</if>
            <if test="loadPower2 != null">load_power_2,</if>
            <if test="photVolt2 != null">phot_volt_2,</if>
            <if test="photCur2 != null">phot_cur_2,</if>
            <if test="photPower2 != null">phot_power_2,</if>
            <if test="cumChargeDay2 != null">cum_charge_day_2,</if>
            <if test="cumChargeMon2 != null">cum_charge_mon_2,</if>
            <if test="cumChargeYear2 != null">cum_charge_year_2,</if>
            <if test="cumChargeAll2 != null">cum_charge_all_2,</if>
            <if test="cumEleDay2 != null">cum_ele_day_2,</if>
            <if test="cumEleYear2 != null">cum_ele_year_2,</if>
            <if test="cumEleAll2 != null">cum_ele_all_2,</if>
            <if test="shoudong2 != null">shoudong_2,</if>
            <if test="control2 != null">control_2,</if>
            <if test="cumEleMon2 != null">cum_ele_mon_2,</if>
            <if test="saveTime != null">save_time,</if>
            <if test="realTime != null">real_time,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="deviceId != null">#{deviceId},</if>
            <if test="airTemp != null">#{airTemp},</if>
            <if test="mppTemp != null">#{mppTemp},</if>
            <if test="batteryCap != null">#{batteryCap},</if>
            <if test="batteryVolt != null">#{batteryVolt},</if>
            <if test="batteryCur != null">#{batteryCur},</if>
            <if test="batteryPower != null">#{batteryPower},</if>
            <if test="loadVolt != null">#{loadVolt},</if>
            <if test="loadCur != null">#{loadCur},</if>
            <if test="loadPower != null">#{loadPower},</if>
            <if test="photVolt != null">#{photVolt},</if>
            <if test="photCur != null">#{photCur},</if>
            <if test="photPower != null">#{photPower},</if>
            <if test="cumChargeDay != null">#{cumChargeDay},</if>
            <if test="cumChargeMon != null">#{cumChargeMon},</if>
            <if test="cumChargeYear != null">#{cumChargeYear},</if>
            <if test="cumChargeAll != null">#{cumChargeAll},</if>
            <if test="cumEleDay != null">#{cumEleDay},</if>
            <if test="cumEleMon != null">#{cumEleMon},</if>
            <if test="cumEleYear != null">#{cumEleYear},</if>
            <if test="cumEleAll != null">#{cumEleAll},</if>
            <if test="shoudong != null">#{shoudong},</if>
            <if test="control != null">#{control},</if>
            <if test="airTemp2 != null">#{airTemp2},</if>
            <if test="mppTemp2 != null">#{mppTemp2},</if>
            <if test="batteryCap2 != null">#{batteryCap2},</if>
            <if test="batteryVolt2 != null">#{batteryVolt2},</if>
            <if test="batteryCur2 != null">#{batteryCur2},</if>
            <if test="batteryPower2 != null">#{batteryPower2},</if>
            <if test="loadVolt2 != null">#{loadVolt2},</if>
            <if test="loadCur2 != null">#{loadCur2},</if>
            <if test="loadPower2 != null">#{loadPower2},</if>
            <if test="photVolt2 != null">#{photVolt2},</if>
            <if test="photCur2 != null">#{photCur2},</if>
            <if test="photPower2 != null">#{photPower2},</if>
            <if test="cumChargeDay2 != null">#{cumChargeDay2},</if>
            <if test="cumChargeMon2 != null">#{cumChargeMon2},</if>
            <if test="cumChargeYear2 != null">#{cumChargeYear2},</if>
            <if test="cumChargeAll2 != null">#{cumChargeAll2},</if>
            <if test="cumEleDay2 != null">#{cumEleDay2},</if>
            <if test="cumEleYear2 != null">#{cumEleYear2},</if>
            <if test="cumEleAll2 != null">#{cumEleAll2},</if>
            <if test="shoudong2 != null">#{shoudong2},</if>
            <if test="control2 != null">#{control2},</if>
            <if test="cumEleMon2 != null">#{cumEleMon2},</if>
            <if test="saveTime != null">#{saveTime},</if>
            <if test="realTime != null">#{realTime},</if>
        </trim>
    </insert>

    <update id="updateDeviceRealtimedataPhotovoltaic" parameterType="DeviceRealtimedataPhotovoltaic">
        update iot_device_realtimedata_photovoltaic
        <trim prefix="SET" suffixOverrides=",">
            <if test="deviceId != null">device_id = #{deviceId},</if>
            <if test="airTemp != null">air_temp = #{airTemp},</if>
            <if test="mppTemp != null">mpp_temp = #{mppTemp},</if>
            <if test="batteryCap != null">battery_cap = #{batteryCap},</if>
            <if test="batteryVolt != null">battery_volt = #{batteryVolt},</if>
            <if test="batteryCur != null">battery_cur = #{batteryCur},</if>
            <if test="batteryPower != null">battery_power = #{batteryPower},</if>
            <if test="loadVolt != null">load_volt = #{loadVolt},</if>
            <if test="loadCur != null">load_cur = #{loadCur},</if>
            <if test="loadPower != null">load_power = #{loadPower},</if>
            <if test="photVolt != null">phot_volt = #{photVolt},</if>
            <if test="photCur != null">phot_cur = #{photCur},</if>
            <if test="photPower != null">phot_power = #{photPower},</if>
            <if test="cumChargeDay != null">cum_charge_day = #{cumChargeDay},</if>
            <if test="cumChargeMon != null">cum_charge_mon = #{cumChargeMon},</if>
            <if test="cumChargeYear != null">cum_charge_year = #{cumChargeYear},</if>
            <if test="cumChargeAll != null">cum_charge_all = #{cumChargeAll},</if>
            <if test="cumEleDay != null">cum_ele_day = #{cumEleDay},</if>
            <if test="cumEleMon != null">cum_ele_mon = #{cumEleMon},</if>
            <if test="cumEleYear != null">cum_ele_year = #{cumEleYear},</if>
            <if test="cumEleAll != null">cum_ele_all = #{cumEleAll},</if>
            <if test="shoudong != null">shoudong = #{shoudong},</if>
            <if test="control != null">control = #{control},</if>
            <if test="airTemp2 != null">air_temp_2 = #{airTemp2},</if>
            <if test="mppTemp2 != null">mpp_temp_2 = #{mppTemp2},</if>
            <if test="batteryCap2 != null">battery_cap_2 = #{batteryCap2},</if>
            <if test="batteryVolt2 != null">battery_volt_2 = #{batteryVolt2},</if>
            <if test="batteryCur2 != null">battery_cur_2 = #{batteryCur2},</if>
            <if test="batteryPower2 != null">battery_power_2 = #{batteryPower2},</if>
            <if test="loadVolt2 != null">load_volt_2 = #{loadVolt2},</if>
            <if test="loadCur2 != null">load_cur_2 = #{loadCur2},</if>
            <if test="loadPower2 != null">load_power_2 = #{loadPower2},</if>
            <if test="photVolt2 != null">phot_volt_2 = #{photVolt2},</if>
            <if test="photCur2 != null">phot_cur_2 = #{photCur2},</if>
            <if test="photPower2 != null">phot_power_2 = #{photPower2},</if>
            <if test="cumChargeDay2 != null">cum_charge_day_2 = #{cumChargeDay2},</if>
            <if test="cumChargeMon2 != null">cum_charge_mon_2 = #{cumChargeMon2},</if>
            <if test="cumChargeYear2 != null">cum_charge_year_2 = #{cumChargeYear2},</if>
            <if test="cumChargeAll2 != null">cum_charge_all_2 = #{cumChargeAll2},</if>
            <if test="cumEleDay2 != null">cum_ele_day_2 = #{cumEleDay2},</if>
            <if test="cumEleYear2 != null">cum_ele_year_2 = #{cumEleYear2},</if>
            <if test="cumEleAll2 != null">cum_ele_all_2 = #{cumEleAll2},</if>
            <if test="shoudong2 != null">shoudong_2 = #{shoudong2},</if>
            <if test="control2 != null">control_2 = #{control2},</if>
            <if test="cumEleMon2 != null">cum_ele_mon_2 = #{cumEleMon2},</if>
            <if test="saveTime != null">save_time = #{saveTime},</if>
            <if test="realTime != null">real_time = #{realTime},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteDeviceRealtimedataPhotovoltaicById" parameterType="Long">
        delete from iot_device_realtimedata_photovoltaic where id = #{id}
    </delete>

    <delete id="deleteDeviceRealtimedataPhotovoltaicByIds" parameterType="String">
        delete from iot_device_realtimedata_photovoltaic where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>