智慧保安后台管理-验收版本
tangzy
2021-09-18 6d7b64bfb11bd582467032c408ca3b1799d1d423
src/main/java/org/springblade/modules/information/mapper/InformationMapper.xml
@@ -1030,33 +1030,65 @@
    <!--资格审查异常数量-->
    <!--    <select id="selectExtype" resultType="java.util.HashMap">-->
    <!--        SELECT COUNT-->
    <!--        (*) as num,-->
    <!--        d.dept_name,-->
    <!--        u.real_name,-->
    <!--        j.dept_name AS jurname-->
    <!--        FROM blade_user u-->
    <!--        LEFT JOIN blade_dept d ON d.id = u.dept_id-->
    <!--        LEFT JOIN sys_jurisdiction j ON j.id = u.jurisdiction-->
    <!--        WHERE u.examination_type = 1 and u.is_deleted=0 and u.status = 1-->
    <!--        <if test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1372091709474910209'">-->
    <!--            and u.jurisdiction in (${jurisdiction})-->
    <!--        </if>-->
    <!--        <if test="deptid!=null and deptid!=''">-->
    <!--            and u.dept_id =#{deptid}-->
    <!--        </if>-->
    <!--        <if test="type!=null and type=='1'.toString()">-->
    <!--            and to_days(u.update_time) = to_days(now())-->
    <!--        </if>-->
    <!--        <if test="type!=null and type=='2'.toString()">-->
    <!--            and DATE_FORMAT(u.update_time, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' )-->
    <!--        </if>-->
    <!--        GROUP BY d.dept_name,u.real_name,-->
    <!--        j.dept_name-->
    <!--    </select>-->
    <select id="selectExtype" resultType="java.util.HashMap">
        SELECT COUNT
        (*) as num,
        d.dept_name,
        u.real_name,
        j.dept_name AS jurname
        FROM blade_user u
        LEFT JOIN blade_dept d ON d.id = u.dept_id
        LEFT JOIN sys_jurisdiction j ON j.id = u.jurisdiction
        WHERE u.examination_type = 1 and u.is_deleted=0 and u.status = 1
        <if test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1372091709474910209'">
            and u.jurisdiction in (${jurisdiction})
        </if>
        <if test="deptid!=null and deptid!=''">
            and u.dept_id =#{deptid}
        </if>
        SELECT
        IFNULL( J.num, 0 ) AS num
        FROM
        ( SELECT departmentid, jurisdiction FROM sys_information GROUP BY departmentid, jurisdiction ) H
        LEFT JOIN (
        SELECT
        COUNT( * ) AS num,
        dept_id
        FROM
        blade_user
        WHERE
        examination_type = 1
        AND is_deleted = 0
        AND STATUS = 1
        <if test="type!=null and type=='1'.toString()">
            and to_days(u.update_time) = to_days(now())
            and to_days(audit_time) = to_days(now())
        </if>
        <if test="type!=null and type=='2'.toString()">
            and DATE_FORMAT(u.update_time, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' )
            and DATE_FORMAT(audit_time, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' )
        </if>
        GROUP BY d.dept_name,u.real_name,
        j.dept_name
        GROUP BY
        dept_id
        ) J ON J.dept_id = H.departmentid
        WHERE 1 = 1
        <if test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1372091709474910209'">
            AND H.jurisdiction in(${jurisdiction})
        </if>
        <if test="deptid!=null and deptid!=''">
            AND H.departmentid = #{deptid}
        </if>
    </select>
    <!--表现差的数量-->
    <select id="selectBx" resultType="java.util.HashMap">
    <!-- <select id="selectBx" resultType="java.util.HashMap">
        SELECT IFNULL(COUNT( * ),0) AS num,
        d.dept_name,
        j.dept_name AS jurname
@@ -1078,7 +1110,7 @@
        </if>
        GROUP BY d.dept_name,
        j.dept_name
    </select>
     </select>-->
    <!--    &lt;!&ndash;查询出所有辖区信息&ndash;&gt;-->
    <!--    <select id="selectJur" resultType="java.util.HashMap">-->
@@ -1086,6 +1118,36 @@
    <!--        FROM sys_jurisdiction-->
    <!--        WHERE id!=1372091709474910209-->
    <!--    </select> -->
    <select id="selectBx" resultType="java.util.HashMap">
        SELECT
        IFNULL( J.num, 0 ) AS num
        FROM
        ( SELECT departmentid, jurisdiction FROM sys_information GROUP BY departmentid, jurisdiction ) H
        LEFT JOIN (
        SELECT
        IFNULL( COUNT( * ), 0 ) AS num,
        u.dept_id
        FROM
        sys_performance p
        INNER JOIN blade_user u ON p.securityId = u.id WHERE 1=1
        <if test="type!=null and type=='1'.toString()">
            and to_days(p.time) = to_days(now())
        </if>
        <if test="type!=null and type=='2'.toString()">
            and DATE_FORMAT(p.time, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' )
        </if>
        GROUP BY
        dept_id
        ) J ON J.dept_id = H.departmentid
        WHERE 1 = 1
        <if test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1372091709474910209'">
            AND H.jurisdiction in(${jurisdiction})
        </if>
        <if test="deptid!=null and deptid!=''">
            AND H.departmentid = #{deptid}
        </if>
    </select>
    <select id="selectExtypeUser" resultType="java.lang.Integer">
        SELECT COUNT(CASE WHEN (examination_mx IS NOT NULL OR examination_mx != "") THEN 1 END) AS sum
@@ -2277,7 +2339,8 @@
        from
        (
            select d.dept_id,count(*) count from (
                select a.dept_id, ifnull(b.count, 0) num1, ifnull(c.count, 0) num2,ifnull(FORMAT((c.count/b.count)*100, 2), 0) num3 from
        select a.dept_id, ifnull(b.count, 0) num1, ifnull(c.count, 0) num2,ifnull(FORMAT((c.count/b.count)*100, 2), 0)
        num3 from
                    (
                    select
                    bu.dept_id, ifnull(count(*), 0) count
@@ -2783,14 +2846,16 @@
    <!--持证率低于50%,社保缴纳率低于50%,派遣率低于50%-->
    <select id="getSecurityHoldAndSoidAndDispatchGroupCountList" resultType="org.springblade.modules.information.vo.ResponseVo">
    <select id="getSecurityHoldAndSoidAndDispatchGroupCountList"
            resultType="org.springblade.modules.information.vo.ResponseVo">
        select g.id,g.dept_name name,ifnull(f.count,0) num
        from
        (select id,dept_name from sys_jurisdiction where parent_id = 1372091709474910209) g
        left join
        (
            select c.id,c.parent_id,count(*) count from (
                select si.enterpriseName,sj.id,sj.parent_id,a.dept_id,ifnull(a.count,0) num1,ifnull(b.count,0) num2,ifnull(FORMAT((b.count/a.count)*100,2),0) num3 from
        select si.enterpriseName,sj.id,sj.parent_id,a.dept_id,ifnull(a.count,0) num1,ifnull(b.count,0)
        num2,ifnull(FORMAT((b.count/a.count)*100,2),0) num3 from
                (
                select
                bu.dept_id,ifnull(count(*),0) count