智慧保安后台管理-验收版本
Administrator
2021-09-18 dae145fda8a0102c8cb396acce37d6219cf6be88
src/main/java/org/springblade/modules/information/mapper/InformationMapper.xml
@@ -2438,16 +2438,81 @@
    </select>
    <!--持证率低于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 e.id,e.parent_id,count(*) count from (-->
    <!--                select d.*,ifnull(FORMAT((num2/num1)*100,2),0) num3,sj.* from (-->
    <!--                    select a.dept_id,ifnull(a.count,0) num1,ifnull(b.count,0) num2 from-->
    <!--                    (-->
    <!--                    select-->
    <!--                    bu.dept_id,ifnull(count(*),0) count-->
    <!--                    from blade_user bu-->
    <!--                    left join blade_role br-->
    <!--                    on bu.role_id = br.id-->
    <!--                    where-->
    <!--                    role_alias = "安保人员"-->
    <!--                    and bu.is_deleted = 0-->
    <!--                    and bu.`status` = 1-->
    <!--                    group by dept_id-->
    <!--                    ) a-->
    <!--                    left join-->
    <!--                    (-->
    <!--                    select-->
    <!--                    bu.dept_id,ifnull(count(*),0) count-->
    <!--                    from blade_user bu-->
    <!--                    left join blade_role br-->
    <!--                    on bu.role_id = br.id-->
    <!--                    where-->
    <!--                    role_alias = "安保人员"-->
    <!--                    and bu.is_deleted = 0-->
    <!--                    and bu.`status` = 1-->
    <!--                    <if test="type==1">-->
    <!--                        and bu.hold = 1-->
    <!--                    </if>-->
    <!--                    <if test="type==2">-->
    <!--                        and bu.dispatch = 0-->
    <!--                    </if>-->
    <!--                    <if test="type==3">-->
    <!--                        and bu.soil = 0-->
    <!--                    </if>-->
    <!--                    group by dept_id-->
    <!--                    ) b-->
    <!--                    on-->
    <!--                    a.dept_id = b.dept_id-->
    <!--                )d-->
    <!--                left join-->
    <!--                sys_information si-->
    <!--                on-->
    <!--                si.departmentid = d.dept_id-->
    <!--                left join-->
    <!--                sys_jurisdiction sj-->
    <!--                on-->
    <!--                sj.id = si.jurisdiction-->
    <!--                and (stats = 2 or stats=4)-->
    <!--            )e-->
    <!--            where e.num3 &lt; 50-->
    <!--            group by e.id-->
    <!--        ) f-->
    <!--            on-->
    <!--        g.id = f.parent_id-->
    <!--    </select>-->
    <!--持证率低于50%,社保缴纳率低于50%,派遣率低于50%-->
    <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 e.id,e.parent_id,count(*) count from (
        select d.*,ifnull(FORMAT((num2/num1)*100,2),0) num3,sj.* from (
        select a.dept_id,ifnull(a.count,0) num1,ifnull(b.count,0) num2 from
        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 sys_information si
        left join
        (
        select
        bu.dept_id,ifnull(count(*),0) count
@@ -2460,6 +2525,8 @@
        and bu.`status` = 1
        group by dept_id
        ) a
        on
        si.departmentid = a.dept_id
        left join
        (
@@ -2484,20 +2551,16 @@
        group by dept_id
        ) b
        on
        a.dept_id = b.dept_id
        )d
        left join
        sys_information si
        on
        si.departmentid = d.dept_id
        si.departmentid = b.dept_id
        left join
        sys_jurisdiction sj
        on
        sj.id = si.jurisdiction
        where 1=1
        and (stats = 2 or stats=4)
        )e
        where e.num3 &lt; 50
        group by e.id
        )c
        where c.num3 &lt; 50
        group by c.id
        ) f
        on
        g.id = f.parent_id