消防安全管理对接代码

pull/14/head
songwenxuan 2023-12-22 08:42:44 +08:00
parent 4568e46388
commit 61c7075d4c
1 changed files with 472 additions and 0 deletions

View File

@ -0,0 +1,472 @@
<?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.zcloud.mapper.dsno2.fireresources.FireResourcesMapper">
<!--表名 -->
<sql id="tableName">
bus_fireresources
</sql>
<!-- 字段 -->
<sql id="Field">
FIRERESOURCES_ID,
FIRERESOURCES_NAME,
FIRERESOURCES_TYPE,
LONGTITUDE,
LATITUDE,
DESCR,
CREATIME,
OPERATIME,
ISDELETE,
CORPINFO_ID,
STATE
</sql>
<!-- 字段值 -->
<sql id="FieldValue">
#{FIRERESOURCES_ID},
#{FIRERESOURCES_NAME},
#{FIRERESOURCES_TYPE},
#{LONGTITUDE},
#{LATITUDE},
#{DESCR},
#{CREATIME},
#{OPERATIME},
#{ISDELETE},
#{CORPINFO_ID},
#{STATE}
</sql>
<!-- 新增-->
<insert id="save" parameterType="pd">
insert into
<include refid="tableName"></include>
(
<include refid="Field"></include>
) values (
<include refid="FieldValue"></include>
)
</insert>
<!-- 删除-->
<delete id="delete" parameterType="pd">
update
<include refid="tableName"></include>
set ISDELETE = '1'
where
FIRERESOURCES_ID = #{FIRERESOURCES_ID}
</delete>
<!-- 修改 -->
<update id="edit" parameterType="pd">
update
<include refid="tableName"></include>
set
FIRERESOURCES_NAME = #{FIRERESOURCES_NAME},
FIRERESOURCES_TYPE = #{FIRERESOURCES_TYPE},
LONGTITUDE = #{LONGTITUDE},
LATITUDE = #{LATITUDE},
DESCR = #{DESCR},
OPERATIME = #{OPERATIME},
ISDELETE = #{ISDELETE},
CORPINFO_ID = #{CORPINFO_ID},
STATE = #{STATE}
where
FIRERESOURCES_ID = #{FIRERESOURCES_ID}
</update>
<!-- 通过ID获取数据 -->
<select id="findById" parameterType="pd" resultType="pd">
select
f.*
from
<include refid="tableName"></include> f
where
FIRERESOURCES_ID = #{FIRERESOURCES_ID}
</select>
<!-- 列表 -->
<select id="datalistPage" parameterType="page" resultType="pd">
select
f.*,
c.CORP_NAME,
sd1.NAME as FIRERESOURCES_TYPENAME
from
<include refid="tableName"></include> f
left join `qa-czks-prevention`.sys_dictionaries sd1 on sd1.BIANMA = f.FIRERESOURCES_TYPE
left join `qa-czks-prevention`.bus_corp_info c on c.CORPINFO_ID = f.CORPINFO_ID
where
f.ISDELETE = '0'
<if test="pd.FIRERESOURCES_NAME != null and pd.FIRERESOURCES_NAME != ''">
and ( f.FIRERESOURCES_NAME LIKE CONCAT(CONCAT('%', #{pd.FIRERESOURCES_NAME}),'%') )
</if>
<if test="pd.FIRERESOURCES_TYPE != null and pd.FIRERESOURCES_TYPE != ''">
and f.FIRERESOURCES_TYPE = #{pd.FIRERESOURCES_TYPE}
</if>
<if test="pd.CORPINFO_ID != null and pd.CORPINFO_ID != ''">
and f.CORPINFO_ID = #{pd.CORPINFO_ID}
</if>
order by f.CREATIME desc
</select>
<!-- 列表(全部) -->
<select id="listAll" parameterType="pd" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include>
</select>
<select id="getControlRoomDataList" resultType="com.zcloud.entity.PageData">
SELECT
FIRERESOURCES_ID id,
FIRERESOURCES_NAME NAME,
d.BIANMA TYPE,
LONGTITUDE LONGITUDE,
LATITUDE,
DESCR,
'./bi/images/map/xiaofang/contro.png' IMAGE_FILE
FROM
bus_fireresources f
LEFT JOIN `qa-czks-prevention`.sys_dictionaries d ON f.FIRERESOURCES_TYPE = d.BIANMA
WHERE
f.ISDELETE = 0
AND f.FIRERESOURCES_TYPE = 'xfkzs01'
<if test="CORPINFO_ID != null and CORPINFO_ID != ''">
AND f.CORPINFO_ID = #{CORPINFO_ID}
</if>
<if test="list != null and list.size() > 0">
AND f.CORPINFO_ID in
<foreach collection="list" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</select>
<select id="getPumpRoomDataList" resultType="com.zcloud.entity.PageData">
SELECT
FIRERESOURCES_ID id,
FIRERESOURCES_NAME NAME,
d.BIANMA TYPE,
LONGTITUDE LONGITUDE,
LATITUDE,
DESCR,
'./bi/images/map/xiaofang/pumpRoom.png' IMAGE_FILE
FROM
bus_fireresources f
LEFT JOIN `qa-czks-prevention`.sys_dictionaries d ON f.FIRERESOURCES_TYPE = d.BIANMA
WHERE
f.ISDELETE = 0
AND f.FIRERESOURCES_TYPE = 'xfbf01'
<if test="CORPINFO_ID != null and CORPINFO_ID != ''">
AND f.CORPINFO_ID = #{CORPINFO_ID}
</if>
<if test="list != null and list.size() > 0">
AND f.CORPINFO_ID in
<foreach collection="list" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</select>
<select id="getRescueTeamDataList" resultType="com.zcloud.entity.PageData">
SELECT
FIRERESOURCES_ID id,
FIRERESOURCES_NAME NAME,
d.BIANMA TYPE,
LONGTITUDE LONGITUDE,
LATITUDE,
DESCR,
'./bi/images/map/xiaofang/rescueTeam.png' IMAGE_FILE
FROM
bus_fireresources f
LEFT JOIN `qa-czks-prevention`.sys_dictionaries d ON f.FIRERESOURCES_TYPE = d.BIANMA
WHERE
f.ISDELETE = 0
AND f.FIRERESOURCES_TYPE = 'xfjyd01'
<if test="CORPINFO_ID != null and CORPINFO_ID != ''">
AND f.CORPINFO_ID = #{CORPINFO_ID}
</if>
<if test="list != null and list.size() > 0">
AND f.CORPINFO_ID in
<foreach collection="list" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</select>
<select id="getWaterSourceDataList" resultType="com.zcloud.entity.PageData">
SELECT
FIRERESOURCES_ID id,
FIRERESOURCES_NAME NAME,
d.BIANMA TYPE,
LONGTITUDE LONGITUDE,
LATITUDE,
DESCR,
'./bi/images/map/xiaofang/waterSource.png' IMAGE_FILE
FROM
bus_fireresources f
LEFT JOIN `qa-czks-prevention`.sys_dictionaries d ON f.FIRERESOURCES_TYPE = d.BIANMA
WHERE
f.ISDELETE = 0
AND f.FIRERESOURCES_TYPE = 'xfsy01'
<if test="CORPINFO_ID != null and CORPINFO_ID != ''">
AND f.CORPINFO_ID = #{CORPINFO_ID}
</if>
<if test="list != null and list.size() > 0">
AND f.CORPINFO_ID in
<foreach collection="list" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</select>
<select id="getPointDataList" resultType="com.zcloud.entity.PageData">
SELECT
FIRE_POINT_ID id,
FIRE_POINT_NAME NAME,
'point' TYPE,
LONGITUDE,
LATITUDE
FROM
`qa-czks-prevention`.bus_fire_point f
WHERE
f.ISDELETE = 0
<if test="CORPINFO_ID != null and CORPINFO_ID != ''">
AND f.CORPINFO_ID = #{CORPINFO_ID}
</if>
<if test="list != null and list.size() > 0">
AND f.CORPINFO_ID in
<foreach collection="list" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</select>
<select id="getDataById" resultType="com.zcloud.entity.PageData">
SELECT
f.*,
c.CORP_NAME
FROM
bus_fireresources f
left join `qa-czks-prevention`.bus_corp_info c on f.CORPINFO_ID = c.CORPINFO_ID
where f.ISDELETE = 0
and f.FIRERESOURCES_ID = #{FIRERESOURCES_ID}
</select>
<select id="getCheckRecordByPid" resultType="pd">
SELECT
frp.EQUIPMENT_POINT_ID,
fc.FIRE_CHECK_STANDARD_NAME,
fc.FIRE_CHECK_TYPE,
u.`NAME` USERNAME,
dep.`NAME` deptName,
d.`NAME` dicName,
fpp.FIRE_CHECK_ID,
fr.FIRE_RECORD_ID,
fp.FIRE_POINT_NAME,
reg.FIRE_REGION_NAME,
fpp.FIRE_POINT_ID,
fr.CHECK_TIME,
fr.PERIODSTART,
fr.PERIODEND
FROM
`qa-czks-prevention`.bus_fire_record fr
LEFT JOIN `qa-czks-prevention`.bus_fire_point_prepared fpp ON fr.FIRE_CHECK_ID = fpp.FIRE_CHECK_ID
LEFT JOIN `qa-czks-prevention`.bus_fire_checklist fc ON fpp.FIRE_CHECK_ID = fc.FIRE_CHECK_ID
LEFT JOIN `qa-czks-prevention`.sys_dictionaries d ON fc.FIRE_CHECK_TYPE = d.BIANMA
LEFT JOIN `qa-czks-prevention`.sys_user u ON fc.USER_ID = u.USER_ID
LEFT JOIN `qa-czks-prevention`.bus_fire_point fp ON fp.FIRE_POINT_ID = fpp.FIRE_POINT_ID
LEFT JOIN `qa-czks-prevention`.bus_fire_region reg ON reg.FIRE_REGION_ID = fp.FIRE_REGION_ID
LEFT JOIN `qa-czks-prevention`.oa_department dep ON dep.DEPARTMENT_ID = fc.DEPARTMENT_ID
LEFT JOIN `qa-czks-prevention`.bus_fire_record_point frp ON fr.FIRE_RECORD_ID = frp.FIRE_RECORD_ID AND fp.FIRE_POINT_ID = frp.FIRE_POINT_ID
WHERE
fr.FINISHED = 1
and fc.ISDELETE = 0
and frp.ISDELETE = 0
<if test="FIRE_POINT_ID != null and FIRE_POINT_ID != ''" >
AND fpp.FIRE_POINT_ID = #{FIRE_POINT_ID}
</if>
<if test="KEYWORDS != null and KEYWORDS != ''" >
AND fc.FIRE_CHECK_STANDARD_NAME like concat('%',concat(#{KEYWORDS},'%'))
</if>
GROUP BY
fr.FIRE_CHECK_ID,
fr.FIRE_RECORD_ID
ORDER BY
fr.OPERATTIME DESC
</select>
<select id="findPointById" resultType="com.zcloud.entity.PageData">
SELECT
p.FIRE_POINT_ID,
p.FIRE_POINT_NAME,
p.FIRE_POINT_CODE,
p.QUALIFIED_PHOTOS_ID,
p.LONGITUDE,
p.LATITUDE,
CONCAT_WS('--', p.LATITUDE,p.LONGITUDE) LONGTITUDEANDLATITUDE,
r.FIRE_REGION_ID,
d.`NAME` AS DEPARTMENT_NAME,
u.`NAME` AS USERNAME,
r.FIRE_REGION_NAME,
u.USER_ID,
p.DEPARTMENT_ID
FROM
`qa-czks-prevention`.bus_fire_point AS p
left JOIN `qa-czks-prevention`.bus_fire_region AS r ON p.FIRE_REGION_ID = r.FIRE_REGION_ID
LEFT JOIN `qa-czks-prevention`.sys_user AS u ON p.USER_ID = u.USER_ID
left JOIN `qa-czks-prevention`.oa_department AS d ON p.DEPARTMENT_ID = d.DEPARTMENT_ID
WHERE
r.ISDELETE = 0 AND p.ISDELETE = 0
<if test="CORPINFO_ID != null and CORPINFO_ID != ''">
AND r.CORPINFO_ID = #{CORPINFO_ID}
</if>
<if test="FIRE_POINT_ID != null and FIRE_POINT_ID != ''">
AND FIRE_POINT_ID = #{FIRE_POINT_ID}
</if>
</select>
<select id="listAll4H5" resultType="com.zcloud.entity.PageData">
SELECT fp.USER_ID,
fp.DEPARTMENT_ID,
fp.FIRE_POINT_NAME,
fp.FIRE_POINT_CODE,
fp.FIRE_POINT_ID,
fr.FIRE_REGION_NAME,
fr.FIRE_REGION_ID,
fd.FIRE_DEVICE_CODE,
fd.FIRE_DEVICE_TYPE_ID,
fd.VALIDITY_START_TIME,
fd.VALIDITY_END_TIME,
fd.REMAKE,
fd.FIRE_DEVICE_ID,
su.`NAME` AS USERNAME,
d.`NAME` AS DEPARTMENTNAME,
`qa-czks-prevention`.sys_dictionaries.`NAME` AS FIRE_DEVICE_TYPE_NAME,
GROUP_CONCAT(DISTINCT FIRE_CHECK_STANDARD_ITEM ORDER BY FIRE_CHECK_STANDARD_ITEM SEPARATOR '@@' ) FIRE_CHECK_STANDARD_ITEM
FROM `qa-czks-prevention`.bus_fire_point AS fp
LEFT JOIN `qa-czks-prevention`.bus_fire_device AS fd ON fp.FIRE_POINT_ID = fd.FIRE_POINT_ID
LEFT JOIN `qa-czks-prevention`.bus_fire_region AS fr ON fd.FIRE_REGION_ID = fr.FIRE_REGION_ID
LEFT JOIN `qa-czks-prevention`.sys_user AS su ON fp.USER_ID = su.USER_ID
LEFT JOIN `qa-czks-prevention`.oa_department AS d ON fd.DEPARTMENT_ID = d.DEPARTMENT_ID
LEFT JOIN `qa-czks-prevention`.sys_dictionaries ON fd.FIRE_DEVICE_TYPE_ID = sys_dictionaries.BIANMA
LEFT JOIN `qa-czks-prevention`.bus_fire_check_standard fcs on fd.FIRE_DEVICE_TYPE_ID = fcs.FIRE_DEVICE_TYPE
WHERE fp.ISDELETE = 0
AND fd.ISDELETE = 0
and fcs.ISDELETE = 0
AND fp.FIRE_POINT_ID = #{FIRE_POINT_ID}
GROUP BY fd.FIRE_DEVICE_CODE
ORDER BY fr.FIRE_REGION_ID,
fr.CREATTIME,
fp.FIRE_POINT_ID,
fp.CREATTIME,
fd.FIRE_DEVICE_TYPE_ID,
fd.CREATTIME,
fd.OPERATTIME DESC
</select>
<select id="getPointQualifiedPhotosByEpid" resultType="com.zcloud.entity.PageData">
SELECT
img.*
FROM
`qa-czks-prevention`.bus_imgfiles img
LEFT JOIN `qa-czks-prevention`.`qa-czks-prevention`.bus_fire_record_point p ON p.QUALIFIED_PHOTOS_ID = img.FOREIGN_KEY
WHERE
img.TYPE = 115
and p.EQUIPMENT_POINT_ID = #{EQUIPMENT_POINT_ID}
</select>
<select id="getPointQualifiedPhotos" resultType="com.zcloud.entity.PageData">
SELECT
img.*
FROM
`qa-czks-prevention`.bus_imgfiles img
LEFT JOIN `qa-czks-prevention`.bus_fire_point p ON p.QUALIFIED_PHOTOS_ID = img.FOREIGN_KEY
WHERE
img.TYPE = 115
and p.FIRE_POINT_ID = #{FIRE_POINT_ID}
</select>
<select id="goRecordDeviceByPid" resultType="com.zcloud.entity.PageData">
SELECT
frd.EQUIPMENT_RECORD_ID,
frd.ISNORMAL,
IFNULL( frd.HIDDEN_ID, '' ) HIDDEN_ID,
frd.FIRE_RECORD_ID,
fp.FIRE_POINT_ID,
fp.FIRE_POINT_NAME,
fr.FIRE_REGION_ID,
fr.FIRE_REGION_NAME,
frp.P_ISCHECKED ISCHECKED,
GROUP_CONCAT( DISTINCT d.NAME ) dicName,
GROUP_CONCAT( DISTINCT fd.FIRE_DEVICE_CODE ) FIRE_DEVICE_CODE,
GROUP_CONCAT( DISTINCT fd.FIRE_DEVICE_TYPE_ID ) FIRE_DEVICE_TYPE_ID,
GROUP_CONCAT( DISTINCT fcs.FIRE_CHECK_STANDARD_ITEM ORDER BY FIRE_CHECK_STANDARD_ITEM desc SEPARATOR '@@' ) FIRE_CHECK_STANDARD_ITEM
FROM
bus_fire_record_device frd
LEFT JOIN bus_fire_device fd ON frd.FIRE_DEVICE_ID = fd.FIRE_DEVICE_ID
LEFT JOIN sys_dictionaries d ON fd.FIRE_DEVICE_TYPE_ID = d.BIANMA
LEFT JOIN bus_fire_point fp ON fd.FIRE_POINT_ID = fp.FIRE_POINT_ID
LEFT JOIN bus_fire_record_point frp ON frp.FIRE_POINT_ID = fp.FIRE_POINT_ID
AND frd.FIRE_RECORD_ID = frp.FIRE_RECORD_ID
LEFT JOIN bus_fire_region fr ON fp.FIRE_REGION_ID = fr.FIRE_REGION_ID
LEFT JOIN bus_fire_check_standard fcs ON fd.FIRE_DEVICE_TYPE_ID = fcs.FIRE_DEVICE_TYPE
AND fcs.ISDELETE = 0
where frd.FIRE_RECORD_ID = #{FIRE_RECORD_ID} and fp.FIRE_POINT_ID = #{FIRE_POINT_ID}
GROUP BY
frd.FIRE_RECORD_ID,
fd.FIRE_DEVICE_ID
ORDER BY fd.FIRE_DEVICE_CODE
</select>
<select id="devicelistPage" resultType="com.zcloud.entity.PageData">
SELECT
d.FIRE_POINT_ID,
p.FIRE_POINT_NAME,
FIRE_DEVICE_TYPE_ID,
dic.`NAME` FIRE_DEVICE_TYPE_NAME,
COUNT( 1 ) COUNT
FROM
`qa-czks-prevention`.bus_fire_device d
LEFT JOIN `qa-czks-prevention`.bus_fire_point p ON d.FIRE_POINT_ID = p.FIRE_POINT_ID
LEFT JOIN `qa-czks-prevention`.sys_dictionaries dic ON d.FIRE_DEVICE_TYPE_ID = dic.BIANMA
WHERE
d.ISDELETE = 0 and p.isdelete = 0
<if test="pd.FIRE_DEVICE_TYPE_ID != null and pd.FIRE_DEVICE_TYPE_ID != ''">
and d.FIRE_DEVICE_TYPE_ID = #{pd.FIRE_DEVICE_TYPE_ID}
</if>
<if test="pd.FIRE_POINT_NAME != null and pd.FIRE_POINT_NAME != ''">
and p.FIRE_POINT_NAME like concat('%',concat(#{pd.FIRE_POINT_NAME},'%'))
</if>
<if test="pd.CORPINFO_ID != null and pd.CORPINFO_ID != ''">
and d.CORPINFO_ID = #{pd.CORPINFO_ID}
</if>
<if test="pd.AREA != null and pd.AREA != ''">
and d.CORPINFO_ID IN (select CORPINFO_ID from `qa-czks-prevention`.bus_corp_info where AREA = #{pd.AREA} and ISDELETE = 0)
</if>
GROUP BY
d.FIRE_POINT_ID,
d.FIRE_DEVICE_TYPE_ID
ORDER BY
d.CREATTIME DESC
</select>
<select id="getPointCheckPhotoById" resultType="com.zcloud.entity.PageData">
SELECT
GROUP_CONCAT( img.FILEPATH SEPARATOR '@@' ) FILEPATHLIST,
u.`NAME` CREATOR_NAME,
cl.FIRE_CHECK_ID,
cl.FIRE_CHECK_STANDARD_NAME,
frp.EQUIPMENT_POINT_ID,
frp.FIRE_POINT_ID,
frp.FIRE_RECORD_ID,
frp.CREATTIME
FROM
`qa-czks-prevention`.bus_fire_checklist cl
LEFT JOIN `qa-czks-prevention`.bus_fire_record_point frp ON frp.fire_check_id = cl.fire_check_id
AND cl.ISDELETE = 0
LEFT JOIN `qa-czks-prevention`.bus_imgfiles img ON frp.EQUIPMENT_POINT_ID = img.FOREIGN_KEY
LEFT JOIN `qa-czks-prevention`.sys_user u on frp.CREATOR = u.USER_ID
WHERE
frp.ISDELETE = 0
AND frp.FIRE_POINT_ID = #{FIRE_POINT_ID}
AND frp.P_ISCHECKED = 0
GROUP BY
cl.FIRE_CHECK_ID
ORDER BY
frp.CREATTIME DESC
limit 1
</select>
</mapper>