|
|
|
|
<?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.hisense.hiatmp.server_api.mapper.HighDangerMapper">
|
|
|
|
|
|
|
|
|
|
<insert id="insertDanger">
|
|
|
|
|
insert into tht_hidden_danger_base
|
|
|
|
|
(nid,
|
|
|
|
|
business_id,
|
|
|
|
|
name,
|
|
|
|
|
type,
|
|
|
|
|
operator,
|
|
|
|
|
source,
|
|
|
|
|
find_way,
|
|
|
|
|
area,
|
|
|
|
|
status,
|
|
|
|
|
find_time,
|
|
|
|
|
pc_start_time,
|
|
|
|
|
report_dept,
|
|
|
|
|
handle_dept,
|
|
|
|
|
delay_count,
|
|
|
|
|
delay_day,
|
|
|
|
|
pc_count,
|
|
|
|
|
last_mod_date
|
|
|
|
|
)
|
|
|
|
|
values (#{nid},
|
|
|
|
|
#{businessId},
|
|
|
|
|
#{name},
|
|
|
|
|
#{type},
|
|
|
|
|
#{operator},
|
|
|
|
|
#{source},
|
|
|
|
|
#{findWay},
|
|
|
|
|
#{area},
|
|
|
|
|
#{status},
|
|
|
|
|
#{findTime},
|
|
|
|
|
#{pcStartTime},
|
|
|
|
|
#{reportDept},
|
|
|
|
|
#{handleDept},
|
|
|
|
|
#{delayCount},
|
|
|
|
|
#{delayDay},
|
|
|
|
|
#{pcCount},
|
|
|
|
|
NOW()
|
|
|
|
|
)
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<insert id="insertDangerRoad">
|
|
|
|
|
insert into tht_hidden_danger_road
|
|
|
|
|
(nid,
|
|
|
|
|
business_id,
|
|
|
|
|
section_code,
|
|
|
|
|
pc_count,
|
|
|
|
|
last_mod_date
|
|
|
|
|
)
|
|
|
|
|
values (#{nid},
|
|
|
|
|
#{businessId},
|
|
|
|
|
#{sectionCode},
|
|
|
|
|
#{pcCount},
|
|
|
|
|
NOW()
|
|
|
|
|
)
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<select id="getStatusCounts" resultType="com.hisense.hiatmp.model.common.HighDangerBaseNum">
|
|
|
|
|
SELECT 'Unconfirmed' AS status, SUM(CASE WHEN hdb.status = '0' or hdb.status = '99' THEN 1 ELSE 0 END) AS count
|
|
|
|
|
FROM tht_hidden_danger_base hdb
|
|
|
|
|
LEFT JOIN tht_hidden_danger_road hdr
|
|
|
|
|
ON hdb.business_id = hdr.business_id AND hdb.pc_count = hdr.pc_count
|
|
|
|
|
LEFT JOIN department dp ON hdb.handle_dept = dp.cdepartmentid
|
|
|
|
|
LEFT JOIN enum_type et ON et.ENUMTYPEID = '6601' AND et.enumvalue = hdb.status
|
|
|
|
|
WHERE hdr.belong_xq like concat(concat(#{cdepartmentid}::text,'%'))
|
|
|
|
|
|
|
|
|
|
UNION ALL
|
|
|
|
|
|
|
|
|
|
SELECT 'UnderInvestigation' AS status, count(*) AS count
|
|
|
|
|
FROM tht_hidden_danger_base hdb
|
|
|
|
|
LEFT JOIN tht_hidden_danger_road hdr
|
|
|
|
|
ON hdb.business_id = hdr.business_id AND hdb.pc_count = hdr.pc_count
|
|
|
|
|
LEFT JOIN department dp ON hdb.handle_dept = dp.cdepartmentid
|
|
|
|
|
LEFT JOIN enum_type et ON et.ENUMTYPEID = '6601' AND et.enumvalue = hdb.status
|
|
|
|
|
WHERE
|
|
|
|
|
1 = 1
|
|
|
|
|
AND hdb.status = '10'
|
|
|
|
|
AND hdr.nid is not null
|
|
|
|
|
AND COALESCE(hdb.approve_status,'0')IN('0','-1')
|
|
|
|
|
<if test="cdepartmentid != null">
|
|
|
|
|
AND hdr.belong_xq like concat(concat(#{cdepartmentid}::text,'%'))
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
|
|
UNION ALL
|
|
|
|
|
|
|
|
|
|
SELECT 'InGovernance' AS status,count(*) AS count
|
|
|
|
|
FROM tht_hidden_danger_base hdb
|
|
|
|
|
LEFT JOIN tht_hidden_danger_road hdr
|
|
|
|
|
ON hdb.business_id = hdr.business_id AND hdb.pc_count = hdr.pc_count
|
|
|
|
|
LEFT JOIN department dp ON hdb.handle_dept = dp.cdepartmentid
|
|
|
|
|
LEFT JOIN enum_type et ON et.ENUMTYPEID = '6601' AND et.enumvalue = hdb.status
|
|
|
|
|
WHERE
|
|
|
|
|
1 = 1
|
|
|
|
|
AND hdb.status = '10'
|
|
|
|
|
AND hdr.nid is not null
|
|
|
|
|
AND COALESCE(hdb.approve_status,'0')IN('0','-1')
|
|
|
|
|
<if test="cdepartmentid != null">
|
|
|
|
|
AND hdr.belong_xq like concat(concat(#{cdepartmentid}::text,'%'))
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
|
|
UNION ALL
|
|
|
|
|
|
|
|
|
|
SELECT 'Tracking' AS status, SUM(CASE WHEN hdb.status = '30' THEN 1 ELSE 0 END) AS count
|
|
|
|
|
FROM tht_hidden_danger_base hdb
|
|
|
|
|
LEFT JOIN tht_hidden_danger_road hdr
|
|
|
|
|
ON hdb.business_id = hdr.business_id AND hdb.pc_count = hdr.pc_count
|
|
|
|
|
LEFT JOIN department dp ON hdb.handle_dept = dp.cdepartmentid
|
|
|
|
|
LEFT JOIN enum_type et ON et.ENUMTYPEID = '6601' AND et.enumvalue = hdb.status
|
|
|
|
|
WHERE hdr.belong_xq like concat(concat(#{cdepartmentid}::text,'%'))
|
|
|
|
|
|
|
|
|
|
UNION ALL
|
|
|
|
|
|
|
|
|
|
SELECT 'Finished' AS status, count(*) AS count
|
|
|
|
|
FROM tht_hidden_danger_base hdb
|
|
|
|
|
LEFT JOIN tht_hidden_danger_road hdr
|
|
|
|
|
ON hdb.business_id = hdr.business_id AND hdb.pc_count = hdr.pc_count
|
|
|
|
|
LEFT JOIN department dp ON hdb.handle_dept = dp.cdepartmentid
|
|
|
|
|
LEFT JOIN enum_type et ON et.ENUMTYPEID = '6601' AND et.enumvalue = hdb.status
|
|
|
|
|
LEFT JOIN tht_timeline tt ON tt.business_id = hdb.business_id
|
|
|
|
|
WHERE hdr.belong_xq like concat(concat(#{cdepartmentid}::text,'%'))
|
|
|
|
|
AND tt.operator = #{nuserid}
|
|
|
|
|
AND hdb.status = '10'
|
|
|
|
|
AND hdr.nid is not null
|
|
|
|
|
AND hdb.approve_status != '0' AND hdb.approve_status != '-1'
|
|
|
|
|
<if test="cdepartmentid != null">
|
|
|
|
|
AND hdr.belong_xq like concat(concat(#{cdepartmentid}::text,'%'))
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
|
|
UNION ALL
|
|
|
|
|
|
|
|
|
|
SELECT 'NonHazard' AS status, SUM(CASE WHEN hdb.status = '50' THEN 1 ELSE 0 END) AS count
|
|
|
|
|
FROM tht_hidden_danger_base hdb
|
|
|
|
|
LEFT JOIN tht_hidden_danger_road hdr
|
|
|
|
|
ON hdb.business_id = hdr.business_id AND hdb.pc_count = hdr.pc_count
|
|
|
|
|
LEFT JOIN department dp ON hdb.handle_dept = dp.cdepartmentid
|
|
|
|
|
LEFT JOIN enum_type et ON et.ENUMTYPEID = '6601' AND et.enumvalue = hdb.status
|
|
|
|
|
WHERE hdr.belong_xq like concat(concat(#{cdepartmentid}::text,'%'))
|
|
|
|
|
|
|
|
|
|
UNION ALL
|
|
|
|
|
|
|
|
|
|
SELECT DISTINCT 'MonthReport' AS status, count(*) AS count
|
|
|
|
|
FROM tht_hidden_danger_base hdb
|
|
|
|
|
LEFT JOIN tht_hidden_danger_road hdr
|
|
|
|
|
ON hdb.business_id = hdr.business_id AND hdb.pc_count = hdr.pc_count
|
|
|
|
|
LEFT JOIN department dp ON hdb.handle_dept = dp.cdepartmentid
|
|
|
|
|
LEFT JOIN enum_type et ON et.ENUMTYPEID = '6601' AND et.enumvalue = hdb.status
|
|
|
|
|
LEFT JOIN tht_timeline tt ON tt.business_id = hdb.business_id
|
|
|
|
|
WHERE
|
|
|
|
|
tt.operator = #{nuserid}
|
|
|
|
|
AND tt.title = '隐患上报'
|
|
|
|
|
AND hdb.status = '10'
|
|
|
|
|
AND hdr.nid is not null
|
|
|
|
|
AND hdb.approve_status != '0' AND hdb.approve_status != '-1'
|
|
|
|
|
<if test="cdepartmentid != null">
|
|
|
|
|
AND hdr.belong_xq like concat(concat(#{cdepartmentid}::text,'%'))
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
|
|
UNION ALL
|
|
|
|
|
|
|
|
|
|
SELECT DISTINCT 'Dying' AS status, count(*) AS count
|
|
|
|
|
FROM tht_hidden_danger_base hdb
|
|
|
|
|
LEFT JOIN tht_param_config tpc ON tpc.param_code = 'THT_PC_ROAD_XT'
|
|
|
|
|
LEFT JOIN tht_hidden_danger_road hdr
|
|
|
|
|
ON
|
|
|
|
|
hdb.business_id = hdr.business_id AND hdb.pc_count = hdr.pc_count
|
|
|
|
|
LEFT JOIN department dp ON hdb.handle_dept = dp.cdepartmentid
|
|
|
|
|
LEFT JOIN enum_type et ON et.ENUMTYPEID = '6601' AND et.enumvalue = hdb.status
|
|
|
|
|
WHERE
|
|
|
|
|
1 = 1
|
|
|
|
|
<if test="cdepartmentid != null">
|
|
|
|
|
AND hdr.belong_xq like concat(concat(#{cdepartmentid}::text,'%'))
|
|
|
|
|
</if>
|
|
|
|
|
<![CDATA[
|
|
|
|
|
AND NOW() >= COALESCE(hdb.pc_end_time, hdb.pc_start_time + INTERVAL '1 day' * tpc.param_value::INTEGER) - INTERVAL '3 day'
|
|
|
|
|
AND NOW() <= COALESCE ( hdb.pc_end_time, hdb.pc_start_time + INTERVAL '1 day' * tpc.param_value :: INTEGER )
|
|
|
|
|
and hdb.status = '10'
|
|
|
|
|
AND COALESCE(hdb.approve_status,'0') IN ( '0', '-1')
|
|
|
|
|
]]>
|
|
|
|
|
|
|
|
|
|
UNION ALL
|
|
|
|
|
SELECT DISTINCT 'Delay' AS status, count(*) AS count
|
|
|
|
|
FROM tht_hidden_danger_base hdb
|
|
|
|
|
LEFT JOIN tht_param_config tpc ON tpc.param_code = 'THT_PC_ROAD_XT'
|
|
|
|
|
LEFT JOIN tht_hidden_danger_road hdr
|
|
|
|
|
ON
|
|
|
|
|
hdb.business_id = hdr.business_id AND hdb.pc_count = hdr.pc_count
|
|
|
|
|
LEFT JOIN department dp ON hdb.handle_dept = dp.cdepartmentid
|
|
|
|
|
LEFT JOIN enum_type et ON et.ENUMTYPEID = '6601' AND et.enumvalue = hdb.status
|
|
|
|
|
WHERE
|
|
|
|
|
1 = 1
|
|
|
|
|
<if test="cdepartmentid != null">
|
|
|
|
|
AND hdr.belong_xq like concat(concat(#{cdepartmentid}::text,'%'))
|
|
|
|
|
</if>
|
|
|
|
|
<![CDATA[
|
|
|
|
|
AND NOW() >= COALESCE ( hdb.pc_end_time, hdb.pc_start_time + INTERVAL '1 day' * tpc.param_value :: INTEGER )
|
|
|
|
|
and hdb.status = '10'
|
|
|
|
|
AND COALESCE(hdb.approve_status,'0') IN ( '0', '-1')
|
|
|
|
|
]]>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- <select id="getHigDangerDealt" resultType="com.hisense.hiatmp.model.common.HighDangerBase">-->
|
|
|
|
|
<!-- SELECT hdb.*,hdr.pc_type,hdr.pc_end_time as-->
|
|
|
|
|
<!-- road_pc_end_time,hdr.belong_xq,hdr.xzjd,bs.section_name,bs.section_code-->
|
|
|
|
|
<!-- FROM tht_hidden_danger_base hdb-->
|
|
|
|
|
<!-- LEFT JOIN tht_hidden_danger_road hdr ON hdb.business_id = hdr.business_id-->
|
|
|
|
|
<!-- AND hdb.pc_count = hdr.pc_count-->
|
|
|
|
|
<!-- LEFT JOIN department dp ON hdb.handle_dept = dp.cdepartmentid-->
|
|
|
|
|
<!-- LEFT JOIN enum_type et ON et.ENUMTYPEID = '6601'-->
|
|
|
|
|
<!-- AND et.enumvalue = hdb.status-->
|
|
|
|
|
<!-- LEFT JOIN bis_section bs ON hdr.section_code = bs.section_code-->
|
|
|
|
|
<!-- WHERE hdb.handle_dept = #{cdepartmentid}-->
|
|
|
|
|
<!-- <!–<if test="status != null and status == 0">-->
|
|
|
|
|
<!-- AND hdb.status in ('0','99')-->
|
|
|
|
|
<!-- </if>–>-->
|
|
|
|
|
<!-- <if test="status != null">-->
|
|
|
|
|
<!-- AND hdb.status = #{status}-->
|
|
|
|
|
<!-- </if>-->
|
|
|
|
|
<!-- <if test="search != null and search != ''">-->
|
|
|
|
|
<!-- AND hdb.name like concat(concat('%',#{search}),'%')-->
|
|
|
|
|
<!-- </if>-->
|
|
|
|
|
<!-- -- ORDER BY hdb.PC_END_TIME::timestamp DESC-->
|
|
|
|
|
<!-- ORDER BY-->
|
|
|
|
|
<!-- CASE-->
|
|
|
|
|
<!-- WHEN hdb.PC_END_TIME IS NULL THEN 1-->
|
|
|
|
|
<!-- ELSE 0-->
|
|
|
|
|
<!-- END, hdb.PC_END_TIME DESC-->
|
|
|
|
|
<!-- </select>-->
|
|
|
|
|
|
|
|
|
|
<select id="getHigDangerDealt" resultType="com.hisense.hiatmp.model.common.HighDangerBase">
|
|
|
|
|
<![CDATA[
|
|
|
|
|
SELECT CASE
|
|
|
|
|
WHEN now() AT TIME ZONE 'Asia/Shanghai' < t1.nearEndTime THEN 9 --正常
|
|
|
|
|
WHEN now() AT TIME ZONE 'Asia/Shanghai' >= t1.nearEndTime AND now() AT TIME ZONE 'Asia/Shanghai' <= t1.planEndTime THEN 2 --临期
|
|
|
|
|
WHEN now() AT TIME ZONE 'Asia/Shanghai' >= t1.planEndTime THEN 1 --超期
|
|
|
|
|
END AS time_status
|
|
|
|
|
, t1.*
|
|
|
|
|
-- , EXTRACT(EPOCH FROM NOW() - t1.planEndTime) AS timeDiffEnd
|
|
|
|
|
-- , EXTRACT(EPOCH FROM t1.planEndTime - NOW() ) AS timeDiffStart
|
|
|
|
|
, floor(EXTRACT(EPOCH FROM(now() AT TIME ZONE 'Asia/Shanghai' - planEndTime))/(1440*60)) delayDay
|
|
|
|
|
, ceil(mod(ceil(EXTRACT(EPOCH FROM(now() AT TIME ZONE 'Asia/Shanghai' -planEndTime)))::INTEGER , 1440*60)::FLOAT/3600) delayHour
|
|
|
|
|
, floor(EXTRACT(EPOCH FROM(planEndTime -now() AT TIME ZONE 'Asia/Shanghai'))/(1440*60)) nearDay
|
|
|
|
|
, ceil(mod(ceil(EXTRACT(EPOCH FROM(planEndTime -now() AT TIME ZONE 'Asia/Shanghai')))::INTEGER , 1440*60)::FLOAT/3600) nearHour
|
|
|
|
|
-- , now() - t1.planEndTime as timeDiffEnd
|
|
|
|
|
-- , now() - t1.nearEndTime as timeDiffStart
|
|
|
|
|
]]>
|
|
|
|
|
FROM (SELECT hdb.nid
|
|
|
|
|
, hdb.name
|
|
|
|
|
, hdb.pc_start_time
|
|
|
|
|
, hdb.pc_end_time
|
|
|
|
|
, hdb.business_id
|
|
|
|
|
, hdb."type"
|
|
|
|
|
, hdb."report_dept"
|
|
|
|
|
, hdb."operator"
|
|
|
|
|
, hdb.pc_count
|
|
|
|
|
, hdb."status"
|
|
|
|
|
, hdr.belong_xq
|
|
|
|
|
, hdr.xzjd
|
|
|
|
|
, et.enumname
|
|
|
|
|
, hdb.approve_status
|
|
|
|
|
, hdr.section_code
|
|
|
|
|
, COALESCE(hdb.pc_end_time, hdb.pc_start_time + INTERVAL '1 day' * tpc.param_value
|
|
|
|
|
::INTEGER) AS planEndTime
|
|
|
|
|
, COALESCE(hdb.pc_end_time, hdb.pc_start_time + INTERVAL '1 day' * tpc.param_value
|
|
|
|
|
::INTEGER) -
|
|
|
|
|
INTERVAL '3 day' AS nearEndTime
|
|
|
|
|
, bs.section_name
|
|
|
|
|
, bs.section_code
|
|
|
|
|
FROM tht_hidden_danger_base hdb
|
|
|
|
|
LEFT JOIN tht_hidden_danger_road hdr
|
|
|
|
|
ON hdb.business_id = hdr.business_id
|
|
|
|
|
AND hdb.pc_count = hdr.pc_count
|
|
|
|
|
LEFT JOIN department dp ON hdb.handle_dept = dp.cdepartmentid
|
|
|
|
|
LEFT JOIN enum_type et ON et.ENUMTYPEID = '6601'
|
|
|
|
|
AND et.enumvalue = hdb.status
|
|
|
|
|
LEFT JOIN bis_section bs ON hdr.section_code = bs.section_code
|
|
|
|
|
LEFT JOIN tht_param_config tpc ON tpc.param_code = 'THT_PC_ROAD_XT'
|
|
|
|
|
<if test="classification != ''">
|
|
|
|
|
LEFT JOIN tht_timeline tt ON tt.business_id = hdb.business_id
|
|
|
|
|
</if>
|
|
|
|
|
WHERE
|
|
|
|
|
hdb.status = #{status}
|
|
|
|
|
AND hdr.nid is not null
|
|
|
|
|
<if test="approve == 1">
|
|
|
|
|
AND COALESCE(hdb.approve_status,'0')IN('0','-1')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="approve == 2">
|
|
|
|
|
AND COALESCE(hdb.approve_status,'0') not IN('0','-1') AND hdb.approve_status is not null
|
|
|
|
|
</if>
|
|
|
|
|
<if test="cdepartmentid != null and cdepartmentid != ''">
|
|
|
|
|
AND hdr.belong_xq like concat(concat(#{cdepartmentid},'%'))
|
|
|
|
|
</if>
|
|
|
|
|
<if test="search != null and search != ''">
|
|
|
|
|
AND hdb.name like concat(concat('%',#{search}),'%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="classification == 1">
|
|
|
|
|
AND tt.operator = #{nuserId}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="classification == 2">
|
|
|
|
|
AND tt.title = '隐患上报'
|
|
|
|
|
AND tt.operator = #{nuserId}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="classification == 3">
|
|
|
|
|
AND tt.title != '隐患上报'
|
|
|
|
|
AND tt.operator = #{nuserId}
|
|
|
|
|
</if>
|
|
|
|
|
) t1
|
|
|
|
|
ORDER BY time_status, planEndTime DESC
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="getHigDangerDying" resultType="com.hisense.hiatmp.model.common.HighDangerBase">
|
|
|
|
|
SELECT
|
|
|
|
|
*
|
|
|
|
|
FROM
|
|
|
|
|
tht_hidden_danger_base hdb
|
|
|
|
|
LEFT JOIN tht_hidden_danger_road hdr ON hdb.business_id = hdr.business_id
|
|
|
|
|
AND hdb.pc_count = hdr.pc_count
|
|
|
|
|
LEFT JOIN department dp ON hdb.handle_dept = dp.cdepartmentid
|
|
|
|
|
LEFT JOIN enum_type et ON et.ENUMTYPEID = '6601'
|
|
|
|
|
AND et.enumvalue = hdb.status
|
|
|
|
|
WHERE
|
|
|
|
|
hdb.handle_dept = #{cdepartmentid}
|
|
|
|
|
AND TO_TIMESTAMP( hdb.pc_end_time, 'DD/MM/YYYY HH24:MI:SS' ) > CURRENT_TIMESTAMP - INTERVAL '3 days'
|
|
|
|
|
<if test="hdb.pc_end_time != null and hdb.pc_end_time != ''">
|
|
|
|
|
AND hdb.pc_end_time != ''
|
|
|
|
|
</if>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<select id="getHigDangerDetail" resultType="com.hisense.hiatmp.model.common.HighDangerBase">
|
|
|
|
|
SELECT DISTINCT hdb.*, hdr.coordinate, hdr.coordinate_type
|
|
|
|
|
FROM tht_hidden_danger_base hdb
|
|
|
|
|
left join tht_hidden_danger_road hdr on hdr.business_id = hdb.business_id
|
|
|
|
|
WHERE hdb.business_id = #{businessId}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="getHigDangerSearch" resultType="com.hisense.hiatmp.model.common.HighDangerBase">
|
|
|
|
|
SELECT *
|
|
|
|
|
FROM tht_hidden_danger_base hdb
|
|
|
|
|
WHERE hdb.name like #{search}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="getAllSection" parameterType="com.hisense.hiatmp.model.common.SectionVO"
|
|
|
|
|
resultType="com.hisense.hiatmp.model.common.SectionVO">
|
|
|
|
|
SELECT
|
|
|
|
|
section_code,
|
|
|
|
|
section_name,
|
|
|
|
|
road_code,
|
|
|
|
|
width,
|
|
|
|
|
length,
|
|
|
|
|
area_code,
|
|
|
|
|
position
|
|
|
|
|
FROM bis_section
|
|
|
|
|
where 1 = 1
|
|
|
|
|
<if test="search != null and search != ''">
|
|
|
|
|
AND section_name like concat(concat('%',#{search}),'%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="position != null and position != ''">
|
|
|
|
|
AND position like concat(concat('%',#{position}),'%')
|
|
|
|
|
</if>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="getAllCrossing" parameterType="com.hisense.hiatmp.model.common.CrossingDTO"
|
|
|
|
|
resultType="com.hisense.hiatmp.model.common.CrossingDTO">
|
|
|
|
|
SELECT
|
|
|
|
|
*
|
|
|
|
|
FROM bis_crossing
|
|
|
|
|
where 1 = 1
|
|
|
|
|
<if test="search != null and search != ''">
|
|
|
|
|
AND crossing_name like concat(concat('%',#{search}),'%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="lonMin != null">
|
|
|
|
|
AND longitude >= #{lonMin}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="lonMax != null">
|
|
|
|
|
AND longitude <= #{lonMax}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="latMin != null">
|
|
|
|
|
AND latitude >= #{latMin}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="latMax != null">
|
|
|
|
|
AND latitude <= #{latMax}
|
|
|
|
|
</if>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<select id="getRoadInfo" resultType="com.hisense.hiatmp.model.common.HighDangerRoad">
|
|
|
|
|
SELECT DISTINCT thdb.*, thdr.address, thdr.section_code, thdr.if_cross, thdr.coordinate
|
|
|
|
|
from tht_hidden_danger_base thdb
|
|
|
|
|
left join tht_hidden_danger_road thdr on thdr.business_id = thdb.business_id
|
|
|
|
|
where thdb.business_id = #{businessId}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="isRoadExist" resultType="int">
|
|
|
|
|
SELECT DISTINCT *
|
|
|
|
|
from tht_hidden_danger_road
|
|
|
|
|
where business_id = #{businessId}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<insert id="insertRoad">
|
|
|
|
|
insert into tht_hidden_danger_road (nid, business_id,last_mod_date)
|
|
|
|
|
values (#{uuid}, #{businessId},NOW())
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<select id="getImportDanger" resultType="com.hisense.hiatmp.model.common.ImportDangerDTO">
|
|
|
|
|
SELECT DISTINCT *
|
|
|
|
|
from tht_hidden_scenes;
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<!-- <update id="saveSection">-->
|
|
|
|
|
<!-- update tht_hidden_danger_road thdr-->
|
|
|
|
|
<!-- set-->
|
|
|
|
|
<!-- address = #{address},-->
|
|
|
|
|
<!-- coordinate = #{coordinate}-->
|
|
|
|
|
<!-- where business_id = #{businessId}-->
|
|
|
|
|
<!-- </update>-->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<update id="saveSection">
|
|
|
|
|
update tht_hidden_danger_road thdr
|
|
|
|
|
set address = #{address},
|
|
|
|
|
coordinate = #{coordinate},
|
|
|
|
|
last_mod_date = NOW()
|
|
|
|
|
where business_id = #{businessId}
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<update id="bindRoad">
|
|
|
|
|
update tht_hidden_danger_road
|
|
|
|
|
set section_code = #{sectionCode},
|
|
|
|
|
last_mod_date = NOW()
|
|
|
|
|
where business_id = #{businessId};
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<update id="saveCrossing">
|
|
|
|
|
update tht_hidden_danger_road thdr
|
|
|
|
|
set address = #{address},
|
|
|
|
|
coordinate = #{coordinate},
|
|
|
|
|
last_mod_date = NOW()
|
|
|
|
|
where business_id = #{businessId}
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<select id="getImportDangerInfo" resultType="com.hisense.hiatmp.model.common.ImportDangerInfoDTO">
|
|
|
|
|
SELECT C.nid,
|
|
|
|
|
C.itemid,
|
|
|
|
|
C.order,
|
|
|
|
|
C.type,
|
|
|
|
|
C.name,
|
|
|
|
|
C.standar,
|
|
|
|
|
C.unit
|
|
|
|
|
FROM tht_danger_item_relation rr
|
|
|
|
|
LEFT JOIN tht_hidden_data_collect_config C ON C.nid = rr.itemid
|
|
|
|
|
WHERE rr.dangerid = #{dangerId}
|
|
|
|
|
ORDER BY rr.ORDER
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="setApproval" resultType="String">
|
|
|
|
|
UPDATE tht_hidden_danger_base
|
|
|
|
|
SET APPROVE_STATUS = 2,last_mod_date = NOW()
|
|
|
|
|
where business_id = #{businessId} RETURNING business_id;
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="getSectionInfo" resultType="com.hisense.hiatmp.model.common.ThtSectionInfoDTO">
|
|
|
|
|
SELECT tsi.*
|
|
|
|
|
FROM tht_section_info tsi
|
|
|
|
|
LEFT JOIN tht_hidden_danger_road thdr ON tsi."BUSINESS_ID" = thdr.business_id
|
|
|
|
|
WHERE tsi."BUSINESS_ID" = #{businessId}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="getCommunityByRoad" resultType="com.hisense.hiatmp.server_api.model.StreetCommunity">
|
|
|
|
|
Select tsc.*
|
|
|
|
|
from tlv_street_community tsc
|
|
|
|
|
left join tht_hidden_danger_road thdr on thdr.belong_xq = tsc.xqcode and thdr.xzjd = tsc.jdcode
|
|
|
|
|
where business_id = #{businessId}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="getSectionTraffic" resultType="com.hisense.hiatmp.model.common.ThtSectionTrafficDTO">
|
|
|
|
|
SELECT *
|
|
|
|
|
FROM tht_section_traffic
|
|
|
|
|
where "BUSINESS_ID" = #{businessId}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="getDangerItems" resultType="com.hisense.hiatmp.model.common.ThtDangerItems">
|
|
|
|
|
SELECT DISTINCT *
|
|
|
|
|
FROM tht_danger_items
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="isExtraExistence" resultType="com.hisense.hiatmp.model.common.HiddenDangerDTO">
|
|
|
|
|
SELECT *
|
|
|
|
|
FROM tht_hidden_danger_road_info
|
|
|
|
|
where business_id = #{businessId}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<insert id="insertSectionInfo">
|
|
|
|
|
insert into tht_section_info
|
|
|
|
|
values (nextval('test_id_seq'),
|
|
|
|
|
#{businessId},
|
|
|
|
|
#{roadType},
|
|
|
|
|
#{roadWidth},
|
|
|
|
|
#{laneCount},
|
|
|
|
|
#{roadStructure},
|
|
|
|
|
#{sideProtec},
|
|
|
|
|
#{centerSeparate},
|
|
|
|
|
#{designSpeed},
|
|
|
|
|
#{limitSpeed})
|
|
|
|
|
RETURNING #{businessId};
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<update id="updateSectionInfo">
|
|
|
|
|
update tht_section_info
|
|
|
|
|
set "ROAD_TYPE" = #{roadType},
|
|
|
|
|
"ROAD_WIDTH" = #{roadWidth},
|
|
|
|
|
"LANE_COUNT" = #{laneCount},
|
|
|
|
|
"ROAD_STRUCTURE" = #{roadStructure},
|
|
|
|
|
"SIDE_PROTEC" = #{sideProtec},
|
|
|
|
|
"CENTER_SEPARATE" = #{centerSeparate},
|
|
|
|
|
"DESIGN_SPEED" = #{designSpeed},
|
|
|
|
|
"LIMIT_SPEED" = #{limitSpeed}
|
|
|
|
|
where "BUSINESS_ID" = #{businessId}
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<insert id="insertSectionTraffic">
|
|
|
|
|
insert into tht_section_traffic
|
|
|
|
|
values (nextval('test_id_seq1'),
|
|
|
|
|
#{businessId},
|
|
|
|
|
#{passingTrend},
|
|
|
|
|
#{maxTraffic},
|
|
|
|
|
#{peakTraffic},
|
|
|
|
|
#{peakHours},
|
|
|
|
|
#{normalTraffic},
|
|
|
|
|
#{largeVehicleRate},
|
|
|
|
|
#{nonvehicleTraffic},
|
|
|
|
|
#{lastModeUser},
|
|
|
|
|
#{lastModeDate}
|
|
|
|
|
)
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<update id="updateSectionTraffic">
|
|
|
|
|
update tht_section_traffic
|
|
|
|
|
set "PASSING_TREND" = #{passingTrend},
|
|
|
|
|
"MAX_TRAFFIC" = #{maxTraffic},
|
|
|
|
|
"PEAK_TRAFFIC" = #{peakTraffic},
|
|
|
|
|
"PEAK_HOURS" = #{peakHours},
|
|
|
|
|
"NORMAL_TRAFFIC" = #{normalTraffic},
|
|
|
|
|
"LARGE_VEHICLE_RATE" = #{largeVehicleRate},
|
|
|
|
|
"NONVEHICLE_TRAFFIC" = #{nonvehicleTraffic},
|
|
|
|
|
"LAST_MOD_USER" = #{lastModeUser},
|
|
|
|
|
"LAST_MOD_DATE" = NOW()
|
|
|
|
|
where "BUSINESS_ID" = #{businessId}
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<update id="updateTemporary">
|
|
|
|
|
update tht_hidden_danger_base set
|
|
|
|
|
last_mod_date = NOW(), approve_status = '1'
|
|
|
|
|
where business_id = #{businessId}
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<update id="updateDangerRoad">
|
|
|
|
|
update tht_hidden_danger_road
|
|
|
|
|
set hd_flag = #{hdFlag}
|
|
|
|
|
, pc_end_time = CURRENT_TIMESTAMP,last_mod_date = NOW()
|
|
|
|
|
where business_id = #{businessId}
|
|
|
|
|
and pc_count = #{pcCount}
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<insert id="saveHiddenDataCollectConfig">
|
|
|
|
|
INSERT INTO tht_hidden_data_collect_config_extra (nid, itemid, "order", type, name, standar, unit, business_id)
|
|
|
|
|
VALUES (nextval('test_id_seq2'), #{itemid}, #{order}, #{type}, #{name}, #{standar}, #{unit}, #{businessId})
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<insert id="saveDangerExtra">
|
|
|
|
|
INSERT INTO tht_hidden_danger_road_info (nid, business_id, big_category, small_category, hd_term, hd_desc,
|
|
|
|
|
pc_count, hd_pic, hd_info, pc_type, last_mod_date)
|
|
|
|
|
VALUES (#{nid}, #{businessId}, #{bigCategory}, #{smallCategory}, #{hdTerm},
|
|
|
|
|
#{hdDesc}, #{pcCount}, #{hdPic}, #{hdInfo}, #{pcType},NOW())
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<insert id="saveRoad">
|
|
|
|
|
insert into bis_road ("road_code", "road_name", "position","last_mod_date")
|
|
|
|
|
values (#{roadCode}, #{roadName}, #{position},NOW())
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<delete id="deleteRoadInfo">
|
|
|
|
|
delete
|
|
|
|
|
from tht_hidden_danger_road_info
|
|
|
|
|
where business_id = #{businessId}
|
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
<delete id="deleteThtHiddenDataCollectConfigExtra">
|
|
|
|
|
delete
|
|
|
|
|
from tht_hidden_data_collect_config_extra
|
|
|
|
|
where business_id = #{businessId}
|
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
<insert id="saveThtHiddenDataCollectConfigExtra">
|
|
|
|
|
insert into tht_hidden_data_collect_config_extra
|
|
|
|
|
("nid", "itemid", "order", "type", "name", "standar", "unit", "business_id", "scenes_id", "pc_count",
|
|
|
|
|
"danger_id")
|
|
|
|
|
values (nextval('test_id_seq2'), #{itemid}, #{order}, #{type}, #{name}, #{standar}, #{unit}, #{businessId},
|
|
|
|
|
#{scenesId}, #{pcCount}, #{dangerId})
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<select id="getImportDangerDisplay" resultType="com.hisense.hiatmp.model.common.ThtHiddenDataCollectConfigExtra">
|
|
|
|
|
select * from tht_hidden_data_collect_config_extra where business_id = #{businessId}
|
|
|
|
|
<if test="dangerId != null">
|
|
|
|
|
and danger_id = #{dangerId}
|
|
|
|
|
</if>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="getImportDangerDisplayItem" resultType="com.hisense.hiatmp.model.common.ImportDangerDTO">
|
|
|
|
|
SELECT DISTINCT s.*
|
|
|
|
|
FROM tht_hidden_data_collect_config_extra e
|
|
|
|
|
INNER JOIN tht_hidden_scenes s ON e.scenes_id = s.nid
|
|
|
|
|
where e.business_id = #{businessId}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="getImportDangerItems" resultType="com.hisense.hiatmp.model.common.ThtDangerItems">
|
|
|
|
|
select DISTINCT r.*, i.*
|
|
|
|
|
from tht_scenes_danger_relation r
|
|
|
|
|
left join tht_danger_items i on r.dangerid = i.id
|
|
|
|
|
where r.scenesid = #{nid}
|
|
|
|
|
order by r.order
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="getUserHiddenDangerList" resultType="com.hisense.hiatmp.model.common.HiddenDangerDTO">
|
|
|
|
|
SELECT
|
|
|
|
|
*
|
|
|
|
|
FROM
|
|
|
|
|
tht_hidden_danger_road_info
|
|
|
|
|
where
|
|
|
|
|
business_id = #{businessId}
|
|
|
|
|
and
|
|
|
|
|
pc_type = #{pcType}
|
|
|
|
|
<if test="hdTerm != null and hdTerm != ''">
|
|
|
|
|
AND hd_term = #{hdTerm}
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="getDangerProblem" resultType="String">
|
|
|
|
|
SELECT DISTINCT itemname
|
|
|
|
|
FROM tht_danger_items
|
|
|
|
|
where id = #{id}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<update id="HighDangerSaveStatus">
|
|
|
|
|
update tht_hidden_danger_road
|
|
|
|
|
set pc_type = #{pcType},last_mod_date = NOW()
|
|
|
|
|
where business_id = #{businessId}
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<update id="updateSectionCommunity">
|
|
|
|
|
update tht_hidden_danger_road
|
|
|
|
|
set belong_xq = #{xqcode},
|
|
|
|
|
xzjd = #{jdcode},
|
|
|
|
|
last_mod_date = NOW()
|
|
|
|
|
where business_id = #{businessId}
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<select id="getRoadTypes" resultType="com.hisense.hiatmp.model.common.EnumRoadType">
|
|
|
|
|
select *
|
|
|
|
|
from bis_enum_type
|
|
|
|
|
where enumtype_id = '303'
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="getSectionByCode" resultType="com.hisense.hiatmp.model.common.SectionVO">
|
|
|
|
|
select *
|
|
|
|
|
from bis_section
|
|
|
|
|
where section_code = #{sectionCode}
|
|
|
|
|
</select>
|
|
|
|
|
</mapper>
|