From 7b3fb2ea4eb3c8539ce3019bfafacb7ca3b21096 Mon Sep 17 00:00:00 2001
From: nnnjjj123 <494715143@qq.com>
Date: Tue, 02 Mar 2021 10:06:13 +0800
Subject: [PATCH] 1.目录树调整

---
 blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/equipment/mapper/EquipmentMapper.xml |   76 +++++++++++++++++++++++++++----------
 1 files changed, 55 insertions(+), 21 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 511150c..456f00d 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
@@ -24,6 +24,9 @@
         <result column="pay" property="pay"/>
         <result column="expireTime" property="expireTime"/>
         <result column="heartbeat" property="heartbeat"/>
+        <result column="province" property="province"/>
+        <result column="city" property="city"/>
+        <result column="district" property="district"/>
     </resultMap>
 
     <resultMap id="treeNodeResultMap" type="org.springblade.core.tool.node.TreeNode">
@@ -44,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"/>
@@ -58,27 +60,49 @@
 
 
     <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,
-        FORMAT( jd, 6 ) AS jd,
-        FORMAT( wd, 6 ) AS wd,
+        select id,deviceName,deviceNumber,deviceType,ownership,ownerId,devicestate,stime,dtype,heartbeat,expireTime,pay,
+        parent_id,district,province,city,
+        jd ,
+        wd ,
         street,
         addvcd,pay,expireTime from sys_equipment where 1=1
-        <if test="deviceName!=null">
-            and (deviceName like concat('%',#{deviceName},'%') or deviceNumber like
-            concat('%',#{deviceName},'%'))
-        </if>
-        <if test="addvcd!=null">
-            and addvcd=#{addvcd}
-        </if>
-        <if test="devicestate!=null">
-            and devicestate =#{devicestate}
+        <if test="equipment.deviceName!=null">
+            and (deviceName like concat('%',#{equipment.deviceName},'%') or deviceNumber like
+            concat('%',#{equipment.deviceName},'%'))
         </if>
 
-        <if test="dtype!=null">
-            and dtype=#{dtype}
+        <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>
+
+        <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>
 
     <!--新增-->
@@ -88,6 +112,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>
 
 
@@ -156,7 +189,7 @@
         dept.id,dept.deviceName,dept.deviceNumber,dept.deviceType,dept.ownership,
         dept.ownerId,dept.devicestate,dept.stime,
         ST_ASTEXT(dept.coordinate) as coordinate,dept.dtype,dept.expireTime,dept.heartbeat,
-        dept.parent_id,dept.jd,dept.wd,dept.street as streeName,u.yname,d.addvnm,dept.addvcd,
+        dept.parent_id,dept.jd,dept.wd,dept.street,u.yname,d.addvnm,dept.addvcd,
         (
         SELECT
         CASE WHEN count(1) > 0 THEN 1 ELSE 0 END
@@ -202,12 +235,13 @@
    dept.wd,
    dept.street AS streeName,
    u.yname,
-   d.addvnm,
-   dept.addvcd
+   dept.addvcd,
+   dept.province,
+   dept.city,
+   dept.district
 FROM
    sys_equipment dept
    LEFT JOIN sys_suser u ON u.ynumber = dept.ownerId
-   LEFT JOIN sys_district d ON d.addvcds = dept.addvcd
    LEFT JOIN sys_street s ON s.id = dept.street  WHERE  dept.deviceNumber=#{deviceNumber}
     </select>
 

--
Gitblit v1.9.3