智慧保安后台管理-外网
钟日健
2021-10-22 f63fff71fcd7a62ad73b0b9eda614f3b1fa3badf
src/main/java/org/springblade/modules/information/mapper/InformationMapper.xml
@@ -177,16 +177,26 @@
        IFNULL( B.num, 0 ) AS bzc
        FROM
        (
        SELECT departmentid, jurisdiction FROM sys_information GROUP BY departmentid, jurisdiction ) H
        LEFT JOIN ( SELECT COUNT(*) AS num, u.dept_id FROM blade_user u WHERE (u.examination_type = 0 or
        SELECT departmentid, jurisdiction FROM sys_information GROUP BY departmentid, jurisdiction
        ) H
        LEFT JOIN
        ( SELECT COUNT(*) AS num, u.dept_id FROM blade_user u WHERE (u.examination_type = 0 or
        u.examination_type is null) and role_id =
        '1412226235153731586' AND `status` = 1 AND is_deleted = 0 GROUP BY u.dept_id
        ) A ON H.departmentid = A.dept_id
        LEFT JOIN ( SELECT COUNT(*) AS num, u.dept_id FROM blade_user u WHERE u.examination_type = 1  and role_id = '1412226235153731586' AND `status` = 1 AND is_deleted = 0 GROUP BY
        ) A
        ON H.departmentid = A.dept_id
        LEFT JOIN
        ( SELECT COUNT(*) AS num, u.dept_id FROM blade_user u WHERE u.examination_type = 1  and role_id = '1412226235153731586' AND `status` = 1 AND is_deleted = 0 GROUP BY
        u.dept_id
        ) B ON H.departmentid = B.dept_id where 1=1
        ) B
        ON H.departmentid = B.dept_id
        left join
        sys_jurisdiction sj
        on
        sj.id = H.jurisdiction
        where 1=1
        <if test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1372091709474910209'">
            and H.jurisdiction = #{jurisdiction}
            and (sj.id = #{jurisdiction} or sj.parent_id = #{jurisdiction})
        </if>
        <if test="deptid!=null and deptid!=''">
            and H.departmentid = #{deptid}
@@ -203,7 +213,8 @@
        (
        SELECT departmentid,jurisdiction FROM sys_information GROUP BY departmentid,jurisdiction
        ) H
        LEFT JOIN(
        LEFT JOIN
        (
        SELECT
        COUNT( * ) AS thisnum,
        dept_id
@@ -216,8 +227,10 @@
        AND hold = 1
        GROUP BY
        dept_id
        ) A ON A.dept_id=H.departmentid
        LEFT JOIN (
        ) A
        ON A.dept_id=H.departmentid
        LEFT JOIN
        (
        SELECT
        COUNT(*) AS lastnum,
        dept_id
@@ -230,13 +243,18 @@
        AND hold = 2
        GROUP BY
        dept_id
        ) B ON B.dept_id=H.departmentid
        ) B
        ON B.dept_id=H.departmentid
        left join
        sys_jurisdiction sj
        on
        sj.id = H.jurisdiction
        where 1=1
        <if test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1372091709474910209'">
            and (sj.id = #{jurisdiction} or sj.parent_id = #{jurisdiction})
        </if>
        <if test="deptid!=null and deptid!=''">
            and H.departmentid = #{deptid}
        </if>
        <if test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1372091709474910209'">
            and H.jurisdiction = #{jurisdiction}
        </if>
    </select>
    <!--派遣服务单位统计-->
@@ -268,7 +286,8 @@
        AND dispatch = 0
        GROUP BY
        dept_id
        ) A ON A.dept_id = H.departmentid
        ) A
        ON A.dept_id = H.departmentid
        LEFT JOIN (
        SELECT
        COUNT( * ) AS lastnum,
@@ -282,9 +301,15 @@
        AND dispatch = 1
        GROUP BY
        dept_id
        ) B ON H.departmentid = B.dept_id where 1=1
        ) B
        ON H.departmentid = B.dept_id
        left join
        sys_jurisdiction sj
        on
        sj.id = H.jurisdiction
        where 1=1
        <if test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1372091709474910209'">
            and H.jurisdiction = #{jurisdiction}
            and (sj.id = #{jurisdiction} or sj.parent_id = #{jurisdiction})
        </if>
        <if test="deptid!=null and deptid!=''">
            and H.departmentid = #{deptid}
@@ -294,20 +319,38 @@
    <select id="selectSoil" resultType="java.util.HashMap">
        SELECT IFNULL(A.numj, 0) as numj,
        IFNULL(B.numwj, 0) as numz
        FROM (SELECT departmentid, jurisdiction FROM sys_information GROUP BY departmentid, jurisdiction) H
        LEFT JOIN (SELECT COUNT(*) AS numj, dept_id
        FROM
        (
        SELECT departmentid, jurisdiction FROM sys_information GROUP BY departmentid, jurisdiction
        ) H
        LEFT JOIN
        (
        SELECT COUNT(*) AS numj, dept_id
        FROM blade_user
        WHERE soil = 0 AND `status` = 1 AND is_deleted = 0 AND role_id = '1412226235153731586'
        GROUP BY dept_id) A ON A.dept_id = H.departmentid
        LEFT JOIN (SELECT COUNT(*) AS numwj, dept_id FROM blade_user WHERE soil = 1 and `status` = 1 AND is_deleted = 0
        AND role_id = '1412226235153731586' GROUP BY
        dept_id) B
        ON H.departmentid = B.dept_id where 1=1
        GROUP BY dept_id
        ) A
        ON A.dept_id = H.departmentid
        LEFT JOIN
        (
        SELECT COUNT(*) AS numwj, dept_id FROM blade_user
        WHERE soil = 1
        and `status` = 1
        AND is_deleted = 0
        AND role_id = '1412226235153731586'
        GROUP BY dept_id
        ) B
        ON H.departmentid = B.dept_id
        left join
        sys_jurisdiction sj
        on
        sj.id = H.jurisdiction
        where 1=1
        <if test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1372091709474910209'">
            and (sj.id = #{jurisdiction} or sj.parent_id = #{jurisdiction})
        </if>
        <if test="deptid!=null and deptid!=''">
            and H.departmentid = #{deptid}
        </if>
        <if test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1372091709474910209'">
            and H.jurisdiction = #{jurisdiction}
        </if>
    </select>
@@ -340,16 +383,21 @@
    <!--查询本年所有月份h合同开始时间的客户数量-->
    <select id="queryYearKh" resultType="java.util.HashMap">
        SELECT
        start_time,
        end_time
        sdu.start_time,
        sdu.end_time
        FROM
        `sys_dispatcher_unit`
        WHERE YEAR (end_time) >='2021'
        sys_dispatcher_unit sdu
        left join
        sys_jurisdiction sj
        on
        sj.id = sdu.jurisdiction
        where 1=1
        and YEAR (end_time) >= #{year}
        <if test="jurisdiction!=null and jurisdiction!='' and jurisdiction!='1372091709474910209'">
            and jurisdiction =#{jurisdiction}
            and (sj.id = #{jurisdiction} or sj.parent_id = #{jurisdiction})
        </if>
        <if test="deptid!=null and deptid!=''">
            and dept_id =#{deptid}
            and sdu.dept_id =#{deptid}
        </if>
    </select>
</mapper>