|
@@ -1,76 +1,126 @@
|
|
|
<?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">
|
|
|
+ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
+ "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
<mapper namespace="com.ruoyi.biz.mapper.TwinCalc2hrMapper">
|
|
|
-
|
|
|
+
|
|
|
<resultMap type="TwinCalc2hr" id="TwinCalc2hrResult">
|
|
|
- <result property="id" column="ID" />
|
|
|
- <result property="dataDate" column="DATA_DATE" />
|
|
|
- <result property="timePeriod" column="TIME_PERIOD" />
|
|
|
- <result property="deviceId" column="DEVICE_ID" />
|
|
|
- <result property="lengthA" column="LENGTH_A" />
|
|
|
- <result property="openTimeA" column="OPEN_TIME_A" />
|
|
|
- <result property="closeTimeA" column="CLOSE_TIME_A" />
|
|
|
- <result property="lengthB" column="LENGTH_B" />
|
|
|
- <result property="closeTimeB" column="CLOSE_TIME_B" />
|
|
|
- <result property="openTimeB" column="OPEN_TIME_B" />
|
|
|
- <result property="weight" column="WEIGHT" />
|
|
|
- <result property="weightA" column="WEIGHT_A" />
|
|
|
- <result property="weightB" column="WEIGHT_B" />
|
|
|
- <result property="alarm" column="ALARM" />
|
|
|
- <result property="stop1A" column="STOP1_A" />
|
|
|
- <result property="stop2A" column="STOP2_A" />
|
|
|
- <result property="stop3A" column="STOP3_A" />
|
|
|
- <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" />
|
|
|
+ <result property="id" column="ID"/>
|
|
|
+ <result property="dataDate" column="DATA_DATE"/>
|
|
|
+ <result property="timePeriod" column="TIME_PERIOD"/>
|
|
|
+ <result property="deviceId" column="DEVICE_ID"/>
|
|
|
+ <result property="lengthA" column="LENGTH_A"/>
|
|
|
+ <result property="openTimeA" column="OPEN_TIME_A"/>
|
|
|
+ <result property="closeTimeA" column="CLOSE_TIME_A"/>
|
|
|
+ <result property="lengthB" column="LENGTH_B"/>
|
|
|
+ <result property="closeTimeB" column="CLOSE_TIME_B"/>
|
|
|
+ <result property="openTimeB" column="OPEN_TIME_B"/>
|
|
|
+ <result property="weight" column="WEIGHT"/>
|
|
|
+ <result property="weightA" column="WEIGHT_A"/>
|
|
|
+ <result property="weightB" column="WEIGHT_B"/>
|
|
|
+ <result property="alarm" column="ALARM"/>
|
|
|
+ <result property="stop1A" column="STOP1_A"/>
|
|
|
+ <result property="stop2A" column="STOP2_A"/>
|
|
|
+ <result property="stop3A" column="STOP3_A"/>
|
|
|
+ <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="selectTwinCalc2hrVo">
|
|
|
- select ID, DATA_DATE, TIME_PERIOD, DEVICE_ID, LENGTH_A, OPEN_TIME_A, CLOSE_TIME_A, LENGTH_B, CLOSE_TIME_B, OPEN_TIME_B, WEIGHT, WEIGHT_A, WEIGHT_B, ALARM, STOP1_A, STOP2_A, STOP3_A, STOP1_B, STOP2_B, STOP3_B, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME, REMARK from twin_calc_2hr
|
|
|
+ select ID,
|
|
|
+ DATA_DATE,
|
|
|
+ TIME_PERIOD,
|
|
|
+ DEVICE_ID,
|
|
|
+ LENGTH_A,
|
|
|
+ OPEN_TIME_A,
|
|
|
+ CLOSE_TIME_A,
|
|
|
+ LENGTH_B,
|
|
|
+ CLOSE_TIME_B,
|
|
|
+ OPEN_TIME_B,
|
|
|
+ WEIGHT,
|
|
|
+ WEIGHT_A,
|
|
|
+ WEIGHT_B,
|
|
|
+ ALARM,
|
|
|
+ STOP1_A,
|
|
|
+ STOP2_A,
|
|
|
+ STOP3_A,
|
|
|
+ STOP1_B,
|
|
|
+ STOP2_B,
|
|
|
+ STOP3_B,
|
|
|
+ CREATED_BY,
|
|
|
+ CREATED_TIME,
|
|
|
+ UPDATED_BY,
|
|
|
+ UPDATED_TIME,
|
|
|
+ REMARK
|
|
|
+ from twin_calc_2hr
|
|
|
</sql>
|
|
|
|
|
|
<select id="selectTwinCalc2hrList" parameterType="TwinCalc2hr" resultMap="TwinCalc2hrResult">
|
|
|
<include refid="selectTwinCalc2hrVo"/>
|
|
|
- <where>
|
|
|
- <if test="dataDate != null "> and DATA_DATE = #{dataDate}</if>
|
|
|
- <if test="timePeriod != null and timePeriod != ''"> and TIME_PERIOD = #{timePeriod}</if>
|
|
|
- <if test="deviceId != null "> and DEVICE_ID = #{deviceId}</if>
|
|
|
- <if test="lengthA != null "> and LENGTH_A = #{lengthA}</if>
|
|
|
- <if test="openTimeA != null "> and OPEN_TIME_A = #{openTimeA}</if>
|
|
|
- <if test="closeTimeA != null "> and CLOSE_TIME_A = #{closeTimeA}</if>
|
|
|
- <if test="lengthB != null "> and LENGTH_B = #{lengthB}</if>
|
|
|
- <if test="closeTimeB != null "> and CLOSE_TIME_B = #{closeTimeB}</if>
|
|
|
- <if test="openTimeB != null "> and OPEN_TIME_B = #{openTimeB}</if>
|
|
|
- <if test="weight != null "> and WEIGHT = #{weight}</if>
|
|
|
- <if test="weightA != null "> and WEIGHT_A = #{weightA}</if>
|
|
|
- <if test="weightB != null "> and WEIGHT_B = #{weightB}</if>
|
|
|
- <if test="alarm != null "> and ALARM = #{alarm}</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="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>
|
|
|
+ <if test="dataDate != null ">and DATA_DATE = #{dataDate}</if>
|
|
|
+ <if test="timePeriod != null and timePeriod != ''">and TIME_PERIOD = #{timePeriod}</if>
|
|
|
+ <if test="deviceId != null ">and DEVICE_ID = #{deviceId}</if>
|
|
|
+ <if test="lengthA != null ">and LENGTH_A = #{lengthA}</if>
|
|
|
+ <if test="openTimeA != null ">and OPEN_TIME_A = #{openTimeA}</if>
|
|
|
+ <if test="closeTimeA != null ">and CLOSE_TIME_A = #{closeTimeA}</if>
|
|
|
+ <if test="lengthB != null ">and LENGTH_B = #{lengthB}</if>
|
|
|
+ <if test="closeTimeB != null ">and CLOSE_TIME_B = #{closeTimeB}</if>
|
|
|
+ <if test="openTimeB != null ">and OPEN_TIME_B = #{openTimeB}</if>
|
|
|
+ <if test="weight != null ">and WEIGHT = #{weight}</if>
|
|
|
+ <if test="weightA != null ">and WEIGHT_A = #{weightA}</if>
|
|
|
+ <if test="weightB != null ">and WEIGHT_B = #{weightB}</if>
|
|
|
+ <if test="alarm != null ">and ALARM = #{alarm}</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="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="selectTwinCalc2hrById" parameterType="Long" resultMap="TwinCalc2hrResult">
|
|
|
<include refid="selectTwinCalc2hrVo"/>
|
|
|
where ID = #{id}
|
|
|
</select>
|
|
|
-
|
|
|
+ <select id="lastPeriod" resultType="java.lang.Long">
|
|
|
+ SELECT (TIME_PERIOD + 0)
|
|
|
+ FROM TWIN_CALC_2HR A
|
|
|
+ ORDER BY DATA_DATE DESC, (TIME_PERIOD + 0) DESC LIMIT 1
|
|
|
+ </select>
|
|
|
+ <select id="calcToday" resultMap="TwinCalc2hrResult">
|
|
|
+ SELECT DATA_DATE,
|
|
|
+ SUM(LENGTH_A) LENGTH_A,
|
|
|
+ SUM(OPEN_TIME_A) OPEN_TIME_A,
|
|
|
+ SUM(CLOSE_TIME_A) CLOSE_TIME_A,
|
|
|
+ SUM(LENGTH_B) LENGTH_B,
|
|
|
+ SUM(CLOSE_TIME_B) CLOSE_TIME_B,
|
|
|
+ SUM(OPEN_TIME_B) OPEN_TIME_B,
|
|
|
+ SUM(WEIGHT_A) WEIGHT_A,
|
|
|
+ SUM(WEIGHT_B) WEIGHT_B,
|
|
|
+ SUM(ALARM) ALARM,
|
|
|
+ SUM(STOP1_A) STOP1_A,
|
|
|
+ SUM(STOP2_A) STOP2_A,
|
|
|
+ SUM(STOP3_A) STOP3_A,
|
|
|
+ SUM(STOP1_B) STOP1_B,
|
|
|
+ SUM(STOP2_B) STOP2_B,
|
|
|
+ SUM(STOP3_B) STOP3_B
|
|
|
+ FROM TWIN_CALC_2HR
|
|
|
+ WHERE DATA_DATE = curdate() GROUP BY DATA_DATE
|
|
|
+ </select>
|
|
|
+
|
|
|
<insert id="insertTwinCalc2hr" parameterType="TwinCalc2hr" useGeneratedKeys="true" keyProperty="id">
|
|
|
insert into twin_calc_2hr
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
@@ -98,7 +148,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="updatedBy != null">UPDATED_BY,</if>
|
|
|
<if test="updatedTime != null">UPDATED_TIME,</if>
|
|
|
<if test="remark != null">REMARK,</if>
|
|
|
- </trim>
|
|
|
+ </trim>
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
<if test="dataDate != null">#{dataDate},</if>
|
|
|
<if test="timePeriod != null">#{timePeriod},</if>
|
|
@@ -124,7 +174,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="updatedBy != null">#{updatedBy},</if>
|
|
|
<if test="updatedTime != null">#{updatedTime},</if>
|
|
|
<if test="remark != null">#{remark},</if>
|
|
|
- </trim>
|
|
|
+ </trim>
|
|
|
</insert>
|
|
|
|
|
|
<update id="updateTwinCalc2hr" parameterType="TwinCalc2hr">
|
|
@@ -159,14 +209,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
</update>
|
|
|
|
|
|
<delete id="deleteTwinCalc2hrById" parameterType="Long">
|
|
|
- delete from twin_calc_2hr where ID = #{id}
|
|
|
+ delete
|
|
|
+ from twin_calc_2hr
|
|
|
+ where ID = #{id}
|
|
|
</delete>
|
|
|
|
|
|
<delete id="deleteTwinCalc2hrByIds" parameterType="String">
|
|
|
- delete from twin_calc_2hr where ID in
|
|
|
+ delete from twin_calc_2hr where ID in
|
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
#{id}
|
|
|
</foreach>
|
|
|
</delete>
|
|
|
|
|
|
-</mapper>
|
|
|
+</mapper>
|