From 71b6b716361c52af290493d365a328fc1a3467e2 Mon Sep 17 00:00:00 2001
From: nnnjjj123 <494715143@qq.com>
Date: Thu, 28 Jan 2021 11:15:06 +0800
Subject: [PATCH] 1.统计接口 2.健康码

---
 src/main/java/org/springblade/modules/equipment/mapper/EquipmentMapper.xml |  121 ++++++++++++++++++++++++++++++++++++++--
 1 files changed, 115 insertions(+), 6 deletions(-)

diff --git a/src/main/java/org/springblade/modules/equipment/mapper/EquipmentMapper.xml b/src/main/java/org/springblade/modules/equipment/mapper/EquipmentMapper.xml
index 49d3591..a52ce21 100644
--- a/src/main/java/org/springblade/modules/equipment/mapper/EquipmentMapper.xml
+++ b/src/main/java/org/springblade/modules/equipment/mapper/EquipmentMapper.xml
@@ -3,7 +3,7 @@
 <mapper namespace="org.springblade.modules.equipment.mapper.EquipmentMapper">
 
     <!-- 通用查询映射结果 -->
-    <resultMap id="equipmentResultMap" type="org.springblade.modules.equipment.entity.Equipment">
+    <resultMap id="equipmentResultMap" type="org.springblade.modules.equipment.vo.EquipmentVO">
         <id column="id" property="id"/>
         <result column="deviceName" property="deviceName"/>
         <result column="deviceNumber" property="deviceNumber"/>
@@ -18,6 +18,12 @@
         <result column="wd" property="wd"/>
         <result column="addvcd" property="addvcd"/>
         <result column="street" property="street"/>
+        <result column="serialNumber" property="serialNumber"/>
+        <result column="stype" property="stype"/>
+        <result column="channelNumber" property="channelNumber"/>
+        <result column="pay" property="pay"/>
+        <result column="expireTime" property="expireTime"/>
+        <result column="heartbeat" property="heartbeat"/>
     </resultMap>
 
     <resultMap id="treeNodeResultMap" type="org.springblade.core.tool.node.TreeNode">
@@ -52,7 +58,27 @@
 
 
     <select id="selectEquipmentPage" resultMap="equipmentResultMap">
-        select * from sys_equipment where is_deleted = 0
+        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,
+        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>
+
+        <if test="dtype!=null">
+            and dtype=#{dtype}
+        </if>
     </select>
 
     <!--新增-->
@@ -68,8 +94,10 @@
     <select id="lazyList" resultMap="deptVOResultMap">
         SELECT 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.parent_id,FORMAT(dept.jd,6) as jd,FORMAT(dept.wd,6) as wd,dept.street as streeName,u.yname,d.addvnm,dept.addvcd,
+        ST_ASTEXT(dept.coordinate) as
+        coordinate,dept.dtype,dept.serialNumber,dept.stype,dept.channelNumber,dept.pay,dept.expireTime,dept.heartbeat,
+        dept.parent_id,FORMAT(dept.jd,6) as jd,FORMAT(dept.wd,6) as wd,dept.street as
+        streeName,u.yname,d.addvnm,dept.addvcd,
         (
         SELECT
         CASE WHEN count(1) > 0 THEN 1 ELSE 0 END
@@ -106,6 +134,56 @@
     update sys_equipment SET deviceName=#{deviceName},deviceNumber=#{deviceNumber},deviceType=#{deviceType},
     ownership=#{ownership},ownerId=#{yname},devicestate=#{devicestate},stime=#{stime},
     coordinate=POINT(#{jd},#{wd}),parent_id=#{parentId},jd=#{jd},wd=#{wd},addvcd=#{addvnm},street=#{streeName},dtype=#{dtype} where id=#{id}
+    </update>
+
+    <update id="updateClinent" parameterType="org.springblade.modules.equipment.entity.Equipment">
+    update sys_equipment SET deviceName=#{deviceName},deviceNumber=#{deviceNumber},deviceType=#{deviceType},
+    ownership=#{ownership},devicestate=#{devicestate},
+    addvcd=#{addvcd},street=#{street},dtype=#{dtype},pay=#{pay}
+
+    <choose>
+        <when test="expireTime!=null and expireTime!=''">
+            ,expireTime=#{expireTime}
+        </when>
+        <otherwise>
+            ,expireTime= null
+        </otherwise>
+    </choose>
+
+    <choose>
+        <when test="heartbeat!=null and heartbeat!=''">
+            ,heartbeat=#{heartbeat}
+        </when>
+        <otherwise>
+            ,heartbeat= null
+        </otherwise>
+    </choose>
+
+    <choose>
+        <when test="stime!=null and stime!=''">
+            ,stime=#{stime}
+        </when>
+        <otherwise>
+            ,stime= null
+        </otherwise>
+    </choose>
+
+    where id=#{id}
+    </update>
+
+
+    <update id="updataType">
+        update sys_equipment SET devicestate = 1 where id in (${arr})
+    </update>
+
+    <update id="updataTypeC">
+        update sys_equipment SET devicestate = 0 where id in (${arr})
+    </update>
+
+    <update id="updateOnes" parameterType="org.springblade.modules.equipment.entity.Equipment">
+    update sys_equipment SET deviceName=#{deviceName},deviceNumber=#{deviceNumber},deviceType=#{deviceType},
+    ownership=#{ownership},ownerId=#{yname},devicestate=#{devicestate},stime=#{stime},
+    coordinate=POINT(#{jd},#{wd}),parent_id=#{parentId},jd=#{jd},wd=#{wd},addvcd=#{addvnm},street=#{streeName},dtype=#{dtype} where id=#{id}
 </update>
 
 
@@ -114,7 +192,7 @@
         SELECT
         dept.id,dept.deviceName,dept.deviceNumber,dept.deviceType,dept.ownership,
         dept.ownerId,dept.devicestate,dept.stime,
-        ST_ASTEXT(dept.coordinate) as coordinate,dept.dtype,
+        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,
         (
         SELECT
@@ -136,11 +214,42 @@
         e.parent_id,e.jd,e.wd,e.addvcd,
         s.yname,d.bType,di.addvnm FROM `sys_equipment` e
         LEFT JOIN sys_suser s
-        on s.ynumber=e.ownerId LEFT JOIN act_deploy d on d.deviceNumber=e.deviceNumber LEFT JOIN sys_district di on di.addvcds=e.addvcd LEFT JOIN sys_street t on t.id=e.street
+        on s.ynumber=e.ownerId LEFT JOIN act_deploy d on d.deviceNumber=e.deviceNumber LEFT JOIN sys_district di on
+        di.addvcds=e.addvcd LEFT JOIN sys_street t on t.id=e.street
         where 1=1
         <if test="deviceType!=null and deviceType!=''">
             and e.deviceType=#{deviceType}
         </if>
     </select>
 
+    <select id="selectInfos" resultType="java.util.HashMap">
+       SELECT
+   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.parent_id,
+   dept.jd,
+   dept.wd,
+   dept.street AS streeName,
+   u.yname,
+   d.addvnm,
+   dept.addvcd
+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>
+
+    <update id="updateChannel">
+    update sys_equipment SET heartbeat=#{heartbeat} where deviceNumber=#{deviceNumber}
+</update>
+
 </mapper>

--
Gitblit v1.9.3