123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210 |
- <?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.ozs.service.mapper.BaseCameraManagementMapper">
- <select id="selectCameraManagementList" resultType="com.ozs.service.entity.BaseCameraManagement" parameterType="com.ozs.service.entity.vo.BaseCameraManagementVo">
- SELECT
- a.id AS id,
- a.camera_code AS cameraCode,
- a.railway_code AS railwayCode,
- a.channel AS channel,
- a.dept_id AS deptId,
- a.line_dir AS lineDir,
- a.install_mile AS installMile,
- a.begin_mile AS beginMile,
- a.end_mile AS endMile,
- a.install_longitude AS installLongitude,
- a.install_latitude AS installLatitude,
- a.card_num AS cardNum,
- a.start_recording AS startRecording,
- a.task_id AS taskId,
- a.create_time AS createTime,
- a.remark AS remark,
- a.version_id AS versionId,
- a.version_num AS versionNum,
- a.version_name AS versionName,
- a.last_version_num AS lastVersionNum,
- a.measure_point_name AS measurePointName,
- a.camera_sn AS cameraSn,
- r.railway_type AS railwayType,
- man.is_disable AS isDisable
- FROM
- base_camera_management a join base_railway_management r
- on a.railway_code=r.railway_code
- LEFT JOIN base_device_dynamic_management AS man ON a.camera_code = man.camera_code
- <where>
- <if test="railwayCode != null and railwayCode != ''">
- and a.railway_code=#{railwayCode}
- </if>
- <if test="cameraCode != null and cameraCode != ''">
- and a.camera_code like concat('%', #{cameraCode}, '%')
- </if>
- <if test="lineDir != null and lineDir != 0">
- and a.line_dir =#{lineDir}
- </if>
- <if test="deptId != null and deptId != 0">
- and a.dept_id =#{deptId}
- </if>
- <if test="beginMile != null and beginMile != 0">
- and a.install_mile >=#{beginMile}
- </if>
- <if test="endMile != null and endMile != 0">
- and a.install_mile <=#{endMile}
- </if>
- <if test="installMile != null and installMile != 0">
- and a.install_mile =#{installMile}
- </if>
- <if test="railwayType != null and railwayType != 0">
- and r.railway_type =#{railwayType}
- </if>
- <if test="ids != null and ids.size>0">
- and a.id in
- <foreach item="items" collection="ids" separator="," open="(" close=")" index="">
- #{items}
- </foreach>
- </if>
- <if test="!dsFlay">
- and
- <trim prefix="(" prefixOverrides="or" suffix=")">
- <if test="dsUserId != null and dsUserId != ''">
- or a.create_by=#{dsUserId}
- </if>
- <if test="dsDeptId != null and dsDeptId != 0">
- or a.dept_id=#{dsDeptId}
- </if>
- <if test="dsDeptIds != null">
- or a.dept_id in
- <foreach item="item" collection="dsDeptIds" separator="," open="(" close=")" index="">
- #{item}
- </foreach>
- </if>
- </trim>
- </if>
- </where>
- ORDER BY
- CONVERT (r.railway_name USING gbk),a.install_mile
- </select>
- <select id="countCamera" parameterType="com.ozs.service.entity.vo.MsgAlarmVo" resultType="java.lang.Integer">
- select count(id) from base_camera_management
- <where>
- <if test="!dsFlay">
- and
- <trim prefix="(" prefixOverrides="or" suffix=")">
- <if test="dsUserId != null and dsUserId != ''">
- or create_by = #{dsUserId}
- </if>
- <if test="dsDeptId != null and dsDeptId != 0">
- or dept_id = #{dsDeptId}
- </if>
- <if test="dsDeptIds != null">
- or dept_id in
- <foreach item="item" collection="dsDeptIds" separator="," open="(" close=")" index="">
- #{item}
- </foreach>
- </if>
- </trim>
- </if>
- </where>
- </select>
- <select id="getCameraChannelByAlarmId" resultType="java.util.Map">
- select b.channel,
- b.camera_code as cameraCode,
- ma.is_lock as isLock,
- ma.released_time as releasedTime,
- ma.alarm_time as alarmTime
- from msg_alarm ma
- left join
- base_camera_management b on ma.camera_code = b.camera_code
- where ma.alarm_id = #{alarmId}
- </select>
- <select id="deviceStatePage" resultType="com.ozs.service.entity.vo.DeviceStateResp" parameterType="com.ozs.service.entity.vo.DeviceStateResp">
- SELECT
- ca.install_mile AS installMile,
- ca.measure_point_name AS measurePointName,
- ra.railway_name AS railwayName,
- ra.railway_type AS railwayType,
- de.dept_name AS deptName,
- CASE
- line_dir
- WHEN 1 THEN
- '上行'
- WHEN 2 THEN
- '下行'
- WHEN 3 THEN
- '上下行'
- END AS lineDir,
- CASE
- man.is_disable
- WHEN 1 THEN
- '正常'
- WHEN 2 THEN
- '故障'
- END AS isDisable,
- man.electricity,
- ca.camera_code AS cameraCode,
- ca.camera_sn AS cameraSn,
- man.update_time AS updateTime,
- man.facility_state AS facilityState,
- man.electricity_state AS electricityState
- FROM
- base_camera_management AS ca
- LEFT JOIN base_railway_management AS ra ON ca.railway_code = ra.railway_code
- LEFT JOIN sys_dept AS de ON ca.dept_id = de.dept_id
- LEFT JOIN base_device_dynamic_management AS man ON ca.camera_code = man.camera_code
- <where>
- <if test="railwayCode != null and railwayCode != ''">
- and ca.railway_code=#{railwayCode}
- </if>
- <if test="isDisable != null and isDisable != ''">
- and man.is_disable=#{isDisable}
- </if>
- <if test="electricity != null and electricity != ''">
- and man.electricity <=#{electricity}
- </if>
- <if test="facilityState != null and facilityState != 0">
- and man.facility_state =#{facilityState}
- </if>
- <if test="electricityState != null and electricityState != 0">
- and man.electricity_state =#{electricityState}
- </if>
- <if test="lineDir != null and lineDir != 0">
- and ca.line_dir =#{lineDir}
- </if>
- <if test="railwayType != null and railwayType != 0">
- and ca.railway_type =#{railwayType}
- </if>
- <if test="deptId != null and deptId != 0">
- and ca.dept_id =#{deptId}
- </if>
- <if test="!dsFlay">
- and
- <trim prefix="(" prefixOverrides="or" suffix=")">
- <if test="dsUserId != null and dsUserId != ''">
- or ca.create_by=#{dsUserId}
- </if>
- <if test="dsDeptId != null and dsDeptId != 0">
- or ca.dept_id=#{dsDeptId}
- </if>
- <if test="dsDeptIds != null">
- or ca.dept_id in
- <foreach item="item" collection="dsDeptIds" separator="," open="(" close=")" index="">
- #{item}
- </foreach>
- </if>
- </trim>
- </if>
- </where>
- ORDER BY man.is_disable DESC,
- man.electricity
- </select>
- <select id="alarmCountSort" resultType="com.ozs.service.entity.vo.AlarmCountSortVo">
- SELECT COUNT(m.camera_code) AS cameraCount,c.camera_code AS cameraCode,c.measure_point_name AS measurePointName
- FROM msg_alarm m JOIN base_camera_management c ON m.camera_code=c.camera_code
- GROUP BY m.camera_code
- ORDER BY cameraCount DESC
- </select>
- </mapper>
|