app首页隐患统计

pull/4/head
wangpeng 2024-02-05 09:02:31 +08:00
parent 88efa3f0ea
commit 48c8f5de9b
9 changed files with 735 additions and 6 deletions

View File

@ -133,7 +133,8 @@ public class AppHiddenController extends BaseController {
// STATE -- 隐患状态 0-未提交 1- 未整改 2-已整改 3-已复查 4-已验收 5-已过期 // STATE -- 隐患状态 0-未提交 1- 未整改 2-已整改 3-已复查 4-已验收 5-已过期
if (Tools.notEmpty(pd.get("userId").toString())) { if (Tools.notEmpty(pd.get("userId").toString())) {
pd.put("SELFUSERID", pd.get("userId")); pd.put("SELFUSERID", pd.get("userId"));
List<PageData> rectifiHid = hiddenService.getCountByRectifiCationorId(pd); // 根据人员id获取整改隐患信息 state 1 5 // List<PageData> rectifiHid = hiddenService.getCountByRectifiCationorId(pd); // 根据人员id获取整改隐患信息 state 1 5
List<PageData> rectifiHid = hiddenService.getRiskStandardCountByRectifiCationorId(pd); // 根据用户ID获取待整改隐患app首页
for (int i = 0; i < rectifiHid.size(); i++) { for (int i = 0; i < rectifiHid.size(); i++) {
PageData rec = rectifiHid.get(i); PageData rec = rectifiHid.get(i);
if (null == rec.get("STATE")) { if (null == rec.get("STATE")) {
@ -144,7 +145,8 @@ public class AppHiddenController extends BaseController {
} }
} }
List<PageData> checkorHid = hiddenService.getCountByCheckorId(pd); // 根据人员id获取整改隐患信息 state 1 5 // List<PageData> checkorHid = hiddenService.getCountByCheckorId(pd); // 根据人员id获取整改隐患信息 state 1 5
List<PageData> checkorHid = hiddenService.getRiskStandardCountByCheckorId(pd); // 根据用户ID获取待验收隐患app首页
for (int i = 0; i < checkorHid.size(); i++) { for (int i = 0; i < checkorHid.size(); i++) {
PageData che = checkorHid.get(i); PageData che = checkorHid.get(i);
if (null == che.get("STATE")) { if (null == che.get("STATE")) {
@ -155,7 +157,8 @@ public class AppHiddenController extends BaseController {
} }
} }
List<PageData> confirmHid = hiddenService.getCountByConfirmId(pd); // 根据人员id获取整改隐患信息 state 1 5 // List<PageData> confirmHid = hiddenService.getCountByConfirmId(pd); // 根据人员id获取整改隐患信息 state 1 5
List<PageData> confirmHid = hiddenService.getRiskStandardCountByConfirmId(pd); // 根据用户ID获取待确认隐患app首页
for (int i = 0; i < confirmHid.size(); i++) { for (int i = 0; i < confirmHid.size(); i++) {
PageData che = confirmHid.get(i); PageData che = confirmHid.get(i);
if (null == che.get("STATE")) { if (null == che.get("STATE")) {
@ -166,7 +169,8 @@ public class AppHiddenController extends BaseController {
} }
} }
// userId -> 85437f01be1f4c959f71a850b1d731a1 // userId -> 85437f01be1f4c959f71a850b1d731a1
List<PageData> specialHid = hiddenService.getCountSpecialByhId(pd); // 根据人员id获取特殊处理隐患和延期隐患信息 state 1 5 // List<PageData> specialHid = hiddenService.getCountSpecialByhId(pd); // 根据人员id获取特殊处理隐患和延期隐患信息 state 1 5
List<PageData> specialHid = hiddenService.getRiskStandardCountSpecialByhId(pd); // 根据用户ID获取特殊处理隐患和延期隐患app首页
for (int i = 0; i < specialHid.size(); i++) { for (int i = 0; i < specialHid.size(); i++) {
PageData che = specialHid.get(i); PageData che = specialHid.get(i);
if (null == che.get("TYPE")) { if (null == che.get("TYPE")) {
@ -183,7 +187,8 @@ public class AppHiddenController extends BaseController {
List<PageData> creatorHid = hiddenService.getCountByCreatorId(pd); // 根据人员id获取发现隐患信息 // List<PageData> creatorHid = hiddenService.getCountByCreatorId(pd); // 根据人员id获取发现隐患信息
List<PageData> creatorHid = hiddenService.getRiskStandardCountByCreatorId(pd); // 根据用户ID获取发现隐患信息app首页
for (int i = 0; i < creatorHid.size(); i++) { for (int i = 0; i < creatorHid.size(); i++) {
PageData cre = creatorHid.get(i); PageData cre = creatorHid.get(i);
if (null == cre.get("STATE")) { if (null == cre.get("STATE")) {
@ -226,7 +231,8 @@ public class AppHiddenController extends BaseController {
// } // }
int wjcNum = 0; int wjcNum = 0;
int yjcNum = 0; int yjcNum = 0;
List<PageData> varList = listmanagerService.listAll(pd);// 列出ListManager列表 // List<PageData> varList = listmanagerService.listAll(pd);// 列出ListManager列表
List<PageData> varList = listmanagerService.listAllRiskStandard(pd);// 列出ListManager列表
for (PageData list : varList) { for (PageData list : varList) {
String cycle = list.getString("PERIODNAME"); String cycle = list.getString("PERIODNAME");
if (list.getString("TYPE").equals("listType0005")) { if (list.getString("TYPE").equals("listType0005")) {

View File

@ -234,5 +234,13 @@ public interface ListManagerMapper {
List<PageData> findByCondition(PageData util); List<PageData> findByCondition(PageData util);
List<PageData> analysis(PageData util); List<PageData> analysis(PageData util);
/**
* ()
* listAll(PageData pd)
* @param pd
* @throws Exception
*/
List<PageData> listAllRiskStandard(PageData pd);
} }

View File

@ -314,5 +314,41 @@ public interface HiddenMapper{
* @throws Exception * @throws Exception
*/ */
List<PageData> riskStandardlistPage(Page page); List<PageData> riskStandardlistPage(Page page);
/**
* IDapp
* @param pd CREATOR
* @return
* @throws Exception
*/
List<PageData> getRiskStandardCountByRectifiCationorId(PageData pd);
/**IDapp
* @param pd
* @throws Exception
*/
List<PageData> getRiskStandardCountByCheckorId(PageData pd);
/**IDapp
* @param pd
* @throws Exception
*/
List<PageData> getRiskStandardCountByConfirmId(PageData pd);
/**
* IDapp
* @param pd
* @return
* @throws Exception
*/
List<PageData> getRiskStandardCountSpecialByhId(PageData pd);
/**
* IDapp
* @param pd
* @return
* @throws Exception
*/
List<PageData> getRiskStandardCountByCreatorId(PageData pd);
} }

View File

@ -220,5 +220,13 @@ public interface ListManagerService {
public List<PageData> getCountNumBi(PageData pd)throws Exception; public List<PageData> getCountNumBi(PageData pd)throws Exception;
void saveBaoBaoType(PageData pd) throws Exception; void saveBaoBaoType(PageData pd) throws Exception;
/**
* ()
* listAll(PageData pd)
* @param pd
* @throws Exception
*/
List<PageData> listAllRiskStandard(PageData pd)throws Exception;
} }

View File

@ -334,6 +334,16 @@ public class ListManagerServiceImpl implements ListManagerService {
listCheckItemMapper.edit(entity); listCheckItemMapper.edit(entity);
} }
} }
/**
* ()
* listAll(PageData pd)
* @param pd
* @throws Exception
*/
public List<PageData> listAllRiskStandard(PageData pd)throws Exception{
return listmanagerMapper.listAllRiskStandard(pd);
}
} }

View File

@ -377,5 +377,41 @@ public interface HiddenService{
* @throws Exception * @throws Exception
*/ */
public List<PageData> listRiskStandard(Page page)throws Exception; public List<PageData> listRiskStandard(Page page)throws Exception;
/**
* IDapp
* @param pd CREATOR
* @return
* @throws Exception
*/
List<PageData> getRiskStandardCountByRectifiCationorId(PageData pd) throws Exception;
/**
* IDapp
* @param pd
* @throws Exception
*/
List<PageData> getRiskStandardCountByCheckorId(PageData pd) throws Exception;
/**IDapp
* @param pd
* @throws Exception
*/
List<PageData> getRiskStandardCountByConfirmId(PageData pd) throws Exception;
/**
* IDapp
* @param pd
* @throws Exception
*/
List<PageData> getRiskStandardCountSpecialByhId(PageData pd) throws Exception;
/**
* IDapp
* @param pd CREATOR
* @return
* @throws Exception
*/
List<PageData> getRiskStandardCountByCreatorId(PageData pd) throws Exception;
} }

View File

@ -794,5 +794,53 @@ public class HiddenServiceImpl implements HiddenService {
public List<PageData> listRiskStandard(Page page)throws Exception{ public List<PageData> listRiskStandard(Page page)throws Exception{
return hiddenMapper.riskStandardlistPage(page); return hiddenMapper.riskStandardlistPage(page);
} }
/**
* IDapp
* @param pd CREATOR
* @return
* @throws Exception
*/
public List<PageData> getRiskStandardCountByRectifiCationorId(PageData pd) throws Exception{
return hiddenMapper.getRiskStandardCountByRectifiCationorId(pd);
}
/**
* IDapp
* @param pd
* @return
* @throws Exception
*/
public List<PageData> getRiskStandardCountByCheckorId(PageData pd) throws Exception{
return hiddenMapper.getRiskStandardCountByCheckorId(pd);
}
/**IDapp
* @param pd
* @throws Exception
*/
public List<PageData> getRiskStandardCountByConfirmId(PageData pd) throws Exception{
return hiddenMapper.getRiskStandardCountByConfirmId(pd);
}
/**
* IDapp
* @param pd
* @return
* @throws Exception
*/
public List<PageData> getRiskStandardCountSpecialByhId(PageData pd) throws Exception{
return hiddenMapper.getRiskStandardCountSpecialByhId(pd);
}
/**
* IDapp
* @param pd CREATOR
* @return
* @throws Exception
*/
public List<PageData> getRiskStandardCountByCreatorId(PageData pd) throws Exception{
return hiddenMapper.getRiskStandardCountByCreatorId(pd);
}
} }

View File

@ -3089,4 +3089,272 @@
group by f.CUSTOM_ID group by f.CUSTOM_ID
order by field(f.ISDELETE,'0','1','2','-1') ,f.OPERATTIME desc ) order by field(f.ISDELETE,'0','1','2','-1') ,f.OPERATTIME desc )
</select> </select>
<!-- 列表(全部) -->
<select id="listAllRiskStandard" parameterType="pd" resultType="pd">
select * from
(
select
f.LISTMANAGER_ID, f.NAME, f.PERIOD, f.TYPE, f.CORPINFO_ID,
f.CREATOR, f.CREATTIME, f.OPERATOR, f.OPERATTIME, f.ISDELETE,
f.DEPARTMENT_ID, f.POST_ID, f.USER_ID,
<!-- f.ACOUNT, f.BCOUNT, f.CCOUNT, f.DCOUNT, -->
f.START_DATE, f.END_DATE, f.SCREENTYPE,
f.BAO_BAO_DEPARTMENT_ID, f.BAO_BAO_USER_ID, f.BAO_BAO_TYPE, f.TASK_TYPE,
p.NAME PERIODNAME,
t.NAME TYPENAME,
d.NAME as DEPARTMENT_NAME,
d.LEVEL as DEPARTMENT_LEVEL,
sp.NAME
AS POST_NAME,
u.NAME USER_NAME,
(select count(1) from BUS_LIST_CHECKITEM
ch where ch.LISTMANAGER_ID=f.LISTMANAGER_ID and ch.ISDELETE =0) as
count,
getCheckedNum(f.LISTMANAGER_ID) checkCount
from
<include refid="tableName"></include>
f
left join sys_dictionaries p on f.PERIOD = p.BIANMA
left join sys_dictionaries t on f.TYPE = t.BIANMA
left join OA_DEPARTMENT d on d.DEPARTMENT_ID=f.DEPARTMENT_ID
left join
sys_user u on u.USER_ID = f.USER_ID
left join SYS_POST sp on
sp.POST_ID=f.POST_ID
where (f.TYPE != 'listType0005'
or (f.START_DATE &lt;= DATE_FORMAT(NOW(),'%Y-%m-%d') and f.END_DATE
&gt;= DATE_FORMAT(NOW(),'%Y-%m-%d') ))
<!-- <if test="POST_ID != null and POST_ID != ''">关键词检索 -->
<!-- and -->
<!-- ( -->
<!-- f.POST_ID = #{POST_ID} -->
<!-- ) -->
<!-- </if> -->
<if test="CORPINFO_ID != null and CORPINFO_ID != ''">
and
f.CORPINFO_ID = #{CORPINFO_ID}
</if>
<!-- <if test="USER_ID != null and USER_ID != ''">&lt;!&ndash; 部门查询条件 &ndash;&gt;-->
<!-- and f.USER_ID = #{USER_ID}-->
<!-- </if>-->
<choose>
<when test='ISSUPERVISE != null and ISSUPERVISE != "" and ISSUPERVISE == "1"'>
<choose>
<when test='ISLEADER != null and ISLEADER != "" and ISLEADER == "1"'>
and
((f.DEPARTMENT_ID in (
select
SUB_DEPARTMENT_ID
from
oa_supervision_department osd
where
osd.SUP_DEPARTMENT_ID = #{SUP_DEPARTMENT_ID}
and osd.ISDELETE = '0'
and osd.CORPINFO_ID = #{CORPINFO_ID}
)) or (
f.DEPARTMENT_ID in
<foreach item="item" index="index"
collection="DEPARTMENT_IDS" open="(" separator="," close=")">
'${item}'
</foreach>
))
</when>
<otherwise>
and
(f.DEPARTMENT_ID in (
select
SUB_DEPARTMENT_ID
from
oa_supervision_department osd
where
osd.SUP_DEPARTMENT_ID = #{SUP_DEPARTMENT_ID}
and osd.ISDELETE = '0'
and osd.CORPINFO_ID = #{CORPINFO_ID}
) or f.USER_ID = #{USER_ID})
</otherwise>
</choose>
</when>
<when test='ISLEADER != null and ISLEADER != "" and ISLEADER == "1"'>
and
f.DEPARTMENT_ID in
<foreach item="item" index="index"
collection="DEPARTMENT_IDS" open="(" separator="," close=")">
'${item}'
</foreach>
</when>
<when test="DEPARTMENT_ID != null and DEPARTMENT_ID != ''">
and
f.DEPARTMENT_ID = #{DEPARTMENT_ID}
and f.USER_ID = #{USER_ID}
</when>
<otherwise>
</otherwise>
</choose>
<if test="SUB_DEPARTMENT_IDS != null and SUB_DEPARTMENT_IDS != ''">
and f.DEPARTMENT_ID = #{SUB_DEPARTMENT_IDS}
</if>
<if test="USERNAME != null and USERNAME != ''">
and u.NAME LIKE CONCAT(CONCAT('%', #{USERNAME}),'%')
</if>
<if test="KEYWORDS != null and KEYWORDS != ''">
and f.NAME LIKE CONCAT(CONCAT('%', #{KEYWORDS}),'%')
</if>
<if test="STATUS != null and STATUS != ''"><!-- 关键词检索 -->
<choose>
<when test='STATUS=="1"'>
AND getCheckedNum(f.LISTMANAGER_ID) &gt; 0
</when>
<when test='STATUS=="0"'>
AND getCheckedNum(f.LISTMANAGER_ID) = 0
</when>
<otherwise>
</otherwise>
</choose>
</if>
<if test="LISTINGLEVEL != null and LISTINGLEVEL != ''"><!-- 关键词检索 -->
<choose>
<when test='LISTINGLEVEL == "1"'>
and d.LEVEL = ''
</when>
<otherwise>
and d.LEVEL = #{LISTINGLEVEL}
</otherwise>
</choose>
</if>
AND f.ISDELETE = '0'
union all
select
f.CUSTOM_ID, f.NAME, f.PERIOD, f.TYPE, f.CORPINFO_ID,
f.CREATOR, f.CREATTIME, f.OPERATOR, f.OPERATTIME, f.ISDELETE,
f.DEPARTMENT_ID, f.POST_ID, f.USER_ID,
f.START_DATE, f.END_DATE, f.SCREENTYPE,
f.BAO_BAO_DEPARTMENT_ID, f.BAO_BAO_USER_ID, f.BAO_BAO_TYPE, f.TASK_TYPE,
p.NAME PERIODNAME,
t.NAME TYPENAME,
d.NAME as DEPARTMENT_NAME,
d.LEVEL as DEPARTMENT_LEVEL,
sp.NAME
AS POST_NAME,
u.NAME USER_NAME,
(select count(1) from BUS_HIDDENDANGERCHECKSTANDARD_CUSTOM_ITEM
ch where ch.CUSTOM_ID=f.CUSTOM_ID and ch.ISDELETE =0) as
count,
getStandardCheckedNum(f.CUSTOM_ID) checkCount
from
BUS_HIDDENDANGERCHECKSTANDARD_CUSTOM f
left join sys_dictionaries p on f.PERIOD = p.BIANMA
left join sys_dictionaries t on f.TYPE = t.BIANMA
left join OA_DEPARTMENT d on d.DEPARTMENT_ID=f.DEPARTMENT_ID
left join sys_user u on u.USER_ID = f.USER_ID
left join SYS_POST sp on sp.POST_ID=f.POST_ID
where (f.TYPE != 'listType0005'
or (f.START_DATE &lt;= DATE_FORMAT(NOW(),'%Y-%m-%d') and f.END_DATE
&gt;= DATE_FORMAT(NOW(),'%Y-%m-%d') ))
<!-- <if test="POST_ID != null and POST_ID != ''">关键词检索 -->
<!-- and -->
<!-- ( -->
<!-- f.POST_ID = #{POST_ID} -->
<!-- ) -->
<!-- </if> -->
<if test="CORPINFO_ID != null and CORPINFO_ID != ''">
and f.CORPINFO_ID = #{CORPINFO_ID}
</if>
<!-- <if test="USER_ID != null and USER_ID != ''">&lt;!&ndash; 部门查询条件 &ndash;&gt;-->
<!-- and f.USER_ID = #{USER_ID}-->
<!-- </if>-->
<choose>
<when test='ISSUPERVISE != null and ISSUPERVISE != "" and ISSUPERVISE == "1"'>
<choose>
<when test='ISLEADER != null and ISLEADER != "" and ISLEADER == "1"'>
and
((f.DEPARTMENT_ID in (
select
SUB_DEPARTMENT_ID
from
oa_supervision_department osd
where
osd.SUP_DEPARTMENT_ID = #{SUP_DEPARTMENT_ID}
and osd.ISDELETE = '0'
and osd.CORPINFO_ID = #{CORPINFO_ID}
)) or (
f.DEPARTMENT_ID in
<foreach item="item" index="index"
collection="DEPARTMENT_IDS" open="(" separator="," close=")">
'${item}'
</foreach>
))
</when>
<otherwise>
and
(f.DEPARTMENT_ID in (
select
SUB_DEPARTMENT_ID
from
oa_supervision_department osd
where
osd.SUP_DEPARTMENT_ID = #{SUP_DEPARTMENT_ID}
and osd.ISDELETE = '0'
and osd.CORPINFO_ID = #{CORPINFO_ID}
) or f.USER_ID = #{USER_ID})
</otherwise>
</choose>
</when>
<when test='ISLEADER != null and ISLEADER != "" and ISLEADER == "1"'>
and
f.DEPARTMENT_ID in
<foreach item="item" index="index"
collection="DEPARTMENT_IDS" open="(" separator="," close=")">
'${item}'
</foreach>
</when>
<when test="DEPARTMENT_ID != null and DEPARTMENT_ID != ''">
and
f.DEPARTMENT_ID = #{DEPARTMENT_ID}
and f.USER_ID = #{USER_ID}
</when>
<otherwise>
</otherwise>
</choose>
<if test="SUB_DEPARTMENT_IDS != null and SUB_DEPARTMENT_IDS != ''">
and f.DEPARTMENT_ID = #{SUB_DEPARTMENT_IDS}
</if>
<if test="USERNAME != null and USERNAME != ''">
and u.NAME LIKE CONCAT(CONCAT('%', #{USERNAME}),'%')
</if>
<if test="KEYWORDS != null and KEYWORDS != ''">
and f.NAME LIKE CONCAT(CONCAT('%', #{KEYWORDS}),'%')
</if>
<if test="STATUS != null and STATUS != ''"><!-- 关键词检索 -->
<choose>
<when test='STATUS=="1"'>
AND getStandardCheckedNum(f.CUSTOM_ID) &gt; 0
</when>
<when test='STATUS=="0"'>
AND getStandardCheckedNum(f.CUSTOM_ID) = 0
</when>
<otherwise>
</otherwise>
</choose>
</if>
<if test="LISTINGLEVEL != null and LISTINGLEVEL != ''"><!-- 关键词检索 -->
<choose>
<when test='LISTINGLEVEL == "1"'>
and d.LEVEL = ''
</when>
<otherwise>
and d.LEVEL = #{LISTINGLEVEL}
</otherwise>
</choose>
</if>
AND f.ISDELETE = '0'
) z
order by z.USER_ID= #{orderUserId} desc ,z.CREATTIME desc ,z.DEPARTMENT_ID asc
</select>
</mapper> </mapper>

View File

@ -3737,4 +3737,313 @@
order by z.CREATTIME desc order by z.CREATTIME desc
</select> </select>
<!-- 根据用户ID获取待整改隐患app首页 -->
<select id="getRiskStandardCountByRectifiCationorId" parameterType="pd" resultType="pd">
SELECT
f.CREATOR,f.STATE
FROM
BUS_HIDDEN f
WHERE f.ISDELETE = '0' and f.STATE != '0' and f.HIDDENLEVEL = 'hiddenLevel0001'
<if test="DEPARTMENT_IDS != null and DEPARTMENT_IDS != ''"><!-- 关键词检索 -->
and
(
f.RECTIFICATIONDEPT in
<foreach item="item" index="index" collection="DEPARTMENT_IDS" open="(" separator="," close=")">
#{item}
</foreach>
or f.RECTIFICATIONOR = #{SELFUSERID}
)
</if>
<if test="SELFUSERID != null and SELFUSERID != ''">
and f.RECTIFICATIONOR = #{SELFUSERID}
</if>
<if test="CORPINFO_ID != null and CORPINFO_ID != ''">
and f.CORPINFO_ID =#{CORPINFO_ID}
</if>
union all
SELECT
f.CREATOR,f.STATE
FROM
BUS_HIDDENDANGERCHECKSTANDARD_HIDDEN f
WHERE f.ISDELETE = '0' and f.STATE != '0' and f.HIDDENLEVEL = 'hiddenLevel0001'
<if test="DEPARTMENT_IDS != null and DEPARTMENT_IDS != ''"><!-- 关键词检索 -->
and
(
f.RECTIFICATIONDEPT in
<foreach item="item" index="index" collection="DEPARTMENT_IDS" open="(" separator="," close=")">
#{item}
</foreach>
or f.RECTIFICATIONOR = #{SELFUSERID}
)
</if>
<if test="SELFUSERID != null and SELFUSERID != ''">
and f.RECTIFICATIONOR = #{SELFUSERID}
</if>
<if test="CORPINFO_ID != null and CORPINFO_ID != ''">
and f.CORPINFO_ID =#{CORPINFO_ID}
</if>
</select>
<!-- 根据用户ID获取待验收隐患app首页 -->
<select id="getRiskStandardCountByCheckorId" parameterType="pd" resultType="pd">
SELECT
f.CREATOR,f.STATE
FROM
BUS_HIDDEN f
WHERE f.ISDELETE = '0' and f.STATE != '0'
<if test="SELFUSERID != null and SELFUSERID != ''">
and (select count(1) from BUS_HIDDENCHECK bh where bh.USER_ID=#{SELFUSERID} and bh.HIDDEN_ID=f.HIDDEN_ID and bh.STATUS=0)>0
</if>
<if test="CORPINFO_ID != null and CORPINFO_ID != ''">
and f.CORPINFO_ID =#{CORPINFO_ID}
</if>
union all
SELECT
f.CREATOR,f.STATE
FROM
BUS_HIDDENDANGERCHECKSTANDARD_HIDDEN f
WHERE f.ISDELETE = '0' and f.STATE != '0'
<if test="SELFUSERID != null and SELFUSERID != ''">
and (select count(1) from BUS_HIDDENDANGERCHECKSTANDARD_HIDDENCHECK bh where bh.USER_ID=#{SELFUSERID} and bh.HIDDEN_ID=f.HIDDEN_ID and bh.STATUS=0)>0
</if>
<if test="CORPINFO_ID != null and CORPINFO_ID != ''">
and f.CORPINFO_ID =#{CORPINFO_ID}
</if>
</select>
<!-- 根据用户ID获取待确认隐患app首页 -->
<select id="getRiskStandardCountByConfirmId" parameterType="pd" resultType="com.zcloud.entity.PageData">
SELECT
f.CREATOR,f.STATE
FROM
BUS_HIDDEN f
WHERE f.ISDELETE = '0' and f.STATE = '-2'
and HIDDENLEVEL not in ('jdyh001','hiddenLevel2002')
<if test="SELFUSERID != null and SELFUSERID != ''">
and f.CONFIRM_USER = #{SELFUSERID}
</if>
<if test="CORPINFO_ID != null and CORPINFO_ID != ''">
and f.CORPINFO_ID = #{CORPINFO_ID}
</if>
union all
SELECT
f.CREATOR,f.STATE
FROM
BUS_HIDDENDANGERCHECKSTANDARD_HIDDEN f
WHERE f.ISDELETE = '0' and f.STATE = '-2'
and HIDDENLEVEL not in ('jdyh001','hiddenLevel2002')
<if test="SELFUSERID != null and SELFUSERID != ''">
and f.CONFIRM_USER = #{SELFUSERID}
</if>
<if test="CORPINFO_ID != null and CORPINFO_ID != ''">
and f.CORPINFO_ID = #{CORPINFO_ID}
</if>
</select>
<!--根据用户ID获取特殊处理隐患和延期隐患app首页-->
<select id="getRiskStandardCountSpecialByhId" parameterType="pd" resultType="com.zcloud.entity.PageData">
SELECT
f.CREATOR,f.STATE,exa.TYPE
FROM
BUS_HIDDENEXAMINE exa
left join BUS_HIDDEN f on exa.HIDDEN_ID = f.HIDDEN_ID
LEFT JOIN sys_user confirmUser on confirmUser.USER_ID = f.CONFIRM_USER <!-- 隐患确认人 -->
LEFT JOIN bus_hiddencheck hch on hch.HIDDEN_ID = f.HIDDEN_ID
left join bus_hidden_user bhu on bhu.HIDDEN_ID = f.HIDDEN_ID
WHERE
f.ISDELETE = '0'
and f.state != '0'
and exa.TYPE in ('1','2')
and exa.STATE = '-1'
<if test="roleLevel != null and roleLevel != ''"><!-- 权限显示 -->
<choose>
<when test='roleLevel == "0" '>
</when>
<when test='roleLevel == "1"'>
<if test="supDeparIds != null and supDeparIds != ''">
and (confirmUser.DEPARTMENT_ID in (${supDeparIds}) or bhu.DEPARTMENT_ID in (${supDeparIds}) or f.RECTIFICATIONDEPT in (${supDeparIds}) or hch.DEPARTMENT_ID in (${supDeparIds}))
</if>
</when>
<when test='roleLevel == "2"'>
<if test="SELFUSERID != null and SELFUSERID != ''">
and (bhu.USER_ID = #{SELFUSERID} or f.CONFIRM_USER = #{SELFUSERID} or f.RECTIFICATIONOR = #{SELFUSERID} or f.CHECKOR = #{SELFUSERID} )
</if>
</when>
</choose>
</if>
<if test="userId != null and userId != ''"><!-- 隐患确认人 -->
and f.CONFIRM_USER = #{userId}
</if>
and f.state != '0'
and f.state not in ('100','101','102')
and f.CORPINFO_ID = #{CORPINFO_ID}
union all
SELECT
f.CREATOR,f.STATE,exa.TYPE
FROM
BUS_HIDDENDANGERCHECKSTANDARD_HIDDENEXAMINE exa
left join BUS_HIDDENDANGERCHECKSTANDARD_HIDDEN f on exa.HIDDEN_ID = f.HIDDEN_ID
LEFT JOIN sys_user confirmUser on confirmUser.USER_ID = f.CONFIRM_USER <!-- 隐患确认人 -->
LEFT JOIN BUS_HIDDENDANGERCHECKSTANDARD_HIDDENCHECK hch on hch.HIDDEN_ID = f.HIDDEN_ID
left join BUS_HIDDENDANGERCHECKSTANDARD_HIDDEN_USER bhu on bhu.HIDDEN_ID = f.HIDDEN_ID
WHERE
f.ISDELETE = '0'
and f.state != '0'
and exa.TYPE in ('1','2')
and exa.STATE = '-1'
<if test="roleLevel != null and roleLevel != ''"><!-- 权限显示 -->
<choose>
<when test='roleLevel == "0" '>
</when>
<when test='roleLevel == "1"'>
<if test="supDeparIds != null and supDeparIds != ''">
and (confirmUser.DEPARTMENT_ID in (${supDeparIds}) or bhu.DEPARTMENT_ID in (${supDeparIds}) or f.RECTIFICATIONDEPT in (${supDeparIds}) or hch.DEPARTMENT_ID in (${supDeparIds}))
</if>
</when>
<when test='roleLevel == "2"'>
<if test="SELFUSERID != null and SELFUSERID != ''">
and (bhu.USER_ID = #{SELFUSERID} or f.CONFIRM_USER = #{SELFUSERID} or f.RECTIFICATIONOR = #{SELFUSERID} or f.CHECKOR = #{SELFUSERID} )
</if>
</when>
</choose>
</if>
<if test="userId != null and userId != ''"><!-- 隐患确认人 -->
and f.CONFIRM_USER = #{userId}
</if>
and f.state != '0'
and f.state not in ('100','101','102')
and f.CORPINFO_ID = #{CORPINFO_ID}
</select>
<!-- 根据用户ID获取发现隐患信息app首页 -->
<select id="getRiskStandardCountByCreatorId" parameterType="pd" resultType="pd">
SELECT
f.CREATOR,f.STATE
FROM
BUS_HIDDEN f
WHERE f.ISDELETE = '0' and f.STATE != '0' and f.HIDDENLEVEL = 'hiddenLevel0001'
<if test="APPSELFUSERID != null and APPSELFUSERID != ''">
and
f.CREATOR = #{APPSELFUSERID}
</if>
<choose>
<when test='ISMAIN != null and ISMAIN != "" and ISMAIN == "1"'>
<if test="DEPT_IDS != null and DEPT_IDS != ''">
and
f.HIDDENFINDDEPT in
<foreach item="item" index="index"
collection="DEPT_IDS" open="(" separator="," close=")">
'${item}'
</foreach>
</if>
</when>
<otherwise>
<choose>
<when test='ISSUPERVISE != null and ISSUPERVISE != "" and ISSUPERVISE == "1"'>
<choose>
<when test="DEPT_IDS != null and DEPT_IDS != ''">
and
f.HIDDENFINDDEPT in
<foreach item="item" index="index"
collection="DEPT_IDS" open="(" separator="," close=")">
'${item}'
</foreach>
</when>
<otherwise>
and
f.HIDDENFINDDEPT in (
select
SUB_DEPARTMENT_ID
from
oa_supervision_department osd
where
osd.SUP_DEPARTMENT_ID = #{DEPARTMENT_ID}
and osd.ISDELETE = '0'
and osd.CORPINFO_ID = #{CORPINFO_ID}
)
</otherwise>
</choose>
</when>
<when test="DEPARTMENT_ID != null and DEPARTMENT_ID != ''">
and f.HIDDENFINDDEPT=#{DEPARTMENT_ID}
</when>
<otherwise>
</otherwise>
</choose>
</otherwise>
</choose>
<if test="CORPINFO_ID != null and CORPINFO_ID != ''">
and f.CORPINFO_ID =#{CORPINFO_ID}
</if>
union all
SELECT
f.CREATOR,f.STATE
FROM
BUS_HIDDENDANGERCHECKSTANDARD_HIDDEN f
WHERE f.ISDELETE = '0' and f.STATE != '0' and f.HIDDENLEVEL = 'hiddenLevel0001'
<if test="APPSELFUSERID != null and APPSELFUSERID != ''">
and
f.CREATOR = #{APPSELFUSERID}
</if>
<choose>
<when test='ISMAIN != null and ISMAIN != "" and ISMAIN == "1"'>
<if test="DEPT_IDS != null and DEPT_IDS != ''">
and
f.HIDDENFINDDEPT in
<foreach item="item" index="index"
collection="DEPT_IDS" open="(" separator="," close=")">
'${item}'
</foreach>
</if>
</when>
<otherwise>
<choose>
<when test='ISSUPERVISE != null and ISSUPERVISE != "" and ISSUPERVISE == "1"'>
<choose>
<when test="DEPT_IDS != null and DEPT_IDS != ''">
and
f.HIDDENFINDDEPT in
<foreach item="item" index="index"
collection="DEPT_IDS" open="(" separator="," close=")">
'${item}'
</foreach>
</when>
<otherwise>
and
f.HIDDENFINDDEPT in (
select
SUB_DEPARTMENT_ID
from
oa_supervision_department osd
where
osd.SUP_DEPARTMENT_ID = #{DEPARTMENT_ID}
and osd.ISDELETE = '0'
and osd.CORPINFO_ID = #{CORPINFO_ID}
)
</otherwise>
</choose>
</when>
<when test="DEPARTMENT_ID != null and DEPARTMENT_ID != ''">
and f.HIDDENFINDDEPT=#{DEPARTMENT_ID}
</when>
<otherwise>
</otherwise>
</choose>
</otherwise>
</choose>
<if test="CORPINFO_ID != null and CORPINFO_ID != ''">
and f.CORPINFO_ID =#{CORPINFO_ID}
</if>
</select>
</mapper> </mapper>