123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253 |
- <?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.jjt.calc.mapper.TwinCalcDayMapper">
- <resultMap type="TwinCalcDay" id="TwinCalcDayResult">
- <result property="id" column="ID"/>
- <result property="time" column="TIME"/>
- <result property="deviceId" column="DEVICE_ID"/>
- <result property="length" column="LENGTH"/>
- <result property="weight" column="WEIGHT"/>
- <result property="efficiency" column="EFFICIENCY"/>
- <result property="kwh" column="KWH"/>
- <result property="alarm" column="ALARM"/>
- <result property="lengthA" column="LENGTH_A"/>
- <result property="weightA" column="WEIGHT_A"/>
- <result property="efficiencyA" column="EFFICIENCY_A"/>
- <result property="openTimeA" column="OPEN_TIME_A"/>
- <result property="closeTimeA" column="CLOSE_TIME_A"/>
- <result property="kwhA" column="KWH_A"/>
- <result property="stop1A" column="STOP1_A"/>
- <result property="stop2A" column="STOP2_A"/>
- <result property="stop3A" column="STOP3_A"/>
- <result property="lengthB" column="LENGTH_B"/>
- <result property="weightB" column="WEIGHT_B"/>
- <result property="efficiencyB" column="EFFICIENCY_B"/>
- <result property="openTimeB" column="OPEN_TIME_B"/>
- <result property="closeTimeB" column="CLOSE_TIME_B"/>
- <result property="kwhB" column="KWH_B"/>
- <result property="stop1B" column="STOP1_B"/>
- <result property="stop2B" column="STOP2_B"/>
- <result property="stop3B" column="STOP3_B"/>
- <result property="createdBy" column="CREATED_BY"/>
- <result property="createdTime" column="CREATED_TIME"/>
- <result property="updatedBy" column="UPDATED_BY"/>
- <result property="updatedTime" column="UPDATED_TIME"/>
- <result property="remark" column="REMARK"/>
- </resultMap>
- <sql id="selectTwinCalcDayVo">
- select *
- from (select A.ID,
- A.TIME,
- A.DEVICE_ID,
- A.LENGTH,
- A.WEIGHT,
- A.EFFICIENCY,
- A.KWH,
- A.ALARM,
- A.LENGTH_A,
- A.WEIGHT_A,
- A.EFFICIENCY_A,
- A.OPEN_TIME_A,
- A.CLOSE_TIME_A,
- A.KWH_A,
- A.STOP1_A,
- A.STOP2_A,
- A.STOP3_A,
- A.LENGTH_B,
- A.WEIGHT_B,
- A.EFFICIENCY_B,
- A.OPEN_TIME_B,
- A.CLOSE_TIME_B,
- A.KWH_B,
- A.STOP1_B,
- A.STOP2_B,
- A.STOP3_B,
- A.CREATED_BY,
- A.CREATED_TIME,
- A.UPDATED_BY,
- A.UPDATED_TIME,
- B.device_name REMARK
- from twin_calc_day a,
- twin_device b
- where a.device_id = b.device_id) a
- </sql>
- <select id="selectTwinCalcDayList" parameterType="TwinCalcDay" resultMap="TwinCalcDayResult">
- <include refid="selectTwinCalcDayVo"/>
- <where>
- <if test="time != null ">and TIME = #{time}</if>
- <if test="deviceId != null ">and DEVICE_ID = #{deviceId}</if>
- <if test="length != null ">and LENGTH = #{length}</if>
- <if test="weight != null ">and WEIGHT = #{weight}</if>
- <if test="efficiency != null ">and EFFICIENCY = #{efficiency}</if>
- <if test="kwh != null ">and KWH = #{kwh}</if>
- <if test="alarm != null ">and ALARM = #{alarm}</if>
- <if test="lengthA != null ">and LENGTH_A = #{lengthA}</if>
- <if test="weightA != null ">and WEIGHT_A = #{weightA}</if>
- <if test="efficiencyA != null ">and EFFICIENCY_A = #{efficiencyA}</if>
- <if test="openTimeA != null ">and OPEN_TIME_A = #{openTimeA}</if>
- <if test="closeTimeA != null ">and CLOSE_TIME_A = #{closeTimeA}</if>
- <if test="kwhA != null ">and KWH_A = #{kwhA}</if>
- <if test="stop1A != null ">and STOP1_A = #{stop1A}</if>
- <if test="stop2A != null ">and STOP2_A = #{stop2A}</if>
- <if test="stop3A != null ">and STOP3_A = #{stop3A}</if>
- <if test="lengthB != null ">and LENGTH_B = #{lengthB}</if>
- <if test="weightB != null ">and WEIGHT_B = #{weightB}</if>
- <if test="efficiencyB != null ">and EFFICIENCY_B = #{efficiencyB}</if>
- <if test="openTimeB != null ">and OPEN_TIME_B = #{openTimeB}</if>
- <if test="closeTimeB != null ">and CLOSE_TIME_B = #{closeTimeB}</if>
- <if test="kwhB != null ">and KWH_B = #{kwhB}</if>
- <if test="stop1B != null ">and STOP1_B = #{stop1B}</if>
- <if test="stop2B != null ">and STOP2_B = #{stop2B}</if>
- <if test="stop3B != null ">and STOP3_B = #{stop3B}</if>
- <if test="createdBy != null and createdBy != ''">and CREATED_BY = #{createdBy}</if>
- <if test="createdTime != null ">and CREATED_TIME = #{createdTime}</if>
- <if test="updatedBy != null and updatedBy != ''">and UPDATED_BY = #{updatedBy}</if>
- <if test="updatedTime != null ">and UPDATED_TIME = #{updatedTime}</if>
- <if test="remark != null and remark != ''">and REMARK = #{remark}</if>
- </where>
- </select>
- <select id="selectTwinCalcDayById" parameterType="Long" resultMap="TwinCalcDayResult">
- <include refid="selectTwinCalcDayVo"/>
- where ID = #{id}
- </select>
- <insert id="insertTwinCalcDay" parameterType="TwinCalcDay">
- insert into TWIN_CALC_DAY
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="time != null">TIME,</if>
- <if test="deviceId != null">DEVICE_ID,</if>
- <if test="length != null">LENGTH,</if>
- <if test="weight != null">WEIGHT,</if>
- <if test="efficiency != null">EFFICIENCY,</if>
- <if test="kwh != null">KWH,</if>
- <if test="alarm != null">ALARM,</if>
- <if test="lengthA != null">LENGTH_A,</if>
- <if test="weightA != null">WEIGHT_A,</if>
- <if test="efficiencyA != null">EFFICIENCY_A,</if>
- <if test="openTimeA != null">OPEN_TIME_A,</if>
- <if test="closeTimeA != null">CLOSE_TIME_A,</if>
- <if test="kwhA != null">KWH_A,</if>
- <if test="stop1A != null">STOP1_A,</if>
- <if test="stop2A != null">STOP2_A,</if>
- <if test="stop3A != null">STOP3_A,</if>
- <if test="lengthB != null">LENGTH_B,</if>
- <if test="weightB != null">WEIGHT_B,</if>
- <if test="efficiencyB != null">EFFICIENCY_B,</if>
- <if test="openTimeB != null">OPEN_TIME_B,</if>
- <if test="closeTimeB != null">CLOSE_TIME_B,</if>
- <if test="kwhB != null">KWH_B,</if>
- <if test="stop1B != null">STOP1_B,</if>
- <if test="stop2B != null">STOP2_B,</if>
- <if test="stop3B != null">STOP3_B,</if>
- <if test="createdBy != null">CREATED_BY,</if>
- <if test="createdTime != null">CREATED_TIME,</if>
- <if test="updatedBy != null">UPDATED_BY,</if>
- <if test="updatedTime != null">UPDATED_TIME,</if>
- <if test="remark != null">REMARK,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="time != null">#{time},</if>
- <if test="deviceId != null">#{deviceId},</if>
- <if test="length != null">#{length},</if>
- <if test="weight != null">#{weight},</if>
- <if test="efficiency != null">#{efficiency},</if>
- <if test="kwh != null">#{kwh},</if>
- <if test="alarm != null">#{alarm},</if>
- <if test="lengthA != null">#{lengthA},</if>
- <if test="weightA != null">#{weightA},</if>
- <if test="efficiencyA != null">#{efficiencyA},</if>
- <if test="openTimeA != null">#{openTimeA},</if>
- <if test="closeTimeA != null">#{closeTimeA},</if>
- <if test="kwhA != null">#{kwhA},</if>
- <if test="stop1A != null">#{stop1A},</if>
- <if test="stop2A != null">#{stop2A},</if>
- <if test="stop3A != null">#{stop3A},</if>
- <if test="lengthB != null">#{lengthB},</if>
- <if test="weightB != null">#{weightB},</if>
- <if test="efficiencyB != null">#{efficiencyB},</if>
- <if test="openTimeB != null">#{openTimeB},</if>
- <if test="closeTimeB != null">#{closeTimeB},</if>
- <if test="kwhB != null">#{kwhB},</if>
- <if test="stop1B != null">#{stop1B},</if>
- <if test="stop2B != null">#{stop2B},</if>
- <if test="stop3B != null">#{stop3B},</if>
- <if test="createdBy != null">#{createdBy},</if>
- <if test="createdTime != null">#{createdTime},</if>
- <if test="updatedBy != null">#{updatedBy},</if>
- <if test="updatedTime != null">#{updatedTime},</if>
- <if test="remark != null">#{remark},</if>
- </trim>
- </insert>
- <update id="updateTwinCalcDay" parameterType="TwinCalcDay">
- update TWIN_CALC_DAY
- <trim prefix="SET" suffixOverrides=",">
- <if test="time != null">TIME = #{time},</if>
- <if test="deviceId != null">DEVICE_ID = #{deviceId},</if>
- <if test="length != null">LENGTH = #{length},</if>
- <if test="weight != null">WEIGHT = #{weight},</if>
- <if test="efficiency != null">EFFICIENCY = #{efficiency},</if>
- <if test="kwh != null">KWH = #{kwh},</if>
- <if test="alarm != null">ALARM = #{alarm},</if>
- <if test="lengthA != null">LENGTH_A = #{lengthA},</if>
- <if test="weightA != null">WEIGHT_A = #{weightA},</if>
- <if test="efficiencyA != null">EFFICIENCY_A = #{efficiencyA},</if>
- <if test="openTimeA != null">OPEN_TIME_A = #{openTimeA},</if>
- <if test="closeTimeA != null">CLOSE_TIME_A = #{closeTimeA},</if>
- <if test="kwhA != null">KWH_A = #{kwhA},</if>
- <if test="stop1A != null">STOP1_A = #{stop1A},</if>
- <if test="stop2A != null">STOP2_A = #{stop2A},</if>
- <if test="stop3A != null">STOP3_A = #{stop3A},</if>
- <if test="lengthB != null">LENGTH_B = #{lengthB},</if>
- <if test="weightB != null">WEIGHT_B = #{weightB},</if>
- <if test="efficiencyB != null">EFFICIENCY_B = #{efficiencyB},</if>
- <if test="openTimeB != null">OPEN_TIME_B = #{openTimeB},</if>
- <if test="closeTimeB != null">CLOSE_TIME_B = #{closeTimeB},</if>
- <if test="kwhB != null">KWH_B = #{kwhB},</if>
- <if test="stop1B != null">STOP1_B = #{stop1B},</if>
- <if test="stop2B != null">STOP2_B = #{stop2B},</if>
- <if test="stop3B != null">STOP3_B = #{stop3B},</if>
- <if test="createdBy != null">CREATED_BY = #{createdBy},</if>
- <if test="createdTime != null">CREATED_TIME = #{createdTime},</if>
- <if test="updatedBy != null">UPDATED_BY = #{updatedBy},</if>
- <if test="updatedTime != null">UPDATED_TIME = #{updatedTime},</if>
- <if test="remark != null">REMARK = #{remark},</if>
- </trim>
- where ID = #{id}
- </update>
- <delete id="deleteTwinCalcDayById" parameterType="Long">
- delete
- from TWIN_CALC_DAY
- where ID = #{id}
- </delete>
- <delete id="deleteTwinCalcDayByIds" parameterType="String">
- delete from TWIN_CALC_DAY where ID in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- <delete id="delete4date" parameterType="Date">
- DELETE
- FROM TWIN_CALC_DAY
- WHERE TIME = #{date}
- </delete>
- <select id="selectTwinCalcDayListByMonth" resultMap="TwinCalcDayResult">
- <include refid="selectTwinCalcDayVo"/>
- where FORMAT(time, 'yyyy-MM') = #{month}
- order by time
- </select>
- <select id="selectTwinCalcDayListByTime" resultMap="TwinCalcDayResult">
- <include refid="selectTwinCalcDayVo"/>
- where time>=#{sd}
- <if test="ed != null ">and time<=#{ed}</if>
- order by time
- </select>
- </mapper>
|