| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271 |
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE mapper
- PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
- "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.xunmei.system.mapper.SysDeviceMapper">
- <resultMap type="com.xunmei.system.api.domain.SysDevice" id="SysDeviceResult">
- <result property="id" column="id"/>
- <result property="orgId" column="org_id"/>
- <result property="orgName" column="org_name"/>
- <result property="deviceName" column="device_name"/>
- <result property="assetType" column="asset_type"/>
- <result property="deviceType" column="device_type"/>
- <result property="deviceBrand" column="device_brand"/>
- <result property="checkTime" column="check_time"/>
- <result property="maintenanceTerm" column="maintenance_term"/>
- <result property="createTime" column="create_time"/>
- <result property="updateTime" column="update_time"/>
- <result property="createBy" column="create_by"/>
- <result property="updateBy" column="update_by"/>
- <result property="delFlag" column="del_flag"/>
- <result property="hostId" column="host_id"/>
- <result property="channel" column="channel"/>
- </resultMap>
- <sql id="selectSysDeviceVo">
- select id,
- org_id,
- org_name,
- device_name,
- asset_type,
- device_type,
- device_brand,
- check_time,
- maintenance_term,
- create_time,
- update_time,
- create_by,
- update_by,
- del_flag,
- host_id,
- channel
- from sys_device
- </sql>
- <select id="selectSysDeviceList" parameterType="com.xunmei.system.api.domain.SysDevice"
- resultMap="SysDeviceResult">
- <include refid="selectSysDeviceVo"/>
- <where>
- <if test="orgId != null ">
- and org_id = #{orgId}
- </if>
- <if test="orgName != null and orgName != ''">
- and org_name like concat('%', #{orgName}, '%')
- </if>
- <if test="deviceName != null and deviceName != ''">
- and device_name like concat('%', #{deviceName}, '%')
- </if>
- <if test="assetType != null and assetType != ''">
- and asset_type = #{assetType}
- </if>
- <if test="deviceType != null and deviceType != ''">
- and device_type = #{deviceType}
- </if>
- <if test="deviceBrand != null and deviceBrand != ''">
- and device_brand = #{deviceBrand}
- </if>
- <if test="checkTime != null ">
- and check_time = #{checkTime}
- </if>
- <if test="maintenanceTerm != null and maintenanceTerm != ''">
- and maintenance_term = #{maintenanceTerm}
- </if>
- <if test="hostId != null ">
- and host_id = #{hostId}
- </if>
- <if test="channel != null ">
- and channel = #{channel}
- </if>
- </where>
- </select>
- <select id="selectSysDeviceById" parameterType="Long"
- resultMap="SysDeviceResult">
- <include refid="selectSysDeviceVo"/>
- where id = #{id}
- </select>
- <select id="getHostByOrgId" resultType="com.xunmei.system.api.domain.SysDevice">
- <include refid="selectSysDeviceVo"/>
- WHERE
- org_id =#{orgId} and del_flag='0' and device_type='0'
- </select>
- <select id="selectVideoChannelByMonitorId" resultType="java.lang.Long">
- SELECT video_channel
- FROM core_monitoring_task_registration_monitor
- WHERE task_registration_id = #{monitorId}
- </select>
- <select id="getAccessByVideo" resultType="com.xunmei.system.vo.area.AccessType">
- SELECT cmtmi.situation AS situation,
- COUNT(cmtrm.id) AS num
- FROM core_monitoring_retrieval_task cmrt
- LEFT JOIN core_monitoring_task_registration cmtr ON cmrt.id = cmtr.task_id
- LEFT JOIN core_monitoring_task_registration_monitor cmtrm ON cmtrm.task_registration_id = cmtr.id
- LEFT JOIN core_monitoring_task_monitor_info cmtmi ON cmtmi.task_monitor_id = cmtrm.id
- WHERE cmtmi.situation IS NOT NULL
- AND cmtrm.video_channel = #{videoId}
- and cmrt.id = #{taskId}
- GROUP BY cmtmi.situation
- </select>
- <select id="selectByHostNameAndOrgId" resultType="com.xunmei.system.api.domain.SysDevice">
- SELECT
- *
- FROM
- sys_device
- WHERE
- org_id = #{orgId}
- AND device_name = #{hostName}
- </select>
- <!-- <select id="getAccessByVideo" resultType="java.util.Map">-->
- <!-- SELECT cmtmi.situation AS situation,-->
- <!-- COUNT(cmtrm.id) AS num-->
- <!-- FROM core_monitoring_retrieval_task cmrt-->
- <!-- LEFT JOIN core_monitoring_task_registration cmtr ON cmrt.id = cmtr.task_id-->
- <!-- LEFT JOIN core_monitoring_task_registration_monitor cmtrm ON cmtrm.task_registration_id = cmtr.id-->
- <!-- LEFT JOIN core_monitoring_task_monitor_info cmtmi ON cmtmi.task_monitor_id = cmtrm.id-->
- <!-- WHERE 1 = 1-->
- <!-- AND cmtrm.video_channel = #{videoId}-->
- <!-- and cmrt.id = #{taskId}-->
- <!-- AND cmtmi.situation IS NOT NULL-->
- <!-- GROUP BY cmtmi.situation-->
- <!-- </select>-->
- <insert id="insertSysDevice" parameterType="com.xunmei.system.api.domain.SysDevice">
- insert into sys_device
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="id != null">id,
- </if>
- <if test="orgId != null">org_id,
- </if>
- <if test="orgName != null">org_name,
- </if>
- <if test="deviceName != null">device_name,
- </if>
- <if test="assetType != null">asset_type,
- </if>
- <if test="deviceType != null">device_type,
- </if>
- <if test="deviceBrand != null">device_brand,
- </if>
- <if test="checkTime != null">check_time,
- </if>
- <if test="maintenanceTerm != null">maintenance_term,
- </if>
- <if test="createTime != null">create_time,
- </if>
- <if test="updateTime != null">update_time,
- </if>
- <if test="createBy != null">create_by,
- </if>
- <if test="updateBy != null">update_by,
- </if>
- <if test="delFlag != null">del_flag,
- </if>
- <if test="hostId != null">host_id,
- </if>
- <if test="channel != null">channel,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="id != null">#{id},
- </if>
- <if test="orgId != null">#{orgId},
- </if>
- <if test="orgName != null">#{orgName},
- </if>
- <if test="deviceName != null">#{deviceName},
- </if>
- <if test="assetType != null">#{assetType},
- </if>
- <if test="deviceType != null">#{deviceType},
- </if>
- <if test="deviceBrand != null">#{deviceBrand},
- </if>
- <if test="checkTime != null">#{checkTime},
- </if>
- <if test="maintenanceTerm != null">#{maintenanceTerm},
- </if>
- <if test="createTime != null">#{createTime},
- </if>
- <if test="updateTime != null">#{updateTime},
- </if>
- <if test="createBy != null">#{createBy},
- </if>
- <if test="updateBy != null">#{updateBy},
- </if>
- <if test="delFlag != null">#{delFlag},
- </if>
- <if test="hostId != null">#{hostId},
- </if>
- <if test="channel != null">#{channel},
- </if>
- </trim>
- </insert>
- <update id="updateSysDevice" parameterType="com.xunmei.system.api.domain.SysDevice">
- update sys_device
- <trim prefix="SET" suffixOverrides=",">
- <if test="orgId != null">org_id =
- #{orgId},
- </if>
- <if test="orgName != null">org_name =
- #{orgName},
- </if>
- <if test="deviceName != null">device_name =
- #{deviceName},
- </if>
- <if test="assetType != null">asset_type =
- #{assetType},
- </if>
- <if test="deviceType != null">device_type =
- #{deviceType},
- </if>
- <if test="deviceBrand != null">device_brand =
- #{deviceBrand},
- </if>
- <if test="checkTime != null">check_time =
- #{checkTime},
- </if>
- <if test="maintenanceTerm != null">maintenance_term =
- #{maintenanceTerm},
- </if>
- <if test="createTime != null">create_time =
- #{createTime},
- </if>
- <if test="updateTime != null">update_time =
- #{updateTime},
- </if>
- <if test="createBy != null">create_by =
- #{createBy},
- </if>
- <if test="updateBy != null">update_by =
- #{updateBy},
- </if>
- <if test="delFlag != null">del_flag =
- #{delFlag},
- </if>
- <if test="hostId != null">host_id =
- #{hostId},
- </if>
- <if test="channel != null">channel =
- #{channel},
- </if>
- </trim>
- where id = #{id}
- </update>
- <delete id="deleteSysDeviceById" parameterType="Long">
- delete
- from sys_device
- where id = #{id}
- </delete>
- <delete id="deleteSysDeviceByIds" parameterType="String">
- delete from sys_device where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- </mapper>
|