|
|
|
@ -295,16 +295,13 @@
|
|
|
|
|
b.UNITS_NAME as UNITS_NAME,
|
|
|
|
|
isu.NAME as AIWARNING_PEOPLE,
|
|
|
|
|
pci.NAME Q_COMPETENT_DEPT_NAME,
|
|
|
|
|
(select count(1) from `qa-gwj-prevention`.BUS_KEYPROJECTCHECK c where c.OUTSOURCED_ID = f.OUTSOURCED_ID) as CHECK_COUNT,
|
|
|
|
|
cc.co as CHECK_COUNT,
|
|
|
|
|
(select count(1) from `qa-gwj-regulatory`.BUS_AIWARNING a left join bus_videomanager avid on avid.VIDEOMANAGER_ID = a.VIDEOMANAGER_ID where avid.OUTSOURCED_ID= f.OUTSOURCED_ID and a.ISDELETE = '0') as AI_COUNT,
|
|
|
|
|
(select count(1) from `qa-gwj-regulatory`.BUS_VIDEOMANAGER v where v.OUTSOURCED_ID = f.OUTSOURCED_ID and v.ISDELETE = '0') as VIDEO_COUNT,
|
|
|
|
|
(SELECT count( 1 ) FROM `qa-gwj-prevention`.BUS_KEYPROJECTPUNISH k left join `qa-gwj-prevention`.bus_keyprojectcheck kjc on kjc.KEYPROJECTCHECK_ID = k.KEYPROJECTCHECK_ID WHERE kjc.OUTSOURCED_ID =f.OUTSOURCED_ID AND k.ISDELETE = '0' ) as KEY_COUNT,
|
|
|
|
|
vua.NAME OUTSOURCED_CREATOR_NAME,
|
|
|
|
|
ifnull(vac.CORP_NAME,'秦港股份有限公司') CORP_NAME,
|
|
|
|
|
p.`NAME` as UNITS_PIC_NAME
|
|
|
|
|
<if test="pd.UserId != null and pd.UserId !=''">
|
|
|
|
|
,ifnull(dbsl.co,0) as co
|
|
|
|
|
</if>
|
|
|
|
|
from
|
|
|
|
|
<include refid="tableName"></include> f
|
|
|
|
|
left join bus_units b using (UNITS_ID)
|
|
|
|
@ -315,25 +312,7 @@
|
|
|
|
|
LEFT JOIN `qa-gwj-prevention`.vi_user_all vua on f.CREATOR = vua.USER_ID
|
|
|
|
|
LEFT JOIN `qa-gwj-regulatory`.vi_all_corp vac on vua.CORPINFO_ID = vac.CORPINFO_ID
|
|
|
|
|
left join `qa-gwj-regulatory`.bus_personnelmanagement p on p.PERSONNELMANAGEMENT_ID = f.UNITS_PIC
|
|
|
|
|
-- 这个判断是隐患管理排序以及隐患管理的角标
|
|
|
|
|
<if test="pd.UserId != null and pd.UserId !=''">
|
|
|
|
|
left join (SELECT t.OUTSOURCED_ID,COUNT( distinct t.HIDDEN_ID) co FROM (
|
|
|
|
|
SELECT
|
|
|
|
|
f.HIDDEN_ID,ifnull(bo.OUTSOURCED_ID,boai.OUTSOURCED_ID) OUTSOURCED_ID
|
|
|
|
|
FROM
|
|
|
|
|
`qa-gwj-prevention`.BUS_KEYPROJECT_HIDDEN f
|
|
|
|
|
LEFT JOIN `qa-gwj-prevention`.bus_keyprojectcheck keycheck ON keycheck.KEYPROJECTCHECK_ID = f.FOREIGN_ID
|
|
|
|
|
LEFT JOIN `qa-gwj-regulatory`.BUS_OUTSOURCED bo ON keycheck.OUTSOURCED_ID = bo.OUTSOURCED_ID
|
|
|
|
|
LEFT JOIN `qa-gwj-regulatory`.BUS_OUTSOURCED boai ON f.FOREIGN_ID = boai.OUTSOURCED_ID
|
|
|
|
|
LEFT JOIN `qa-gwj-prevention`.BUS_KEYPROJECTPUNISH pu ON pu.HIDDEN_ID = f.HIDDEN_ID
|
|
|
|
|
WHERE
|
|
|
|
|
f.ISDELETE = '0'
|
|
|
|
|
AND f.SOURCE IN ( '4', '5', '1' )
|
|
|
|
|
AND f.STATE = '2'
|
|
|
|
|
AND f.CREATOR = #{pd.UserId}
|
|
|
|
|
AND ifnull(bo.OUTSOURCED_ID,boai.OUTSOURCED_ID) IS NOT NULL
|
|
|
|
|
) t GROUP BY t.OUTSOURCED_ID ) dbsl on dbsl.OUTSOURCED_ID = f.OUTSOURCED_ID
|
|
|
|
|
</if>
|
|
|
|
|
LEFT JOIN ( select count(c.KEYPROJECTCHECK_ID) co, c.OUTSOURCED_ID from `qa-gwj-prevention`.BUS_KEYPROJECTCHECK c where c.ISDELETE = '0' group by c.OUTSOURCED_ID ) cc on cc.OUTSOURCED_ID = f.OUTSOURCED_ID
|
|
|
|
|
where f.ISDELETE = '0'
|
|
|
|
|
<if test="pd.CORPINFO_ID != null and pd.CORPINFO_ID != ''"><!-- 关键词检索 -->
|
|
|
|
|
and
|
|
|
|
@ -396,9 +375,7 @@
|
|
|
|
|
)
|
|
|
|
|
</if>
|
|
|
|
|
ORDER BY
|
|
|
|
|
<if test="pd.UserId != null and pd.UserId !=''">
|
|
|
|
|
dbsl.co DESC,
|
|
|
|
|
</if>
|
|
|
|
|
cc.co DESC,
|
|
|
|
|
f.OPERATTIME DESC
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
@ -697,4 +674,127 @@
|
|
|
|
|
where
|
|
|
|
|
OUTSOURCED_ID = #{OUTSOURCED_ID}
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 列表 -->
|
|
|
|
|
<select id="hiddenOutsourcedlistPage" parameterType="page" resultType="pd">
|
|
|
|
|
select
|
|
|
|
|
f.*,
|
|
|
|
|
(select GROUP_CONCAT(t.CORP_NAME) from `qa-gwj-prevention`.BUS_CORP_INFO t where FIND_IN_SET(t.CORPINFO_ID, f.INVOLVING_CORPS)) as INVOLVING_CORPS_NAME,
|
|
|
|
|
(select GROUP_CONCAT(t.CORP_NAME) from `qa-gwj-prevention`.BUS_CORP_INFO t where FIND_IN_SET(t.CORPINFO_ID, f.MANAGE_NAME)) as MANAGE_CORPS_NAME,
|
|
|
|
|
( SELECT GROUP_CONCAT( t.NAME ) FROM `qa-gwj-prevention`.oa_department t WHERE FIND_IN_SET( t.DEPARTMENT_ID, f.INVOLVING_CORPS_DEPART_ID ) ) AS INVOLVING_CORPS_DEPART_NAME,
|
|
|
|
|
(select GROUP_CONCAT(t.CORP_NAME) from `qa-gwj-prevention`.BUS_CORP_INFO t where FIND_IN_SET(t.CORPINFO_ID, f.GROUP_UNIT)) as GROUP_UNIT_NAME,
|
|
|
|
|
( SELECT GROUP_CONCAT( t.NAME ) FROM `qa-gwj-prevention`.vi_department_all t WHERE FIND_IN_SET( t.DEPARTMENT_ID, f.DEPARTMENT_ID ) ) AS DEPARTMENT_NAME,
|
|
|
|
|
|
|
|
|
|
(select GROUP_CONCAT(t.NAME) from (
|
|
|
|
|
SELECT
|
|
|
|
|
CONCAT( CONCAT( c.CORP_NAME, '-' ), t.NAME ) NAME ,t.DEPARTMENT_ID
|
|
|
|
|
FROM
|
|
|
|
|
`qa-gwj-prevention`.OA_DEPARTMENT t
|
|
|
|
|
LEFT JOIN `qa-gwj-prevention`.bus_corp_info c ON c.CORPINFO_ID = t.CORPINFO_ID
|
|
|
|
|
) t where FIND_IN_SET(t.DEPARTMENT_ID, f.JURISDICTION_UNIT)) as JURISDICTION_UNIT_NAME,
|
|
|
|
|
isdd.NAME MANAGER_DEPARTMENT_NAME,
|
|
|
|
|
isu.NAME USER_NAME,
|
|
|
|
|
b.UNITS_NAME as UNITS_NAME,
|
|
|
|
|
isu.NAME as AIWARNING_PEOPLE,
|
|
|
|
|
pci.NAME Q_COMPETENT_DEPT_NAME,
|
|
|
|
|
(select count(1) from `qa-gwj-prevention`.BUS_KEYPROJECTCHECK c where c.OUTSOURCED_ID = f.OUTSOURCED_ID) as CHECK_COUNT,
|
|
|
|
|
(select count(1) from `qa-gwj-regulatory`.BUS_AIWARNING a left join bus_videomanager avid on avid.VIDEOMANAGER_ID = a.VIDEOMANAGER_ID where avid.OUTSOURCED_ID= f.OUTSOURCED_ID and a.ISDELETE = '0') as AI_COUNT,
|
|
|
|
|
(select count(1) from `qa-gwj-regulatory`.BUS_VIDEOMANAGER v where v.OUTSOURCED_ID = f.OUTSOURCED_ID and v.ISDELETE = '0') as VIDEO_COUNT,
|
|
|
|
|
(SELECT count( 1 ) FROM `qa-gwj-prevention`.BUS_KEYPROJECTPUNISH k left join `qa-gwj-prevention`.bus_keyprojectcheck kjc on kjc.KEYPROJECTCHECK_ID = k.KEYPROJECTCHECK_ID WHERE kjc.OUTSOURCED_ID =f.OUTSOURCED_ID AND k.ISDELETE = '0' ) as KEY_COUNT,
|
|
|
|
|
vua.NAME OUTSOURCED_CREATOR_NAME,
|
|
|
|
|
ifnull(vac.CORP_NAME,'秦港股份有限公司') CORP_NAME,
|
|
|
|
|
p.`NAME` as UNITS_PIC_NAME
|
|
|
|
|
,ifnull(dbsl.co,0) as co
|
|
|
|
|
from
|
|
|
|
|
<include refid="tableName"></include> f
|
|
|
|
|
left join bus_units b using (UNITS_ID)
|
|
|
|
|
LEFT JOIN `qa-gwj-regulatory`.SYS_DEPARTMENT isdd ON isdd.DEPARTMENT_ID = f.MANAGER_DEPARTMENT_ID
|
|
|
|
|
LEFT JOIN `qa-gwj-regulatory`.SYS_USER isu ON isu.USER_ID = f.CONTRACT_PIC
|
|
|
|
|
LEFT JOIN `qa-gwj-prevention`.oa_department pcij ON pcij.DEPARTMENT_ID = f.DEPARTMENT_ID
|
|
|
|
|
LEFT JOIN `qa-gwj-prevention`.oa_department pci ON pci.DEPARTMENT_ID = f.COMPETENT_DEPT_ID
|
|
|
|
|
LEFT JOIN `qa-gwj-prevention`.vi_user_all vua on f.CREATOR = vua.USER_ID
|
|
|
|
|
LEFT JOIN `qa-gwj-regulatory`.vi_all_corp vac on vua.CORPINFO_ID = vac.CORPINFO_ID
|
|
|
|
|
left join `qa-gwj-regulatory`.bus_personnelmanagement p on p.PERSONNELMANAGEMENT_ID = f.UNITS_PIC
|
|
|
|
|
left join (SELECT t.OUTSOURCED_ID,COUNT( distinct t.HIDDEN_ID) co FROM (
|
|
|
|
|
SELECT
|
|
|
|
|
f.HIDDEN_ID,ifnull(bo.OUTSOURCED_ID,boai.OUTSOURCED_ID) OUTSOURCED_ID
|
|
|
|
|
FROM
|
|
|
|
|
`qa-gwj-prevention`.BUS_KEYPROJECT_HIDDEN f
|
|
|
|
|
LEFT JOIN `qa-gwj-prevention`.bus_keyprojectcheck keycheck ON keycheck.KEYPROJECTCHECK_ID = f.FOREIGN_ID
|
|
|
|
|
LEFT JOIN `qa-gwj-regulatory`.BUS_OUTSOURCED bo ON keycheck.OUTSOURCED_ID = bo.OUTSOURCED_ID
|
|
|
|
|
LEFT JOIN `qa-gwj-regulatory`.BUS_OUTSOURCED boai ON f.FOREIGN_ID = boai.OUTSOURCED_ID
|
|
|
|
|
LEFT JOIN `qa-gwj-prevention`.BUS_KEYPROJECTPUNISH pu ON pu.HIDDEN_ID = f.HIDDEN_ID
|
|
|
|
|
WHERE
|
|
|
|
|
f.ISDELETE = '0'
|
|
|
|
|
AND f.SOURCE IN ( '4', '5', '1' )
|
|
|
|
|
AND f.STATE = '2'
|
|
|
|
|
AND f.CREATOR = #{pd.UserId}
|
|
|
|
|
AND ifnull(bo.OUTSOURCED_ID,boai.OUTSOURCED_ID) IS NOT NULL
|
|
|
|
|
) t GROUP BY t.OUTSOURCED_ID ) dbsl on dbsl.OUTSOURCED_ID = f.OUTSOURCED_ID
|
|
|
|
|
where f.ISDELETE = '0'
|
|
|
|
|
<if test="pd.CORPINFO_ID != null and pd.CORPINFO_ID != ''"><!-- 关键词检索 -->
|
|
|
|
|
and
|
|
|
|
|
(
|
|
|
|
|
f.INVOLVING_CORPS LIKE CONCAT(CONCAT('%', #{pd.CORPINFO_ID}),'%')
|
|
|
|
|
or
|
|
|
|
|
f.GROUP_UNIT LIKE CONCAT(CONCAT('%', #{pd.CORPINFO_ID}),'%')
|
|
|
|
|
)
|
|
|
|
|
</if>
|
|
|
|
|
<if test="pd.KEYWORDS != null and pd.KEYWORDS != ''"><!-- 关键词检索 -->
|
|
|
|
|
and
|
|
|
|
|
(
|
|
|
|
|
<!-- 根据需求自己加检索条件-->
|
|
|
|
|
f.OUTSOURCED_NAME LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
|
|
|
|
|
or
|
|
|
|
|
b.UNITS_NAME LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
|
|
|
|
|
or
|
|
|
|
|
f.UNITS_PIC LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
|
|
|
|
|
or
|
|
|
|
|
pcij.NAME LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
|
|
|
|
|
)
|
|
|
|
|
</if>
|
|
|
|
|
<if test="pd.OUTSOURCED_NAME != null and pd.OUTSOURCED_NAME !=''">
|
|
|
|
|
and f.OUTSOURCED_NAME = #{pd.OUTSOURCED_NAME}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="pd.UNITS_ID != null and pd.UNITS_ID !=''">
|
|
|
|
|
and f.UNITS_ID = #{pd.UNITS_ID}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="pd.INVOLVING_CORP != null and pd.INVOLVING_CORP !=''">
|
|
|
|
|
and f.INVOLVING_CORPS LIKE CONCAT(CONCAT('%', #{pd.INVOLVING_CORP}),'%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="pd.DEPARTMENT_ID != null and pd.DEPARTMENT_ID !=''">
|
|
|
|
|
and f.DEPARTMENT_ID LIKE CONCAT(CONCAT('%', #{pd.DEPARTMENT_ID}),'%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="pd.COMPETENT_DEPT_ID != null and pd.COMPETENT_DEPT_ID !=''">
|
|
|
|
|
and f.COMPETENT_DEPT_ID LIKE CONCAT(CONCAT('%', #{pd.COMPETENT_DEPT_ID}),'%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="pd.GROUP_UNIT != null and pd.GROUP_UNIT !=''">
|
|
|
|
|
and f.GROUP_UNIT LIKE CONCAT(CONCAT('%', #{pd.GROUP_UNIT}),'%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="pd.CORP_NAME != null and pd.CORP_NAME !=''">
|
|
|
|
|
and vac.CORP_NAME LIKE CONCAT(CONCAT('%', #{pd.CORP_NAME}),'%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="pd.STATE != null and pd.STATE !=''">
|
|
|
|
|
and f.STATE = #{pd.STATE}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="pd.CONTRACT_STIME != null and pd.CONTRACT_STIME !=''">
|
|
|
|
|
and (f.CONTRACT_STIME between #{pd.CONTRACT_STIME} and #{pd.CONTRACT_ETIME}
|
|
|
|
|
or f.CONTRACT_ETIME between #{pd.CONTRACT_STIME} and #{pd.CONTRACT_ETIME}
|
|
|
|
|
or (f.CONTRACT_STIME < #{pd.CONTRACT_STIME} and f.CONTRACT_ETIME > #{pd.CONTRACT_ETIME}))
|
|
|
|
|
</if>
|
|
|
|
|
<if test="pd.DeptId != null and pd.DeptId !=''">
|
|
|
|
|
and ( f.DEPARTMENT_ID LIKE CONCAT(CONCAT('%', #{pd.DeptId}),'%')
|
|
|
|
|
or f.COMPETENT_DEPT_ID LIKE CONCAT(CONCAT('%', #{pd.DeptId}),'%')
|
|
|
|
|
or f.INVOLVING_CORPS LIKE CONCAT(CONCAT('%', #{pd.DeptId}),'%')
|
|
|
|
|
or f.INVOLVING_CORPS_DEPART_ID LIKE CONCAT(CONCAT('%', #{pd.DeptId}),'%')
|
|
|
|
|
or f.JURISDICTION_UNIT LIKE CONCAT(CONCAT('%', #{pd.DeptId}),'%')
|
|
|
|
|
or f.PUNISH_THE_PERSON LIKE CONCAT(CONCAT('%', #{pd.UserId}),'%')
|
|
|
|
|
or f.CREATOR = #{pd.UserId}
|
|
|
|
|
)
|
|
|
|
|
</if>
|
|
|
|
|
ORDER BY
|
|
|
|
|
dbsl.co DESC,
|
|
|
|
|
f.OPERATTIME DESC
|
|
|
|
|
</select>
|
|
|
|
|
</mapper>
|
|
|
|
|