From 9aac460a313ac8284e0fd633183c93815f95e0de Mon Sep 17 00:00:00 2001
From: zhangnaisong <2434969829@qq.com>
Date: 星期三, 24 七月 2024 17:21:57 +0800
Subject: [PATCH] 实时状态预提交修改提交

---
 ard-work/src/main/resources/mapper/sy/ArdTankLockMapper.xml |   87 ++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 85 insertions(+), 2 deletions(-)

diff --git a/ard-work/src/main/resources/mapper/sy/ArdTankLockMapper.xml b/ard-work/src/main/resources/mapper/sy/ArdTankLockMapper.xml
index c8e672e..bbd54d8 100644
--- a/ard-work/src/main/resources/mapper/sy/ArdTankLockMapper.xml
+++ b/ard-work/src/main/resources/mapper/sy/ArdTankLockMapper.xml
@@ -16,6 +16,32 @@
         <result property="onlineTime"    column="online_time"    />
     </resultMap>
 
+    <resultMap type="ArdTankLock" id="ArdTankLockWithStateResult">
+        <result property="id"    column="id"    />
+        <result property="lockNum"    column="lock_num"    />
+        <result property="lockName"    column="lock_name"    />
+        <result property="imgPositionTop"    column="img_position_top"    />
+        <result property="imgPositionLeft"    column="img_position_left"    />
+        <result property="carId"    column="car_id"    />
+        <result property="enable"    column="enable"    />
+        <result property="restartState"    column="restart_state"    />
+        <result property="onlineTime"    column="online_time"    />
+        <association property="ardTankLockState" javaType="com.ruoyi.sy.domain.ArdTankLockState">
+            <result property="id"    column="sid"    />
+            <result property="lockId"    column="lock_id"    />
+            <result property="lockNum"    column="slock_num"    />
+            <result property="lockState"    column="lock_state"    />
+            <result property="lockPositionState"    column="lock_position_state"    />
+            <result property="lockShellState"    column="lock_shell_state"    />
+            <result property="restartState"    column="srestart_state"    />
+            <result property="batterVoltage"    column="batter_voltage"    />
+            <result property="powerVoltage"    column="power_voltage"    />
+            <result property="uploadTime"    column="upload_time"    />
+            <result property="uniqueMark"    column="unique_mark"    />
+            <result property="lockStateMark"    column="lock_state_mark"    />
+        </association>
+    </resultMap>
+
     <sql id="selectArdTankLockVo">
         select id, lock_num, lock_name, img_position_top, img_position_left, car_id, enable, restart_state, online_time from ard_tank_lock
     </sql>
@@ -108,8 +134,23 @@
         </foreach >
     </insert>
 
-    <select id="getLockByCarId" resultMap="ArdTankLockResult" parameterType="java.lang.String">
-        select * from ard_tank_lock atl where car_id = #{carId} order by atl.lock_num
+    <select id="getLockByCarId" resultMap="ArdTankLockWithStateResult" parameterType="java.lang.String">
+        select atl.id,atl.lock_num,atl.lock_name,atl.img_position_top,
+        atl.img_position_left,atl.car_id,atl.enable,atl.restart_state,
+        atl.online_time,atls.id as sid,atls.lock_id,atls.lock_num as slock_num,
+        atls.lock_state,atls.lock_position_state,atls.lock_shell_state,
+        atls.restart_state as srestart_state,atls.batter_voltage,
+        atls.power_voltage,atls.upload_time,atls.unique_mark,
+        case atls.lock_state
+        when '鍏抽攣鐘舵��' then false
+        when '寮傚父鐘舵��' then false
+        when '鍔ㄤ綔鐘舵��' then false
+        when '寮�閿佺姸鎬�' then true
+        end as lock_state_mark
+        from ard_tank_lock atl
+        left join ard_tank_lock_state atls on atl."id" = atls.lock_id
+        where car_id = #{carId} order by atls.upload_time desc,atl.lock_num
+        limit 1
     </select>
 
     <delete id="deleteLockByCarId" parameterType="java.lang.String">
@@ -122,4 +163,46 @@
             #{id}
         </foreach>
     </delete>
+
+    <select id="selectArdTankLockTotal" resultType="java.lang.Long">
+        select count(distinct atl.car_id) from ard_tank_lock atl
+    </select>
+
+    <select id="getLockByCarIdList" resultType="com.ruoyi.sy.domain.ArdTankLock" >
+        select * from ard_tank_lock atl where car_id in
+        <foreach item="id" collection="carIdList" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+        order by atl.car_id,lock_num
+    </select>
+
+    <select id="selectArdTankLockAllTotal" resultType="java.lang.Long">
+        select count(*) from ard_tank_lock atl
+    </select>
+
+    <select id="selectArdTankLockTotalByCarIdList" resultType="java.lang.Long">
+        select count(*) from ard_tank_lock where car_id in
+        <foreach item="id" collection="carIdList" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </select>
+
+    <delete id="deleteArdTankLockAndWallByCarIds" >
+        delete from ard_tank_wall_lock atwl where atwl.lock_id in (
+        select atl.id from ard_tank_lock atl
+        where atl.car_id in
+        <foreach item="carId" collection="carIds" open="(" separator="," close=")">
+            #{carId}
+        </foreach>
+        );
+        delete from ard_tank_lock atl
+        where atl.car_id in
+        <foreach item="carId" collection="carIds" open="(" separator="," close=")">
+            #{carId}
+        </foreach>
+    </delete>
+
+    <select id="getIdByLockNum" resultType="java.lang.String" parameterType="java.lang.String">
+        select id from ard_tank_lock atl where atl.lock_num = #{lockNum}
+    </select>
 </mapper>
\ No newline at end of file

--
Gitblit v1.9.3