487 lines
20 KiB
XML
487 lines
20 KiB
XML
<?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.datasource.firemanager.FireCheckListMapper">
|
|
<insert id="saveInfo">
|
|
INSERT INTO bus_fire_checklist
|
|
(`FIRE_CHECK_ID`, `FIRE_CHECK_STANDARD_NAME`, `FIRE_CHECK_TYPE`,
|
|
`CORPINFO_ID`, `DEPARTMENT_ID`, USER_ID,
|
|
`CREATOR`, `CREATTIME`, `OPERATOR`, `OPERATTIME`)
|
|
VALUES (#{FIRE_CHECK_ID}, #{FIRE_CHECK_STANDARD_NAME}, #{FIRE_CHECK_TYPE},
|
|
#{CORPINFO_ID}, #{DEPARTMENT_ID}, #{USER_ID},
|
|
#{CREATOR}, #{CREATTIME}, #{OPERATOR}, #{OPERATTIME})
|
|
</insert>
|
|
<update id="updById" parameterType="pd">
|
|
UPDATE bus_fire_checklist
|
|
SET FIRE_CHECK_STANDARD_NAME = #{FIRE_CHECK_STANDARD_NAME},
|
|
FIRE_CHECK_TYPE = #{FIRE_CHECK_TYPE},
|
|
CORPINFO_ID = #{CORPINFO_ID},
|
|
STATE = #{STATE},
|
|
CHECKLISTTYPE = #{CHECKLISTTYPE},
|
|
DEPARTMENT_ID = #{DEPARTMENT_ID},
|
|
OPERATOR = #{OPERATOR},
|
|
OPERATTIME = #{OPERATTIME}
|
|
WHERE FIRE_CHECK_ID = #{FIRE_CHECK_ID}
|
|
</update>
|
|
<update id="upd4PcById" parameterType="pd">
|
|
UPDATE bus_fire_checklist
|
|
SET FIRE_CHECK_STANDARD_NAME = #{FIRE_CHECK_STANDARD_NAME},
|
|
FIRE_CHECK_TYPE = #{FIRE_CHECK_TYPE},
|
|
OPERATOR = #{OPERATOR},
|
|
OPERATTIME = #{OPERATTIME}
|
|
<if test="DEPARTMENT_ID != null and DEPARTMENT_ID != ''">
|
|
,DEPARTMENT_ID = #{DEPARTMENT_ID}
|
|
</if>
|
|
<if test="USER_ID != null and USER_ID != ''">
|
|
,USER_ID = #{USER_ID}
|
|
</if>
|
|
WHERE FIRE_CHECK_ID = #{FIRE_CHECK_ID}
|
|
</update>
|
|
<update id="delByIds" parameterType="pd">
|
|
UPDATE bus_fire_checklist
|
|
SET ISDELETE = 1
|
|
WHERE FIRE_CHECK_ID in
|
|
<foreach item="item" index="index" collection="array" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
</update>
|
|
|
|
<update id="openCheck" parameterType="pd">
|
|
UPDATE bus_fire_checklist
|
|
SET `STATE` = 0
|
|
WHERE `FIRE_CHECK_ID` = #{FIRE_CHECK_ID}
|
|
</update>
|
|
|
|
<update id="closeCheck">
|
|
UPDATE bus_fire_checklist
|
|
SET `STATE` = 1
|
|
WHERE `FIRE_CHECK_ID` = #{FIRE_CHECK_ID}
|
|
</update>
|
|
<update id="setDelStateByIds">
|
|
UPDATE bus_fire_checklist
|
|
SET STATE = 2
|
|
WHERE FIRE_CHECK_ID in
|
|
<foreach item="item" index="index" collection="array" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
</update>
|
|
|
|
<select id="datalistPage" parameterType="pd" resultType="com.zcloud.entity.PageData">
|
|
SELECT
|
|
cl.FIRE_CHECK_STANDARD_NAME,
|
|
cl.FIRE_CHECK_TYPE AS FIRE_CHECK_TYPE_ID,
|
|
IFNULL( FINISHED, 0 ) FINISHED,
|
|
d.`NAME` AS DEPARTMENTNAME,
|
|
su.`NAME` AS USERNAME,
|
|
cl.STATE,
|
|
sys_dictionaries.`NAME` AS FIRE_CHECK_TYPE,
|
|
cl.FIRE_CHECK_ID,
|
|
ifnull(tt.CHECK_NUM,0) CHECK_NUM
|
|
FROM
|
|
bus_fire_checklist AS cl
|
|
left JOIN oa_department AS d ON cl.DEPARTMENT_ID = d.DEPARTMENT_ID
|
|
LEFT JOIN (
|
|
SELECT
|
|
FIRE_CHECK_ID,
|
|
COUNT(if(FINISHED = 0 ,null,FINISHED)) FINISHED
|
|
FROM
|
|
bus_fire_record
|
|
WHERE
|
|
#{pd.CYCLETIME} BETWEEN PERIODSTART
|
|
AND PERIODEND
|
|
AND ISDELETE = 0
|
|
AND CORPINFO_ID = #{pd.CORPINFO_ID}
|
|
GROUP BY FIRE_CHECK_ID,PERIODSTART,PERIODEND ) AS t ON cl.FIRE_CHECK_ID = t.FIRE_CHECK_ID
|
|
LEFT JOIN sys_user AS su ON cl.USER_ID = su.USER_ID
|
|
LEFT JOIN sys_dictionaries ON cl.FIRE_CHECK_TYPE = sys_dictionaries.BIANMA
|
|
LEFT JOIN (SELECT FIRE_CHECK_ID, count(1) CHECK_NUM from bus_fire_record GROUP BY FIRE_CHECK_ID ) tt on cl.FIRE_CHECK_ID = tt.FIRE_CHECK_ID
|
|
where cl.ISDELETE = 0 and cl.STATE != 2
|
|
<if test="pd.FIRE_CHECK_STANDARD_NAME != null and pd.FIRE_CHECK_STANDARD_NAME != ''">
|
|
and cl.FIRE_CHECK_STANDARD_NAME LIKE CONCAT(#{pd.FIRE_CHECK_STANDARD_NAME},'%')
|
|
</if>
|
|
<if test="pd.roleLevel != null and pd.roleLevel != ''"><!-- 权限显示 -->
|
|
<choose>
|
|
<!--公司领导-->
|
|
<when test='pd.roleLevel == "0"'>
|
|
and cl.CORPINFO_ID = #{pd.CORPINFO_ID}
|
|
</when>
|
|
<when test='pd.roleLevel == "1"'>
|
|
and cl.DEPARTMENT_ID in (${pd.supDeparIds})
|
|
</when>
|
|
<when test='pd.roleLevel == "2"'>
|
|
<if test="pd.DEPARTMENT_ID != null and pd.DEPARTMENT_ID != ''">
|
|
AND cl.DEPARTMENT_ID = #{pd.DEPARTMENT_ID}
|
|
</if>
|
|
<if test="pd.CORPINFO_ID != null and pd.CORPINFO_ID != ''">
|
|
and cl.CORPINFO_ID = #{pd.CORPINFO_ID}
|
|
</if>
|
|
<if test="pd.USER_ID != null and pd.USER_ID != ''">
|
|
AND cl.USER_ID = #{pd.USER_ID}
|
|
</if>
|
|
</when>
|
|
</choose>
|
|
</if>
|
|
<if test="pd.DEPARTMENT_ID != null and pd.DEPARTMENT_ID != ''">
|
|
AND cl.DEPARTMENT_ID = #{pd.DEPARTMENT_ID}
|
|
</if>
|
|
<if test="pd.USERNAME != null and pd.USERNAME != ''">AND su.NAME like CONCAT(#{pd.USERNAME},'%')</if>
|
|
<if test="pd.FIRE_CHECK_TYPE != null and pd.FIRE_CHECK_TYPE != ''">
|
|
AND cl.FIRE_CHECK_TYPE = #{pd.FIRE_CHECK_TYPE}
|
|
</if>
|
|
and cl.CORPINFO_ID = #{pd.CORPINFO_ID}
|
|
order BY
|
|
cl.OPERATTIME desc
|
|
</select>
|
|
<select id="findById" parameterType="pd" resultType="com.zcloud.entity.PageData">
|
|
SELECT fpc.FIRE_CHECK_ID,
|
|
cl.FIRE_CHECK_STANDARD_NAME,
|
|
cl.FIRE_CHECK_TYPE,
|
|
cl.DEPARTMENT_ID,
|
|
cl.USER_ID,
|
|
sp.POST_ID,
|
|
sd.`NAME` AS FIRE_CHECK_TYPE_NAME,
|
|
su.`NAME` AS USERNAME,
|
|
oa.`NAME` AS DEPARTMENTNAME,
|
|
sp.`NAME` AS POSTNAME,
|
|
GROUP_CONCAT(distinct bfr.FIRE_REGION_NAME) FIRE_REGION_NAME,
|
|
GROUP_CONCAT(distinct bfr.FIRE_REGION_CODE) FIRE_REGION_CODE,
|
|
GROUP_CONCAT(distinct bfp.FIRE_POINT_CODE) FIRE_POINT_CODE,
|
|
GROUP_CONCAT(distinct bfp.FIRE_POINT_NAME) FIRE_POINT_NAME,
|
|
GROUP_CONCAT(distinct bfd.FIRE_DEVICE_CODE) FIRE_DEVICE_CODE
|
|
FROM bus_fire_checklist AS cl
|
|
INNER JOIN
|
|
sys_dictionaries AS sd
|
|
ON
|
|
cl.FIRE_CHECK_TYPE = sd.BIANMA
|
|
INNER JOIN
|
|
bus_fire_device_prepared AS fpc
|
|
ON
|
|
cl.FIRE_CHECK_ID = fpc.FIRE_CHECK_ID
|
|
INNER JOIN
|
|
bus_fire_device AS bfd
|
|
ON
|
|
fpc.FIRE_DEVICE_ID = bfd.FIRE_DEVICE_ID
|
|
INNER JOIN
|
|
bus_fire_point AS bfp
|
|
ON
|
|
bfd.FIRE_POINT_ID = bfp.FIRE_POINT_ID
|
|
INNER JOIN
|
|
sys_user AS su
|
|
ON
|
|
cl.USER_ID = su.USER_ID
|
|
INNER JOIN
|
|
oa_department AS oa
|
|
ON
|
|
su.DEPARTMENT_ID = oa.DEPARTMENT_ID
|
|
LEFT JOIN
|
|
sys_post AS sp
|
|
ON
|
|
su.POST_ID = sp.POST_ID
|
|
INNER JOIN
|
|
bus_fire_region AS bfr
|
|
ON
|
|
bfp.FIRE_REGION_ID = bfr.FIRE_REGION_ID
|
|
WHERE cl.ISDELETE = 0
|
|
AND cl.FIRE_CHECK_ID = #{FIRE_CHECK_ID}
|
|
AND cl.CORPINFO_ID = #{CORPINFO_ID}
|
|
GROUP BY fpc.FIRE_CHECK_ID
|
|
</select>
|
|
<select id="getCheckList" parameterType="pd" 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,
|
|
fd.FIRE_DEVICE_CODE,
|
|
fd.FIRE_DEVICE_TYPE_ID,
|
|
fd.FIRE_DEVICE_ID,
|
|
su.`NAME` AS USERNAME,
|
|
p.`NAME` AS POSTNAME,
|
|
d.`NAME` AS DEPARTMENTNAME,
|
|
sys_dictionaries.`NAME` FIRE_DEVICE_TYPE_NAME
|
|
FROM
|
|
bus_fire_point AS fp
|
|
left JOIN
|
|
bus_fire_device AS fd
|
|
ON
|
|
fp.FIRE_POINT_ID = fd.FIRE_POINT_ID
|
|
left JOIN
|
|
bus_fire_region AS fr
|
|
ON
|
|
fd.FIRE_REGION_ID = fr.FIRE_REGION_ID
|
|
left JOIN
|
|
sys_user AS su
|
|
ON
|
|
fp.USER_ID = su.USER_ID
|
|
left JOIN
|
|
sys_post AS p
|
|
ON
|
|
su.POST_ID = p.POST_ID
|
|
left JOIN
|
|
oa_department AS d
|
|
ON
|
|
fd.DEPARTMENT_ID = d.DEPARTMENT_ID
|
|
left JOIN
|
|
sys_dictionaries
|
|
ON
|
|
fd.FIRE_DEVICE_TYPE_ID = sys_dictionaries.BIANMA
|
|
WHERE
|
|
fp.ISDELETE = 0 AND
|
|
fd.ISDELETE = 0 AND fr.ISDELETE = 0
|
|
<if test="USER_ID != null and USER_ID != ''">
|
|
and fp.USER_ID = #{USER_ID}
|
|
</if>
|
|
<if test="USERNAME != null and USERNAME != ''">
|
|
and su.NAME like concat(#{USERNAME},'%')
|
|
</if>
|
|
<if test="departmentIds != null and departmentIds != ''">
|
|
and fp.DEPARTMENT_ID in
|
|
<foreach item="item" index="index" collection="departmentIds" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
</if>
|
|
<if test="DEPARTMENT_ID != null and DEPARTMENT_ID != ''">
|
|
and fp.DEPARTMENT_ID = #{DEPARTMENT_ID}
|
|
</if>
|
|
<if test="FIRE_DEVICE_ID != null and FIRE_DEVICE_ID != ''">
|
|
and fd.FIRE_DEVICE_ID = #{FIRE_DEVICE_ID}
|
|
</if>
|
|
<if test="FIRE_POINT_ID != null and FIRE_POINT_ID !='' ">
|
|
and p.FIRE_POINT_ID = #{FIRE_POINT_ID}
|
|
</if>
|
|
<if test="FIRE_DEVICE_TYPE_ID != null and FIRE_DEVICE_TYPE_ID !='' ">
|
|
and d.FIRE_DEVICE_TYPE_ID = #{FIRE_DEVICE_TYPE_ID}
|
|
</if>
|
|
<if test="FIRE_REGION_ID != null and FIRE_REGION_ID !='' ">
|
|
and fr.FIRE_REGION_ID = #{FIRE_REGION_ID}
|
|
</if>
|
|
<if test="FIRE_POINT_NAME != null and FIRE_POINT_NAME !='' ">
|
|
and p.FIRE_POINT_NAME like concat('%',#{FIRE_POINT_NAME,jdbcType=VARCHAR},'%')
|
|
</if>
|
|
order by FIRE_DEVICE_CODE desc
|
|
</select>
|
|
<select id="getNotCheckedByDay" parameterType="pd" resultType="com.zcloud.entity.PageData">
|
|
SELECT f.FIRE_CHECK_ID,
|
|
f.CORPINFO_ID,
|
|
f.FIRE_CHECK_STANDARD_NAME
|
|
FROM bus_fire_checklist f
|
|
LEFT JOIN bus_offduty o ON o.USER_ID = f.USER_ID
|
|
AND concat(o.STARTTIME, ' 00:00:00') <= #{STARTTIME} AND concat(o.ENDTIME, ' 23:59:59') >= #{ENDTIME}
|
|
|
|
LEFT JOIN SYS_USER u on u.USER_ID = f.USER_ID
|
|
LEFT JOIN BUS_SHIFTWORKRULES swr ON u.SHIFTDUTYTWO = swr.SHIFTWORKRULES_ID
|
|
WHERE f.STATE = '0'
|
|
and f.FIRE_CHECK_ID NOT IN (SELECT l.FIRE_CHECK_ID
|
|
FROM bus_fire_checklist l
|
|
LEFT JOIN bus_fire_record c ON c.FIRE_CHECK_ID = l.FIRE_CHECK_ID
|
|
WHERE l.isdelete = '0'
|
|
AND l.FIRE_CHECK_TYPE = #{FIRE_CHECK_TYPE}
|
|
AND (
|
|
c.CHECK_TIME BETWEEN #{STARTTIME} AND #{ENDTIME}
|
|
or
|
|
(
|
|
c.periodstart = #{STARTTIME} and c.periodend = #{ENDTIME}
|
|
)
|
|
))
|
|
AND f.isdelete = '0'
|
|
AND f.FIRE_CHECK_TYPE = #{FIRE_CHECK_TYPE}
|
|
AND o.OFFDUTY_ID IS NULL
|
|
AND (
|
|
(
|
|
swr.ISDELETE = '0'
|
|
AND (
|
|
swr.ISCUSTOM = '0'
|
|
OR (u.WORKSTATUS = '1' AND u.DURATION > 1)
|
|
OR (u.WORKSTATUS = '2' AND u.DURATION = '1')
|
|
)
|
|
)
|
|
OR u.SHIFTDUTYONE IS NULL
|
|
OR u.SHIFTDUTYONE = ''
|
|
)
|
|
|
|
</select>
|
|
|
|
<select id="getInfoByCheckID" resultType="com.zcloud.entity.PageData">
|
|
SELECT cs.FIRE_CHECK_STANDARD_ITEM,
|
|
cl.FIRE_CHECK_ID,
|
|
cs.DEVICE_NAME
|
|
FROM bus_fire_device_prepared AS cl
|
|
RIGHT JOIN bus_fire_check_standard AS cs ON cl.FIRE_DEVICE_ID = cs.FIRE_DEVICE_ID
|
|
WHERE cl.ISDELETE = 0
|
|
AND cs.ISDELETE = 0
|
|
AND cl.FIRE_CHECK_ID = #{FIRE_CHECK_ID}
|
|
and cl.CORPINFO_ID = #{CORPINFO_ID}
|
|
</select>
|
|
|
|
|
|
<select id="getFireCheckListByApplistPage" resultType="com.zcloud.entity.PageData">
|
|
SELECT cl.FIRE_CHECK_ID,
|
|
cl.FIRE_CHECK_STANDARD_NAME,
|
|
cl.FIRE_CHECK_TYPE,
|
|
COUNT(fpc.FIRE_DEVICE_ID) AS ITEMCOUNT,
|
|
su.`NAME` AS USERNAME,
|
|
od.`NAME` AS DEPARTMENT,
|
|
sys_dictionaries.`NAME` BIANMA
|
|
FROM bus_fire_checklist AS cl
|
|
LEFT JOIN bus_fire_device_prepared AS fpc ON cl.FIRE_CHECK_ID = fpc.FIRE_CHECK_ID
|
|
INNER JOIN sys_user AS su ON cl.USER_ID = su.USER_ID
|
|
INNER JOIN oa_department AS od ON cl.DEPARTMENT_ID = od.DEPARTMENT_ID
|
|
INNER JOIN sys_dictionaries ON cl.FIRE_CHECK_TYPE = sys_dictionaries.BIANMA
|
|
WHERE cl.ISDELETE = 0
|
|
AND cl.STATE = 0
|
|
and cl.USER_ID = #{pd.USER_ID}
|
|
GROUP BY fpc.FIRE_CHECK_ID
|
|
order by cl.CREATTIME desc
|
|
</select>
|
|
|
|
<select id="getFireCheckListByApplistPageV2" resultType="com.zcloud.entity.PageData">
|
|
SELECT cl.FIRE_CHECK_ID,
|
|
cl.FIRE_CHECK_STANDARD_NAME,
|
|
cl.FIRE_CHECK_TYPE,
|
|
COUNT( DISTINCT fpp.FIRE_POINT_ID ) AS ITEMCOUNT,
|
|
su.`NAME` AS USERNAME,
|
|
od.`NAME` AS DEPARTMENT,
|
|
sys_dictionaries.`NAME` BIANMA
|
|
FROM bus_fire_checklist AS cl
|
|
LEFT JOIN bus_fire_device_prepared AS fpc ON cl.FIRE_CHECK_ID = fpc.FIRE_CHECK_ID
|
|
LEFT JOIN bus_fire_point_prepared fpp on cl.FIRE_CHECK_ID = fpp.FIRE_CHECK_ID
|
|
LEFT JOIN bus_fire_point fp ON fp.FIRE_POINT_ID = fpp.FIRE_POINT_ID
|
|
LEFT JOIN sys_user AS su ON cl.USER_ID = su.USER_ID
|
|
LEFT JOIN oa_department AS od ON cl.DEPARTMENT_ID = od.DEPARTMENT_ID
|
|
LEFT JOIN sys_dictionaries ON cl.FIRE_CHECK_TYPE = sys_dictionaries.BIANMA
|
|
WHERE cl.ISDELETE = 0
|
|
AND cl.STATE = 0
|
|
<if test="pd.pointId != null and pd.pointId != ''">
|
|
AND fpp.FIRE_POINT_ID = #{pd.pointId}
|
|
</if>
|
|
and fpp.ISDELETE = 0
|
|
and fp.ISDELETE = 0
|
|
AND fpc.ISDELETE = 0
|
|
<if test="pd.roleLevel != null and pd.roleLevel != ''"><!-- 权限显示 -->
|
|
<choose>
|
|
<!--公司领导-->
|
|
<when test='pd.roleLevel == "0"'>
|
|
<if test="pd.CORPINFO_ID!=null and pd.CORPINFO_ID != ''">
|
|
AND cl.CORPINFO_ID = #{pd.CORPINFO_ID,jdbcType=VARCHAR}
|
|
</if>
|
|
</when>
|
|
<when test='pd.roleLevel == "1"'>
|
|
and cl.DEPARTMENT_ID in (${pd.supDeparIds})
|
|
</when>
|
|
<when test='pd.roleLevel == "2"'>
|
|
<if test="pd.USER_ID != null and pd.USER_ID != ''">
|
|
AND cl.USER_ID = #{pd.USER_ID}
|
|
</if>
|
|
</when>
|
|
</choose>
|
|
</if>
|
|
GROUP BY fpc.FIRE_CHECK_ID
|
|
order by cl.CREATTIME desc
|
|
</select>
|
|
<select id="getFinshedLog" resultType="com.zcloud.entity.PageData">
|
|
SELECT FIRE_RECORD_ID,
|
|
FIRE_CHECK_ID,
|
|
CHECK_TIME,
|
|
FINISHED,
|
|
REPEATCHECK,
|
|
PHONE_REPEAT,
|
|
PERIODSTART,
|
|
PERIODEND
|
|
FROM bus_fire_record
|
|
WHERE #{CYCLETIME} BETWEEN PERIODSTART
|
|
AND PERIODEND
|
|
AND ISDELETE = 0
|
|
and PHONE_REPEAT = #{PHONE_REPEAT}
|
|
and FIRE_CHECK_ID = #{FIRE_CHECK_ID}
|
|
ORDER BY OPERATTIME desc
|
|
LIMIT 1
|
|
</select>
|
|
<select id="getNotCheckedByWEEK" resultType="com.zcloud.entity.PageData">
|
|
SELECT f.FIRE_CHECK_ID,
|
|
f.CORPINFO_ID,
|
|
f.FIRE_CHECK_STANDARD_NAME
|
|
FROM bus_fire_checklist f
|
|
LEFT JOIN bus_offduty o ON o.USER_ID = f.USER_ID
|
|
AND concat(o.STARTTIME, ' 00:00:00') <= #{STARTTIME} AND concat(o.ENDTIME, ' 23:59:59') >= #{ENDTIME}
|
|
|
|
LEFT JOIN SYS_USER u on u.USER_ID = f.USER_ID
|
|
LEFT JOIN BUS_SHIFTWORKRULES swr ON u.SHIFTDUTYTWO = swr.SHIFTWORKRULES_ID
|
|
WHERE f.STATE = '0'
|
|
and f.FIRE_CHECK_ID NOT IN (SELECT l.FIRE_CHECK_ID
|
|
FROM bus_fire_checklist l
|
|
LEFT JOIN bus_fire_record c ON c.FIRE_CHECK_ID = l.FIRE_CHECK_ID
|
|
WHERE l.isdelete = '0'
|
|
AND l.FIRE_CHECK_TYPE = #{FIRE_CHECK_TYPE}
|
|
AND (
|
|
c.CHECK_TIME BETWEEN #{STARTTIME} AND #{ENDTIME}
|
|
or
|
|
(
|
|
c.periodstart = #{STARTTIME} and c.periodend = #{ENDTIME}
|
|
)
|
|
))
|
|
AND f.isdelete = '0'
|
|
AND f.FIRE_CHECK_TYPE = #{FIRE_CHECK_TYPE}
|
|
AND o.OFFDUTY_ID IS NULL
|
|
</select>
|
|
|
|
<select id="getFireCheckListCountByAppV2" resultType="com.zcloud.entity.PageData">
|
|
SELECT cl.FIRE_CHECK_ID,
|
|
cl.FIRE_CHECK_STANDARD_NAME,
|
|
cl.FIRE_CHECK_TYPE,
|
|
COUNT( DISTINCT fpp.FIRE_POINT_ID ) AS ITEMCOUNT,
|
|
su.`NAME` AS USERNAME,
|
|
od.`NAME` AS DEPARTMENT,
|
|
sys_dictionaries.`NAME` BIANMA
|
|
FROM bus_fire_checklist AS cl
|
|
LEFT JOIN bus_fire_device_prepared AS fpc ON cl.FIRE_CHECK_ID = fpc.FIRE_CHECK_ID
|
|
LEFT JOIN bus_fire_point_prepared fpp on cl.FIRE_CHECK_ID = fpp.FIRE_CHECK_ID
|
|
LEFT JOIN sys_user AS su ON cl.USER_ID = su.USER_ID
|
|
LEFT JOIN oa_department AS od ON cl.DEPARTMENT_ID = od.DEPARTMENT_ID
|
|
LEFT JOIN sys_dictionaries ON cl.FIRE_CHECK_TYPE = sys_dictionaries.BIANMA
|
|
WHERE cl.ISDELETE = 0
|
|
AND cl.STATE = 0
|
|
and fpp.ISDELETE = 0
|
|
AND fpc.ISDELETE = 0
|
|
<if test="roleLevel == '0'.toString()">
|
|
<if test="CORPINFO_ID!=null and CORPINFO_ID != ''">
|
|
AND cl.CORPINFO_ID = #{CORPINFO_ID,jdbcType=VARCHAR}
|
|
</if>
|
|
</if>
|
|
<if test="roleLevel == '1'.toString()">
|
|
and cl.DEPARTMENT_ID in (${supDeparIds})
|
|
</if>
|
|
<if test="roleLevel == '2'.toString()">
|
|
<if test="USER_ID != null and USER_ID != ''">
|
|
AND cl.USER_ID = #{USER_ID}
|
|
</if>
|
|
</if>
|
|
GROUP BY fpc.FIRE_CHECK_ID
|
|
order by cl.CREATTIME desc
|
|
</select>
|
|
<select id="getFireCheckListCountByApp" resultType="com.zcloud.entity.PageData">
|
|
SELECT cl.FIRE_CHECK_ID,
|
|
cl.FIRE_CHECK_STANDARD_NAME,
|
|
cl.FIRE_CHECK_TYPE,
|
|
COUNT(fpc.FIRE_DEVICE_ID) AS ITEMCOUNT,
|
|
su.`NAME` AS USERNAME,
|
|
od.`NAME` AS DEPARTMENT,
|
|
sys_dictionaries.`NAME` BIANMA
|
|
FROM bus_fire_checklist AS cl
|
|
LEFT JOIN bus_fire_device_prepared AS fpc ON cl.FIRE_CHECK_ID = fpc.FIRE_CHECK_ID
|
|
LEFT JOIN sys_user AS su ON cl.USER_ID = su.USER_ID
|
|
LEFT JOIN oa_department AS od ON cl.DEPARTMENT_ID = od.DEPARTMENT_ID
|
|
LEFT JOIN sys_dictionaries ON cl.FIRE_CHECK_TYPE = sys_dictionaries.BIANMA
|
|
WHERE cl.ISDELETE = 0
|
|
AND cl.STATE = 0
|
|
<if test="USER_ID != null and USER_ID != ''">
|
|
and cl.USER_ID = #{USER_ID}
|
|
</if>
|
|
<if test="CORPINFO_ID != null and CORPINFO_ID != ''">
|
|
AND cl.CORPINFO_ID = #{CORPINFO_ID,jdbcType=VARCHAR}
|
|
</if>
|
|
GROUP BY fpc.FIRE_CHECK_ID
|
|
order by cl.CREATTIME desc
|
|
</select>
|
|
</mapper>
|