预警信息管理功能开发
This commit is contained in:
parent
7702ccf5e4
commit
8f906ed78b
|
|
@ -0,0 +1,357 @@
|
|||
<?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.dkl.large.mapper.DklMonitoringPointsMapper">
|
||||
|
||||
<resultMap type="DklMonitoringPoints" id="DklMonitoringPointsResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="monitoringType" column="monitoring_type" />
|
||||
<result property="pointName" column="point_name" />
|
||||
<result property="pointRegion" column="point_region" />
|
||||
<result property="dutyPeople" column="duty_people" />
|
||||
<result property="dutyPhone" column="duty_phone" />
|
||||
<result property="pointAddress" column="point_address" />
|
||||
<result property="lng" column="lng" />
|
||||
<result property="lat" column="lat" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
<result property="loadBearingMax" column="load_bearing_max" />
|
||||
<result property="deptId" column="dept_id" />
|
||||
<result property="isRisk" column="is_risk" />
|
||||
<result property="sigenCode" column="sigen_code" />
|
||||
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectDklMonitoringPointsVo">
|
||||
select dmp.id, dmp.sigen_code , dmp.monitoring_type, dmp.point_name, dmp.point_region, dmp.duty_people, dmp.duty_phone, dmp.point_address, dmp.lng, dmp.lat, dmp.create_by, dmp.create_time,
|
||||
dmp.update_by, dmp.update_time,dmp.is_risk, dmp.del_flag, dmp.load_bearing_max, dmp.dept_id,sdd.dict_label as regionname ,sdd1.dict_label as monitoringTypeName from dkl_monitoring_points AS dmp
|
||||
left join sys_dept d on dmp.dept_id = d.dept_id
|
||||
LEFT JOIN sys_dict_data sdd ON sdd.dict_value = dmp.point_region
|
||||
AND sdd.dict_type = 'activity_area'
|
||||
LEFT JOIN sys_dict_data sdd1 ON sdd1.dict_value = dmp.monitoring_type
|
||||
AND sdd1.dict_type = 'monitoring_point_type'
|
||||
</sql>
|
||||
|
||||
<select id="selectDklMonitoringPointsList" parameterType="DklMonitoringPoints" resultMap="DklMonitoringPointsResult">
|
||||
<include refid="selectDklMonitoringPointsVo"/>
|
||||
<where>
|
||||
<if test="monitoringType != null and monitoringType != ''"> and dmp.monitoring_type = #{monitoringType}</if>
|
||||
<if test="pointName != null and pointName != ''"> and dmp.point_name like concat('%', #{pointName}, '%')</if>
|
||||
<if test="pointRegion != null and pointRegion != ''"> and dmp.point_region = #{pointRegion}</if>
|
||||
<if test="dutyPeople != null and dutyPeople != ''"> and dmp.duty_people like concat('%', #{dutyPeople}, '%')</if>
|
||||
<if test="dutyPhone != null and dutyPhone != ''"> and dmp.duty_phone = #{dutyPhone}</if>
|
||||
<if test="pointAddress != null and pointAddress != ''"> and dmp.point_address = #{pointAddress}</if>
|
||||
<if test="lng != null and lng != ''"> and dmp.lng = #{lng}</if>
|
||||
<if test="lat != null and lat != ''"> and dmp.lat = #{lat}</if>
|
||||
<if test="loadBearingMax != null "> and dmp.load_bearing_max = #{loadBearingMax}</if>
|
||||
<if test="deptId != null "> and dmp.dept_id = #{deptId}</if>
|
||||
<if test="delFlag != null and delFlag != ''"> and dmp.del_flag = #{delFlag}</if>
|
||||
<if test="isRisk != null and isRisk != ''"> and dmp.is_risk = #{isRisk}</if>
|
||||
<if test="startTime != null and endTime != null">
|
||||
AND dmp.create_time BETWEEN #{startTime} and #{endTime}
|
||||
</if>
|
||||
</where>
|
||||
<!-- 数据范围过滤 -->
|
||||
${params.dataScope}
|
||||
order by dmp.create_time desc
|
||||
</select>
|
||||
|
||||
<select id="selectDklMonitoringPointsById" parameterType="Long" resultMap="DklMonitoringPointsResult">
|
||||
<include refid="selectDklMonitoringPointsVo"/>
|
||||
where dmp.id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertDklMonitoringPoints" parameterType="DklMonitoringPoints">
|
||||
insert into dkl_monitoring_points
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="monitoringType != null">monitoring_type,</if>
|
||||
<if test="pointName != null">point_name,</if>
|
||||
<if test="pointRegion != null">point_region,</if>
|
||||
<if test="dutyPeople != null">duty_people,</if>
|
||||
<if test="dutyPhone != null">duty_phone,</if>
|
||||
<if test="pointAddress != null">point_address,</if>
|
||||
<if test="lng != null">lng,</if>
|
||||
<if test="lat != null">lat,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="delFlag != null">del_flag,</if>
|
||||
<if test="loadBearingMax != null">load_bearing_max,</if>
|
||||
<if test="deptId != null">dept_id,</if>
|
||||
<if test="isRisk != null">is_risk,</if>
|
||||
<if test="sigenCode != null">sigen_code,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="monitoringType != null">#{monitoringType},</if>
|
||||
<if test="pointName != null">#{pointName},</if>
|
||||
<if test="pointRegion != null">#{pointRegion},</if>
|
||||
<if test="dutyPeople != null">#{dutyPeople},</if>
|
||||
<if test="dutyPhone != null">#{dutyPhone},</if>
|
||||
<if test="pointAddress != null">#{pointAddress},</if>
|
||||
<if test="lng != null">#{lng},</if>
|
||||
<if test="lat != null">#{lat},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="delFlag != null">#{delFlag},</if>
|
||||
<if test="loadBearingMax != null">#{loadBearingMax},</if>
|
||||
<if test="deptId != null">#{deptId},</if>
|
||||
<if test="isRisk != null">#{isRisk},</if>
|
||||
<if test="sigenCode != null">#{sigenCode},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateDklMonitoringPoints" parameterType="DklMonitoringPoints">
|
||||
update dkl_monitoring_points
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="monitoringType != null">monitoring_type = #{monitoringType},</if>
|
||||
<if test="pointName != null">point_name = #{pointName},</if>
|
||||
<if test="pointRegion != null">point_region = #{pointRegion},</if>
|
||||
<if test="dutyPeople != null">duty_people = #{dutyPeople},</if>
|
||||
<if test="dutyPhone != null">duty_phone = #{dutyPhone},</if>
|
||||
<if test="pointAddress != null">point_address = #{pointAddress},</if>
|
||||
<if test="lng != null">lng = #{lng},</if>
|
||||
<if test="lat != null">lat = #{lat},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
||||
<if test="loadBearingMax != null">load_bearing_max = #{loadBearingMax},</if>
|
||||
<if test="deptId != null">dept_id = #{deptId},</if>
|
||||
<if test="isRisk != null">is_risk = #{isRisk},</if>
|
||||
<if test="sigenCode != null">sigen_code = #{sigenCode},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="deleteDklMonitoringPointsById" parameterType="int">
|
||||
update dkl_monitoring_points set del_flag = 2 where id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="deleteDklMonitoringPointsByIds" parameterType="int">
|
||||
update dkl_monitoring_points set del_flag = 2 where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<select id="getDklMonitoringPointsCount" parameterType="string">
|
||||
SELECT COUNT(*) FROM dkl_monitoring_points WHERE del_flag = '0'
|
||||
</select>
|
||||
|
||||
|
||||
<select id="heatMap" parameterType="HeatVo" resultType="HeatVo">
|
||||
SELECT
|
||||
mp.id,
|
||||
mp.monitoring_type,
|
||||
mp.point_name,
|
||||
mp.point_address,
|
||||
mp.lng,
|
||||
mp.lat,
|
||||
CONCAT(a.dayTime, ' ', a.hTime) as dayTime,
|
||||
a.numberPeople,
|
||||
CAST( a.numberPeople / mp.load_bearing_max AS DECIMAL( 10, 3 ) )*100 AS capacityFactor
|
||||
FROM(
|
||||
SELECT
|
||||
mcd.camera_id,
|
||||
SUM( mcd.number_people ) AS numberPeople,
|
||||
to_char( mcd.acquisition_time, 'YYYY-MM-DD' ) AS dayTime,
|
||||
to_char( mcd.acquisition_time, 'HH24:MI' ) AS hTime
|
||||
FROM
|
||||
dkl_monitoring_camera_data mcd
|
||||
WHERE
|
||||
mcd.del_flag = '0'
|
||||
<if test="dataVo.startTime != null">
|
||||
AND mcd.acquisition_time >= DATE_TRUNC( 'day', #{dataVo.startTime} :: DATE)
|
||||
</if>
|
||||
<if test="dataVo.endTime != null">
|
||||
AND mcd.acquisition_time <![CDATA[ <= ]]> DATE_TRUNC( 'day', #{dataVo.endTime} :: DATE + INTERVAL '1 day' )
|
||||
</if>
|
||||
GROUP BY
|
||||
mcd.camera_id,
|
||||
dayTime,
|
||||
hTime
|
||||
) a
|
||||
LEFT JOIN dkl_monitoring_camera AS mc ON mc."id" = a.camera_id
|
||||
LEFT JOIN dkl_monitoring_points AS mp ON mp."id" = mc.points_id
|
||||
WHERE
|
||||
mc.del_flag = '0'
|
||||
AND mp.del_flag = '0'
|
||||
<if test="dataVo.monitoringType != null and dataVo.monitoringType != ''">
|
||||
AND mp.monitoring_type = #{dataVo.monitoringType}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="regionalStatistics" parameterType="RegionalVo" resultType="RegionalVo">
|
||||
<!-- SELECT-->
|
||||
<!-- sdd.dict_label as regionname,-->
|
||||
<!-- COALESCE(A.numberPeople,0) AS loadBearingMax-->
|
||||
<!-- FROM-->
|
||||
<!-- sys_dict_data sdd-->
|
||||
<!-- LEFT JOIN (-->
|
||||
<!-- SELECT-->
|
||||
<!-- mp.point_region,-->
|
||||
<!-- SUM ( mcd.number_people ) AS numberPeople-->
|
||||
<!-- FROM-->
|
||||
<!-- dkl_monitoring_camera_data mcd-->
|
||||
<!-- LEFT JOIN dkl_monitoring_camera AS mc ON mc."id" = mcd.camera_id-->
|
||||
<!-- LEFT JOIN dkl_monitoring_points AS mp ON mp."id" = mc.points_id-->
|
||||
<!-- WHERE-->
|
||||
<!-- mcd.del_flag = '0'-->
|
||||
<!-- AND mc.del_flag = '0'-->
|
||||
<!-- AND mp.del_flag = '0'-->
|
||||
<!-- <if test="regionalVo.startTime != null">-->
|
||||
<!-- AND mcd.acquisition_time >= DATE_TRUNC( 'day', #{regionalVo.startTime} :: DATE )-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="regionalVo.endTime != null">-->
|
||||
<!-- AND mcd.acquisition_time <![CDATA[ <= ]]> DATE_TRUNC( 'day', #{regionalVo.endTime} :: DATE + INTERVAL '1 day' )-->
|
||||
<!-- </if>-->
|
||||
<!-- GROUP BY-->
|
||||
<!-- mp.point_region-->
|
||||
<!-- ) A ON A.point_region = sdd.dict_value-->
|
||||
<!-- WHERE-->
|
||||
<!-- sdd.status = '0'-->
|
||||
<!-- AND sdd.dict_type = 'activity_area'-->
|
||||
SELECT
|
||||
sdd.dict_label AS regionname,
|
||||
sdd.dict_value AS regioninfo,
|
||||
A.typename AS typename,
|
||||
A.monitoring_type AS typeinfo,
|
||||
COALESCE ( A.numberPeople, 0 ) AS loadBearingMax
|
||||
FROM
|
||||
sys_dict_data sdd
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
dmp.point_region,
|
||||
dmp.monitoring_type,
|
||||
sdd.dict_label AS typename,
|
||||
COUNT ( * ) AS numberPeople
|
||||
FROM
|
||||
dkl_monitoring_points AS dmp
|
||||
LEFT JOIN sys_dict_data AS sdd ON dmp.monitoring_type = sdd.dict_value
|
||||
AND sdd.dict_type = 'monitoring_point_type'
|
||||
WHERE
|
||||
dmp.del_flag = '0'
|
||||
GROUP BY
|
||||
point_region,
|
||||
monitoring_type,
|
||||
sdd.dict_label
|
||||
) A ON A.point_region = sdd.dict_value
|
||||
WHERE
|
||||
sdd.status = '0'
|
||||
AND sdd.dict_type = 'activity_area'
|
||||
</select>
|
||||
|
||||
<select id="regionalDataList" parameterType="RegionalVo" resultType="DklMonitoringPoints">
|
||||
select dmp.id, dmp.monitoring_type, dmp.point_name as pointName, dmp.point_region , dmp.duty_people as dutyPeople, dmp.duty_phone as dutyPhone, dmp.point_address as pointAddress , dmp.lng, dmp.lat, dmp.create_by, dmp.create_time,
|
||||
dmp.update_by, dmp.update_time, dmp.del_flag, dmp.load_bearing_max as loadBearingMax from dkl_monitoring_points AS dmp
|
||||
LEFT JOIN sys_dict_data AS sdd ON dmp.monitoring_type = sdd.dict_value AND sdd.dict_type = 'monitoring_point_type'
|
||||
LEFT JOIN sys_dict_data AS sdd1 ON dmp.point_region = sdd1.dict_value AND sdd1.dict_type = 'activity_area'
|
||||
WHERE
|
||||
dmp.del_flag = '0'
|
||||
<if test="regionalVo.typename != null">
|
||||
AND sdd.dict_label = #{regionalVo.typename}
|
||||
</if>
|
||||
<if test="regionalVo.regionname != null">
|
||||
AND sdd1.dict_label = #{regionalVo.regionname}
|
||||
</if>
|
||||
|
||||
</select>
|
||||
|
||||
<select id="riskDataList" parameterType="RiskVo" resultType="RiskVo">
|
||||
SELECT
|
||||
mp.id,
|
||||
mp.point_name AS pointName,
|
||||
mp.load_bearing_max AS loadBearingMax,
|
||||
SUM( a.numberPeopleSum ) AS numberPeople,
|
||||
CAST( numberPeople / mp.load_bearing_max AS DECIMAL( 10, 3 ) )*100 AS capacityFactor,
|
||||
mp.monitoring_type AS monitoringType,
|
||||
mp.point_address AS pointAddress,
|
||||
(
|
||||
SELECT
|
||||
icon
|
||||
FROM
|
||||
dkl_warning_threshold
|
||||
WHERE
|
||||
CAST ( SUM ( a.numberPeopleSum ) / mp.load_bearing_max AS DECIMAL ( 10, 3 ) ) >= max_capacity
|
||||
AND CAST ( SUM ( a.numberPeopleSum ) / mp.load_bearing_max AS DECIMAL ( 10, 3 ) ) <= min_capacity
|
||||
AND del_flag = '0'
|
||||
) as icon
|
||||
FROM(
|
||||
SELECT
|
||||
mcd.camera_id,
|
||||
SUM( mcd.number_people ) AS numberPeopleSum
|
||||
FROM
|
||||
dkl_monitoring_camera_data mcd
|
||||
WHERE
|
||||
mcd.del_flag = '0'
|
||||
<if test="riskVo.startTime != null">
|
||||
AND mcd.acquisition_time >= DATE_TRUNC( 'day', #{riskVo.startTime} :: DATE )
|
||||
</if>
|
||||
<if test="riskVo.endTime != null">
|
||||
AND mcd.acquisition_time <![CDATA[ <= ]]> DATE_TRUNC( 'day', #{riskVo.endTime} :: DATE + INTERVAL '1 day' )
|
||||
</if>
|
||||
GROUP BY
|
||||
mcd.camera_id
|
||||
) a
|
||||
LEFT JOIN dkl_monitoring_camera AS mc ON mc."id" = a.camera_id
|
||||
LEFT JOIN dkl_monitoring_points AS mp ON mp."id" = mc.points_id
|
||||
WHERE
|
||||
mc.del_flag = '0'
|
||||
AND mp.del_flag = '0'
|
||||
GROUP BY mp.id
|
||||
</select>
|
||||
|
||||
<select id="homePointsStatistics" parameterType="RiskVo" resultType="RiskVo">
|
||||
SELECT
|
||||
dmp.point_region as pointRegion,
|
||||
sdd.dict_label AS regionname,
|
||||
count ( dmp.point_region ) AS numberPeople
|
||||
FROM
|
||||
dkl_monitoring_points AS dmp
|
||||
LEFT JOIN sys_dict_data sdd ON sdd.dict_value = dmp.point_region
|
||||
AND sdd.dict_type = 'activity_area'
|
||||
WHERE
|
||||
dmp.del_flag = '0'
|
||||
<if test="startTime != null and endTime != null ">
|
||||
AND dmp.create_time >= #{startTime}
|
||||
AND dmp.create_time <= #{endTime}
|
||||
</if>
|
||||
|
||||
GROUP BY
|
||||
dmp.point_region,
|
||||
sdd.dict_label
|
||||
</select>
|
||||
|
||||
<select id="homePointsStatisticsPeople" parameterType="RiskVo" resultType="RiskVo">
|
||||
SELECT
|
||||
dmp.point_region as pointRegion,
|
||||
sdd.dict_label as regionname,
|
||||
SUM ( dmp.load_bearing_max ) AS numberPeople
|
||||
FROM
|
||||
dkl_monitoring_points AS dmp
|
||||
LEFT JOIN sys_dict_data sdd ON sdd.dict_value = dmp.point_region
|
||||
AND sdd.dict_type = 'activity_area'
|
||||
WHERE
|
||||
dmp.del_flag = '0'
|
||||
<if test="startTime != null and endTime != null ">
|
||||
AND dmp.create_time >= #{startTime}
|
||||
AND dmp.create_time <= #{endTime}
|
||||
</if>
|
||||
GROUP BY
|
||||
dmp.point_region,
|
||||
sdd.dict_label
|
||||
</select>
|
||||
|
||||
<select id="checkPointsNameUnique" resultMap="DklMonitoringPointsResult">
|
||||
<include refid="selectDklMonitoringPointsVo"/>
|
||||
where dmp.point_name=#{pointName} and dmp.del_flag = '0' limit 1
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue