|
|
<?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.sunyo.energy.location.dao.ElectricityMeterMapper" >
|
|
|
<resultMap id="BaseResultMap" type="com.sunyo.energy.location.model.ElectricityMeter" >
|
|
|
<id column="device_id" property="deviceId" jdbcType="VARCHAR" />
|
|
|
<result column="total_energy" property="totalEnergy" jdbcType="DECIMAL" />
|
|
|
<result column="tip_energy" property="tipEnergy" jdbcType="DECIMAL" />
|
|
|
<result column="peak_energy" property="peakEnergy" jdbcType="DECIMAL" />
|
|
|
<result column="valley_energy" property="valleyEnergy" jdbcType="DECIMAL" />
|
|
|
<result column="flat_energy" property="flatEnergy" jdbcType="DECIMAL" />
|
|
|
<result column="balance" property="balance" jdbcType="DECIMAL" />
|
|
|
<result column="acTime" property="actime" jdbcType="TIMESTAMP" />
|
|
|
<result column="updateTime" property="updatetime" jdbcType="TIMESTAMP" />
|
|
|
<result column="reamke1" property="reamke1" jdbcType="VARCHAR" />
|
|
|
<result column="reamke2" property="reamke2" jdbcType="VARCHAR" />
|
|
|
</resultMap>
|
|
|
<sql id="Base_Column_List" >
|
|
|
device_id, total_energy, tip_energy, peak_energy, valley_energy, flat_energy, balance,
|
|
|
acTime, updateTime, reamke1, reamke2
|
|
|
</sql>
|
|
|
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
|
|
|
select
|
|
|
<include refid="Base_Column_List" />
|
|
|
from electricity_meter
|
|
|
where device_id = #{deviceId,jdbcType=VARCHAR}
|
|
|
</select>
|
|
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
|
|
|
delete from electricity_meter
|
|
|
where device_id = #{deviceId,jdbcType=VARCHAR}
|
|
|
</delete>
|
|
|
<insert id="insert" parameterType="com.sunyo.energy.location.model.ElectricityMeter" >
|
|
|
insert into electricity_meter (device_id, total_energy, tip_energy,
|
|
|
peak_energy, valley_energy, flat_energy,
|
|
|
balance, acTime, updateTime,
|
|
|
reamke1, reamke2)
|
|
|
values (#{deviceId,jdbcType=VARCHAR}, #{totalEnergy,jdbcType=DECIMAL}, #{tipEnergy,jdbcType=DECIMAL},
|
|
|
#{peakEnergy,jdbcType=DECIMAL}, #{valleyEnergy,jdbcType=DECIMAL}, #{flatEnergy,jdbcType=DECIMAL},
|
|
|
#{balance,jdbcType=DECIMAL}, #{actime,jdbcType=TIMESTAMP}, #{updatetime,jdbcType=TIMESTAMP},
|
|
|
#{reamke1,jdbcType=VARCHAR}, #{reamke2,jdbcType=VARCHAR})
|
|
|
</insert>
|
|
|
<insert id="insertSelective" parameterType="com.sunyo.energy.location.model.ElectricityMeter" >
|
|
|
insert into electricity_meter
|
|
|
<trim prefix="(" suffix=")" suffixOverrides="," >
|
|
|
<if test="deviceId != null" >
|
|
|
device_id,
|
|
|
</if>
|
|
|
<if test="totalEnergy != null" >
|
|
|
total_energy,
|
|
|
</if>
|
|
|
<if test="tipEnergy != null" >
|
|
|
tip_energy,
|
|
|
</if>
|
|
|
<if test="peakEnergy != null" >
|
|
|
peak_energy,
|
|
|
</if>
|
|
|
<if test="valleyEnergy != null" >
|
|
|
valley_energy,
|
|
|
</if>
|
|
|
<if test="flatEnergy != null" >
|
|
|
flat_energy,
|
|
|
</if>
|
|
|
<if test="balance != null" >
|
|
|
balance,
|
|
|
</if>
|
|
|
<if test="actime != null" >
|
|
|
acTime,
|
|
|
</if>
|
|
|
<if test="updatetime != null" >
|
|
|
updateTime,
|
|
|
</if>
|
|
|
<if test="reamke1 != null" >
|
|
|
reamke1,
|
|
|
</if>
|
|
|
<if test="reamke2 != null" >
|
|
|
reamke2,
|
|
|
</if>
|
|
|
</trim>
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides="," >
|
|
|
<if test="deviceId != null" >
|
|
|
#{deviceId,jdbcType=VARCHAR},
|
|
|
</if>
|
|
|
<if test="totalEnergy != null" >
|
|
|
#{totalEnergy,jdbcType=DECIMAL},
|
|
|
</if>
|
|
|
<if test="tipEnergy != null" >
|
|
|
#{tipEnergy,jdbcType=DECIMAL},
|
|
|
</if>
|
|
|
<if test="peakEnergy != null" >
|
|
|
#{peakEnergy,jdbcType=DECIMAL},
|
|
|
</if>
|
|
|
<if test="valleyEnergy != null" >
|
|
|
#{valleyEnergy,jdbcType=DECIMAL},
|
|
|
</if>
|
|
|
<if test="flatEnergy != null" >
|
|
|
#{flatEnergy,jdbcType=DECIMAL},
|
|
|
</if>
|
|
|
<if test="balance != null" >
|
|
|
#{balance,jdbcType=DECIMAL},
|
|
|
</if>
|
|
|
<if test="actime != null" >
|
|
|
#{actime,jdbcType=TIMESTAMP},
|
|
|
</if>
|
|
|
<if test="updatetime != null" >
|
|
|
#{updatetime,jdbcType=TIMESTAMP},
|
|
|
</if>
|
|
|
<if test="reamke1 != null" >
|
|
|
#{reamke1,jdbcType=VARCHAR},
|
|
|
</if>
|
|
|
<if test="reamke2 != null" >
|
|
|
#{reamke2,jdbcType=VARCHAR},
|
|
|
</if>
|
|
|
</trim>
|
|
|
</insert>
|
|
|
<update id="updateByPrimaryKeySelective" parameterType="com.sunyo.energy.location.model.ElectricityMeter" >
|
|
|
update electricity_meter
|
|
|
<set >
|
|
|
<if test="totalEnergy != null" >
|
|
|
total_energy = #{totalEnergy,jdbcType=DECIMAL},
|
|
|
</if>
|
|
|
<if test="tipEnergy != null" >
|
|
|
tip_energy = #{tipEnergy,jdbcType=DECIMAL},
|
|
|
</if>
|
|
|
<if test="peakEnergy != null" >
|
|
|
peak_energy = #{peakEnergy,jdbcType=DECIMAL},
|
|
|
</if>
|
|
|
<if test="valleyEnergy != null" >
|
|
|
valley_energy = #{valleyEnergy,jdbcType=DECIMAL},
|
|
|
</if>
|
|
|
<if test="flatEnergy != null" >
|
|
|
flat_energy = #{flatEnergy,jdbcType=DECIMAL},
|
|
|
</if>
|
|
|
<if test="balance != null" >
|
|
|
balance = #{balance,jdbcType=DECIMAL},
|
|
|
</if>
|
|
|
<if test="actime != null" >
|
|
|
acTime = #{actime,jdbcType=TIMESTAMP},
|
|
|
</if>
|
|
|
<if test="updatetime != null" >
|
|
|
updateTime = #{updatetime,jdbcType=TIMESTAMP},
|
|
|
</if>
|
|
|
<if test="reamke1 != null" >
|
|
|
reamke1 = #{reamke1,jdbcType=VARCHAR},
|
|
|
</if>
|
|
|
<if test="reamke2 != null" >
|
|
|
reamke2 = #{reamke2,jdbcType=VARCHAR},
|
|
|
</if>
|
|
|
</set>
|
|
|
where device_id = #{deviceId,jdbcType=VARCHAR}
|
|
|
</update>
|
|
|
<update id="updateByPrimaryKey" parameterType="com.sunyo.energy.location.model.ElectricityMeter" >
|
|
|
update electricity_meter
|
|
|
set total_energy = #{totalEnergy,jdbcType=DECIMAL},
|
|
|
tip_energy = #{tipEnergy,jdbcType=DECIMAL},
|
|
|
peak_energy = #{peakEnergy,jdbcType=DECIMAL},
|
|
|
valley_energy = #{valleyEnergy,jdbcType=DECIMAL},
|
|
|
flat_energy = #{flatEnergy,jdbcType=DECIMAL},
|
|
|
balance = #{balance,jdbcType=DECIMAL},
|
|
|
acTime = #{actime,jdbcType=TIMESTAMP},
|
|
|
updateTime = #{updatetime,jdbcType=TIMESTAMP},
|
|
|
reamke1 = #{reamke1,jdbcType=VARCHAR},
|
|
|
reamke2 = #{reamke2,jdbcType=VARCHAR}
|
|
|
where device_id = #{deviceId,jdbcType=VARCHAR}
|
|
|
</update>
|
|
|
</mapper> |
|
|
\ No newline at end of file |