From 1e848dde7598cf481a79385a9caebc9651db63cb Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Wed, 15 Sep 2021 10:33:49 +0800
Subject: [PATCH] 新增查询单个辖区内预警分页信息接口

---
 src/main/java/org/springblade/modules/information/mapper/InformationMapper.xml |   96 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 96 insertions(+), 0 deletions(-)

diff --git a/src/main/java/org/springblade/modules/information/mapper/InformationMapper.xml b/src/main/java/org/springblade/modules/information/mapper/InformationMapper.xml
index 25f99ac..e9880b8 100644
--- a/src/main/java/org/springblade/modules/information/mapper/InformationMapper.xml
+++ b/src/main/java/org/springblade/modules/information/mapper/InformationMapper.xml
@@ -1986,4 +1986,100 @@
             and (sj.id = #{information.jurisdiction} or sj.parent_id = #{information.jurisdiction})
         </if>
     </select>
+
+    <sql id="getSubstationWarn">
+        left join
+            sys_information si
+            on
+            si.departmentid = bu.dept_id
+            left join
+            sys_jurisdiction sj
+            on
+            sj.id = si.jurisdiction
+            where
+            1=1
+            and (si.stats = 2 or si.stats =4)
+            and bu.is_deleted = 0
+            and bu.`status` = 1
+    </sql>
+
+    <!--根据辖区查询统计当前辖区下的保安公司(本市保安公司,分公司)预警信息,包含(未持证,现实表现差,未缴纳社保,资格审查异常)-->
+    <select id="getSubstationWarnInfoPage" resultType="org.springblade.modules.information.vo.InformationVO">
+        select jurisdictionName,enterprisename,detail from (
+        (
+        select
+        si.jurisdiction id,
+        sj.parent_id,
+        sj.dept_name jurisdictionName,
+        si.enterprisename,
+        "表现差" detail
+        from sys_performance sp
+        left join
+        blade_user bu
+        on
+        bu.id = sp.securityId
+        left join
+        sys_information si
+        on
+        bu.dept_id = si.departmentid
+        left join
+        sys_jurisdiction sj
+        on
+        sj.id = si.jurisdiction
+        where
+        1=1
+        and (si.stats = 2 or si.stats =4)
+        and bu.is_deleted = 0
+        and bu.`status` = 1
+        and sp.score = 3
+        )
+
+        union
+        (
+        select
+        sj.id,
+        sj.parent_id,
+        sj.dept_name jurisdictionName,
+        si.enterprisename,
+        if(bu.hold=2,"未持证","证件吊销") as detail
+        from
+        blade_user bu
+        <include refid="getSubstationWarn"/>
+        and (bu.hold = 2 or bu.hold = 3)
+        )
+
+
+        union
+        (
+        select
+        sj.id,
+        sj.parent_id,
+        sj.dept_name jurisdictionName,
+        si.enterprisename,
+        "未缴纳社保" as detail
+        from
+        blade_user bu
+        <include refid="getSubstationWarn"/>
+        and bu.soil = 1
+        )
+
+        union
+        (
+        select
+        sj.id,
+        sj.parent_id,
+        sj.dept_name jurisdictionName,
+        si.enterprisename,
+        "审查异常" as detail
+        from
+        blade_user bu
+        <include refid="getSubstationWarn"/>
+        and bu.examination_type = 1
+        )
+        ) a
+        where 1=1
+        <if test="information.jurisdiction!=null and information.jurisdiction!='' and information.jurisdiction!='1372091709474910209'">
+            and (a.id = #{information.jurisdiction} or a.parent_id = #{information.jurisdiction})
+        </if>
+    </select>
 </mapper>

--
Gitblit v1.9.3