bns_jjsp_service/securityControl-modules/securityControl-task/target/classes/mapper/task/DeviceMapper.xml

209 lines
9.8 KiB
XML
Raw Permalink Normal View History

2025-01-16 18:13:22 +08:00
<?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.securityControl.task.mapper.DeviceDao">
<select id="getClassMettintState" resultType="com.securityControl.task.domain.vo.DeviceVo">
select distinct td.device_name devName,td.mac_id macId,
td.puid puId,td.gb_code gbCode,t_code tCode,
t_name tName,tw_code twCode,td_code tdCode
from jj_class_meetting jcm
left join jj_ball jbl on jbl.id=jcm.camera_id2 and jbl.delete_flag=0
left join t_device td on td.t_code=jbl.camera_no and td.is_flag=0
where jcm.camera_id is not null and jcm.delete_flag=0
and td.puid is not null and jcm.current_constr_date=#{time}
</select>
<!--查询设备puid的集合-->
<select id="getClassPuid" resultType="String">
select DISTINCT td.puid puId
from jj_class_meetting jcm
left join jj_ball jbl on jbl.id=jcm.camera_id2 and jbl.delete_flag=0
left join t_device td on td.t_code=jbl.camera_no and td.is_flag=0
where jcm.camera_id is not null
and jcm.current_constr_date=CURRENT_DATE() and jcm.delete_flag=0
</select>
<select id="getTYClassMettintState" resultType="com.securityControl.task.domain.vo.DeviceVo">
select distinct td.device_name devName,td.mac_id macId,
td.puid puId,td.gb_code gbCode,t_code tCode,
t_name tName,tw_code twCode,td_code tdCode
from jj_class_meetting jcm
left join jj_ball jbl on jbl.id=jcm.camera_id2 and jbl.delete_flag=0
left join t_device td on td.t_code=jbl.camera_no and td.is_flag=0
where jcm.camera_id is not null and jcm.delete_flag=0 and td.is_t='1'
and td.puid is not null and jcm.current_constr_date=CURRENT_DATE()
</select>
<select id="getAllDeviceList" resultType="com.securityControl.task.domain.vo.DeviceVo">
select td.device_name devName,td.mac_id macId,td.puid puId,td.gb_code gbCode,t_code tCode,t_name tName,tw_code twCode,td_code tdCode
from t_device td
where td.is_flag=0
</select>
<select id="getTyDeviceList" resultType="com.securityControl.task.domain.vo.DeviceVo">
select td.device_name devName,td.mac_id macId,td.puid puId,td.gb_code gbCode,t_code tCode,t_name tName,tw_code twCode,td_code tdCode
from t_device td
where td.is_flag=0 and td.is_t='1'
AND t_code is not null
</select>
<!--获取在线状态-->
<select id="getOnlineDevice" resultType="com.securityControl.task.domain.vo.DeviceVo">
select td.device_name devName,td.mac_id macId,td.puid puId,td.gb_code gbCode
from t_device td
where td.is_flag=0 and state='1'
and td.pass_way in(
<foreach collection="list" item="item" separator=",">
#{item}
</foreach>
)
</select>
<update id="updateDeviceState" >
UPDATE t_device SET state = #{param.OnlineFlag} , update_time=#{time}
WHERE puid = #{param.puid}
</update>
<update id="updateDervice" >
<foreach collection="list" item="item" separator=";">
update t_device
<set>
state = #{item.status}
</set>
where gb_code = #{item.devCode}
</foreach>
</update>
<update id="updateDeviceXh">
UPDATE t_device SET qj_xh = #{qjxh}
WHERE puid = #{puid}
</update>
<select id="getUpdownList" parameterType="String" resultType="com.securityControl.task.domain.vo.DeviceUpdownVo">
select up_time upTime,down_time downTime
from t_device_updown
where create_day=#{day} and down_time is null
and puid=#{puid}
ORDER BY up_time ASC
limit 1
</select>
<insert id="insertUpTime">
insert into t_device_updown(puid,up_time,create_day) value (#{puid},#{time},#{day})
</insert>
<update id="updateDownTime">
update t_device_updown set down_time=#{time} where puid=#{puid} and up_time=#{upTime}
</update>
<select id="getDeviceName" parameterType="String" resultType="com.securityControl.task.domain.vo.DeviceNameClassVo">
select td.mac_id macId,td.puid puId,sd2.`name` ssdwName ,
jcmi.work_manage userName,jcmi.work_manage_phone phone,jcm.bidding_section_name proName
from jj_class_meetting jcm
left join jj_class_metting_info jcmi on jcm.id=jcmi.class_id
left join jj_ball jbl on jbl.id=jcm.camera_id2 and jbl.delete_flag=0
left join t_device td on td.t_code=jbl.camera_no and td.is_flag=0
LEFT JOIN sys_dist sd2 on sd2.id=td.ss_dw
where jcm.camera_id is not null and td.puid is not null and jcm.delete_flag=0
and jcmi.work_manage is not null and jcmi.work_manage is not null
and jcmi.work_manage_phone is not null
and jcm.current_constr_date=#{time}
ORDER BY jcm.work_start_time asc
</select>
<!--更新设备状态-->
<update id="refreshTyDevice" parameterType="com.securityControl.task.domain.vo.TDResultValue">
UPDATE t_device SET state = #{status}
WHERE t_code = #{devCode}
</update>
<!-- 查询设备信息 -->
<select id="getAllZdFpGroupBy" resultType="com.securityControl.task.domain.vo.ZdfpVo" parameterType="com.securityControl.task.domain.vo.ZdfpVo">
select td.puid,so.city_name cityName,cm.re_assessment_risk_level riskLevel
FROM jj_class_meetting cm
left join jj_ball jbl on jbl.id=cm.camera_id2 and jbl.delete_flag=0
left join t_device td on td.t_code=jbl.camera_no and td.is_flag=0
left join sys_org so on so.org_id=cm.build_unit_code
where cm.current_constr_date=CURRENT_DATE() AND cm.delete_flag=0 and td.puid is not null
ORDER BY cm.work_start_time asc
</select>
<select id="riskLevel" resultType="String" parameterType="String">
select td.puid
FROM jj_class_meetting cm
left join jj_ball jbl on jbl.id=cm.camera_id2 and jbl.delete_flag=0
left join t_device td on td.t_code=jbl.camera_no and td.is_flag=0
left join sys_org so on so.org_id=cm.build_unit_code
where cm.current_constr_date=CURRENT_DATE() AND cm.delete_flag=0 and td.puid is not null
<if test="cityNam!=null and cityName!=''">
and so.city_name=#{cityNam}
</if>
<if test="riskLevel!=null and riskLevel!=''">
and cm.re_assessment_risk_level=#{riskLevel}
</if>
ORDER BY cm.work_start_time asc
</select>
<select id="getDeviceListToCatchPic" resultType="com.securityControl.task.domain.vo.DeviceVo">
select td.device_name devName,td.mac_id macId,td.puid puId,td.gb_code gbCode,t_code tCode,
t_name tName,tw_code twCode,td_code tdCode, state, storage_id storageId, file_path filePath
from t_device td
where td.is_flag=0
</select>
<update id="updateCatchFile">
update t_device set puid=#{puId},
file_path=#{filePath},
storage_id=#{storageId},
catch_time=#{catchTime}
where puid=#{puId}
</update>
<!--查詢星系-->
<select id="getPuidListByParam" resultType="String" parameterType="String">
select td.puid
FROM jj_class_meetting cm
left join jj_ball jbl on jbl.id=cm.camera_id2 and jbl.delete_flag=0
left join t_device td on td.t_code=jbl.camera_no and td.is_flag=0
left join sys_org so on so.org_id=cm.build_unit_code
where cm.current_constr_date=CURRENT_DATE() AND cm.delete_flag=0 and td.puid!='' and td.puid is not null
<if test="cityName!=null and cityName!=''">
and so.city_name=#{cityName}
</if>
<if test="riskLevel!=null and riskLevel!=''">
and cm.re_assessment_risk_level=#{riskLevel}
</if>
ORDER BY cm.work_start_time asc
</select>
<update id="updateDerviceName" parameterType="String">
UPDATE t_device SET device_name = #{name}
WHERE puid = #{puid}
</update>
<update id="replaceUpdown" parameterType="String">
replace INTO t_device_updown
(puid, up_time,
<if test=" offlineTime!=null and offlineTime!=''">
down_time,
</if>
create_day
) values
(#{puid},#{onlineTime},
<if test=" offlineTime!=null and offlineTime!=''">
#{offlineTime},
</if>
#{day}
)
</update>
<!--更新设备定位-->
<update id="updateDeviceGps" parameterType="com.securityControl.task.domain.vo.GpsResult" >
UPDATE t_device SET lat= #{latitude}, lon=#{longitude}
WHERE t_code = #{devCode}
</update>
<!--更新设备定位-->
<update id="updateGps" parameterType="com.securityControl.task.util.GpsDtoEntity" >
UPDATE t_device SET lat= #{latitude}, lon=#{longitude}
WHERE puid = #{puid}
</update>
<!-- <select id="selectTest" resultType="String">-->
<!-- SELECT *-->
<!-- from test-->
<!-- </select>-->
<select id="getOnlineTime" parameterType="String" resultType="com.securityControl.task.domain.vo.DeviceUpdownVo">
select up_time upTime,down_time downTime
from t_device_updown
where down_time is null
and puid=#{puid}
ORDER BY up_time ASC
limit 1
</select>
</mapper>