From 7e6b4d0547e1b46df3cb3f0385e5d50ce3ca8a5d Mon Sep 17 00:00:00 2001
From: tangzy <tangzy123456>
Date: Wed, 17 Mar 2021 15:48:42 +0800
Subject: [PATCH] 1.警情保留数据

---
 blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/equipment/mapper/EquipmentMapper.xml |   63 +++++++++++++++++++++++++------
 1 files changed, 51 insertions(+), 12 deletions(-)

diff --git a/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/equipment/mapper/EquipmentMapper.xml b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/equipment/mapper/EquipmentMapper.xml
index ea812e9..6c62b41 100644
--- a/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/equipment/mapper/EquipmentMapper.xml
+++ b/blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/equipment/mapper/EquipmentMapper.xml
@@ -47,7 +47,6 @@
         <result column="ownerId" property="ownerId"/>
         <result column="devicestate" property="devicestate"/>
         <result column="stime" property="stime"/>
-        <result column="coordinate" property="coordinate"/>
         <result column="parent_id" property="parentId"/>
         <result column="jd" property="jd"/>
         <result column="wd" property="wd"/>
@@ -61,20 +60,39 @@
 
 
     <select id="selectEquipmentPage" resultMap="equipmentResultMap">
-        select id,deviceName,deviceNumber,deviceType,ownership,ownerId,devicestate,stime,ST_ASTEXT (coordinate ) AS
-        coordinate,dtype,heartbeat,expireTime,pay,
-        parent_id,
-        jd ,
-        wd ,
-        street,
-        addvcd,pay,expireTime from sys_equipment where 1=1
+        select equipment.id,equipment.deviceName,equipment.deviceNumber,equipment.deviceType,equipment.ownership
+        ,equipment.ownerId,equipment.devicestate,equipment.stime,equipment.dtype,equipment.heartbeat,equipment.expireTime,
+        equipment.parent_id,equipment.district,equipment.province,equipment.city,equipment.serialNumber,equipment.channelNumber,
+        equipment.jd ,
+        equipment.wd ,
+        equipment.street,catalog.pid,
+        equipment.addvcd,equipment.pay,equipment.expireTime from sys_equipment equipment
+        left join sys_catalog catalog on catalog.eqid = equipment.deviceNumber
+
+        where 1=1
+
         <if test="equipment.deviceName!=null">
             and (deviceName like concat('%',#{equipment.deviceName},'%') or deviceNumber like
             concat('%',#{equipment.deviceName},'%'))
         </if>
-        <if test="equipment.addvcd!=null">
-            and addvcd=#{equipment.addvcd}
+
+        <if test="equipment.beginTime!=null and equipment.beginTime!=''">
+            and expireTime&gt;=#{equipment.beginTime}
         </if>
+        <if test="equipment.endTime!=null and equipment.endTime!=''">
+            and expireTime&lt;=#{equipment.endTime}
+        </if>
+
+        <if test="equipment.district!=null">
+            and district like concat('%',#{equipment.district},'%')
+        </if>
+        <if test="equipment.province!=null">
+            and province like concat('%',#{equipment.province},'%')
+        </if>
+        <if test="equipment.city!=null">
+            and city like concat('%',#{equipment.city},'%')
+        </if>
+
         <if test="equipment.devicestate!=null">
             and devicestate =#{equipment.devicestate}
         </if>
@@ -82,6 +100,14 @@
         <if test="equipment.dtype!=null">
             and dtype=#{equipment.dtype}
         </if>
+
+        <if test="childList!=null and childList.size>0">
+            and deviceNumber in
+            <foreach collection="childList" index="index" item="item" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+
     </select>
 
     <!--新增-->
@@ -91,6 +117,15 @@
 
     <select id="tree" resultMap="treeNodeResultMap">
           select id, parent_id, deviceName as title, id as "value", id as "key" from sys_equipment
+    </select>
+
+    <select id="listAll" resultMap="equipmentResultMap">
+          select id,deviceName,deviceNumber,deviceType,ownership,ownerId,devicestate,stime,dtype,heartbeat,expireTime,pay,
+        parent_id,
+        jd ,
+        wd ,
+        street,
+        addvcd,pay,expireTime from sys_equipment
     </select>
 
 
@@ -157,9 +192,9 @@
             parameterType="org.springblade.jfpt.equipment.entity.Equipment">
         SELECT
         dept.id,dept.deviceName,dept.deviceNumber,dept.deviceType,dept.ownership,
-        dept.ownerId,dept.devicestate,dept.stime,
+        dept.ownerId,dept.devicestate,dept.stime,dept.district,dept.province,dept.city,
         ST_ASTEXT(dept.coordinate) as coordinate,dept.dtype,dept.expireTime,dept.heartbeat,
-        dept.parent_id,dept.jd,dept.wd,dept.street,u.yname,d.addvnm,dept.addvcd,
+        dept.parent_id,dept.jd,dept.wd,dept.street,u.yname,d.addvnm,dept.addvcd,dept.serialNumber,dept.channelNumber,
         (
         SELECT
         CASE WHEN count(1) > 0 THEN 1 ELSE 0 END
@@ -219,4 +254,8 @@
     update sys_equipment SET heartbeat=#{heartbeat} where deviceNumber=#{deviceNumber}
 </update>
 
+    <update id="updateexpireTime">
+        update sys_equipment SET expireTime=#{expireTime} where deviceNumber=#{deviceNumber}
+    </update>
+
 </mapper>

--
Gitblit v1.9.3