南昌市物联网技防平台-后台
zengh
2021-05-20 13efa665ef67f62d0e8e5d6aade5f79ebff5187d
blade-service/blade-jfpts/src/main/java/org/springblade/jfpt/equipment/mapper/EquipmentMapper.xml
@@ -31,6 +31,10 @@
        <result column="reason" property="reason"/>
        <result column="jtype" property="jtype"/>
        <result column="manufacturers" property="manufacturers"/>
        <result column="eqModel" property="eqModel"/>
        <result column="proId" property="proId"/>
        <result column="eqSecret" property="eqSecret"/>
        <result column="eqName" property="eqName"/>
    </resultMap>
    <resultMap id="treeNodeResultMap" type="org.springblade.core.tool.node.TreeNode">
@@ -160,19 +164,16 @@
        deviceNumber
        ) alarm ON alarm.deviceN = 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.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>
@@ -185,31 +186,34 @@
        <if test="equipment.manufacturers!=null and equipment.manufacturers!=''">
            and manufacturers = #{equipment.manufacturers}
        </if>
        <if test="equipment.devicestate!=null">
            and devicestate =#{equipment.devicestate}
        </if>
        <if test="equipment.dtype!=null">
            and dtype=#{equipment.dtype}
        </if>
        <if test="dxtype!=null and dxtype == 0">
            and heartbeat &lt; DATE_SUB(NOW(),INTERVAL 1 DAY)
            and heartbeat &lt; DATE_SUB(NOW(),INTERVAL 1 DAY)  and dtype=0
        </if>
        <if test="dxtype!=null and dxtype == 1">
            and heartbeat >= DATE_SUB(NOW(),INTERVAL 1 DAY)
            and heartbeat >= DATE_SUB(NOW(),INTERVAL 1 DAY) and dtype=1
        </if>
        <if test="dxtype!=null and dxtype == 2">
            and alarm.jtype IS NOT NULL
            and heartbeat >= DATE_SUB(NOW(),INTERVAL 1 DAY) and dtype=2
        </if>
        <if test="dxtype!=null and dxtype == 3">
            and heartbeat >= DATE_SUB(NOW(),INTERVAL 1 DAY) and state!=null
            and heartbeat >= DATE_SUB(NOW(),INTERVAL 1 DAY)  and dtype=3
        </if>
        <if test="pid!=null and pid!=''">
            and deptId like concat('%',#{pid},'%')
        </if>
        order by (
            case
                when dtype=2  then 1
                when dtype=3 then 2
                when dtype=0  then 3
                when dtype=1  then 4
            END)
    </select>
    <!--新增-->
@@ -409,6 +413,8 @@
   dept.deviceName,
   dept.deviceNumber,
   dept.deviceType,
   dept.serialNumber,
   dept.channelNumber,
   dept.ownership,
   dept.ownerId,
   dept.devicestate,
@@ -478,4 +484,30 @@
    <select id="selectEqCg" resultType="Integer">
        select COUNT(*) from sys_equipment where heartbeat >= DATE_SUB(NOW(),INTERVAL 1 DAY) and dtype=3
    </select>
    <!--查询所有的设备,不包含故障和警情状态-->
    <select id="selAllEq" resultType="org.springblade.jfpt.equipment.entity.Equipment">
       select id,dtype,heartbeat from sys_equipment where dtype!=2 and dtype!=3
    </select>
    <!--批量更新设备状态改为在线-->
    <update id="updateEqListz" parameterType="java.util.Map">
        UPDATE sys_equipment
            SET dtype = 1
        WHERE id IN
        <foreach collection="equipmentListz" index="index" item="id" open="(" separator="," close=")">
            #{id}
        </foreach>
    </update>
    <!--批量更新设备状态改为离线-->
    <update id="updateEqListl" parameterType="java.util.Map">
        UPDATE sys_equipment
            SET dtype = 0
        WHERE id IN
        <foreach collection="equipmentListl" index="index" item="id" open="(" separator="," close=")">
            #{id}
        </foreach>
    </update>
</mapper>