智慧保安后台管理-外网项目备份
Administrator
2021-11-27 a19eb9f3c3d07363830a274fc0493d311b1a85f8
公司单位人数统计修改
2 files modified
76 ■■■■ changed files
src/main/java/org/springblade/modules/information/mapper/InformationMapper.xml 54 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/information/service/impl/InformationServiceImpl.java 22 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/information/mapper/InformationMapper.xml
@@ -426,7 +426,23 @@
        and role_id = '1412226235153731586'
        and is_deleted = 0
        AND status=1
        and dept_id = #{dept.id}
        and dept_id in
            (
                SELECT
                id
                FROM
                (
                SELECT
                t1.id,t1.parent_id,t1.dept_name,
                IF
                ( find_in_set( parent_id, @pids ) > 0, @pids := concat( @pids, ',', id ), 0 ) AS ischild
                FROM
                ( SELECT id, parent_id,dept_name FROM blade_dept t ORDER BY parent_id, id ) t1,
                ( SELECT @pids := #{dept.id} ) t2
                ) t3
                WHERE
                ischild != 0
            )
    </select>
    <!--查询单位的已派遣人数-->
@@ -437,7 +453,23 @@
        and is_deleted = 0
        AND status=1
        AND dispatch=0
        and dept_id = #{dept.id}
        and dept_id in
            (
                SELECT
                id
                FROM
                (
                SELECT
                t1.id,t1.parent_id,t1.dept_name,
                IF
                ( find_in_set( parent_id, @pids ) > 0, @pids := concat( @pids, ',', id ), 0 ) AS ischild
                FROM
                ( SELECT id, parent_id,dept_name FROM blade_dept t ORDER BY parent_id, id ) t1,
                ( SELECT @pids := #{dept.id} ) t2
                ) t3
                WHERE
                ischild != 0
            )
    </select>
    <!--查询单位持证的人数-->
@@ -448,7 +480,23 @@
        and is_deleted = 0
        AND status=1
        AND hold=1
        and dept_id = #{dept.id}
        and dept_id in
            (
                SELECT
                id
                FROM
                (
                SELECT
                t1.id,t1.parent_id,t1.dept_name,
                IF
                ( find_in_set( parent_id, @pids ) > 0, @pids := concat( @pids, ',', id ), 0 ) AS ischild
                FROM
                ( SELECT id, parent_id,dept_name FROM blade_dept t ORDER BY parent_id, id ) t1,
                ( SELECT @pids := #{dept.id} ) t2
                ) t3
                WHERE
                ischild != 0
            )
    </select>
</mapper>
src/main/java/org/springblade/modules/information/service/impl/InformationServiceImpl.java
@@ -74,17 +74,17 @@
                List<Dept> deptList = baseMapper.getDeptHashChildren(informationVO);
                //有子级
                if (deptList.size()>0){
                    for (Dept dept : deptList) {
                        //查询当前子单位的人数
                        Integer z = baseMapper.selectInformationUserNumCount(dept) + Integer.parseInt(informationVO.getZnum());
                        informationVO.setZnum(z.toString());
                        //已派遣人数
                        Integer p = baseMapper.selectInformationDispatcherNumCount(dept) + Integer.parseInt(informationVO.getPnum());
                        informationVO.setPnum(p.toString());
                        //持证人数
                        Integer c = baseMapper.selectInformationHoldNumCount(dept) + Integer.parseInt(informationVO.getCnum());
                        informationVO.setCnum(c.toString());
                    }
                    Dept dept = new Dept();
                    dept.setId(Long.parseLong(informationVO.getDepartmentid()));
                    //查询当前子单位的人数
                    Integer z = baseMapper.selectInformationUserNumCount(dept) + Integer.parseInt(informationVO.getZnum());
                    informationVO.setZnum(z.toString());
                    //已派遣人数
                    Integer p = baseMapper.selectInformationDispatcherNumCount(dept) + Integer.parseInt(informationVO.getPnum());
                    informationVO.setPnum(p.toString());
                    //持证人数
                    Integer c = baseMapper.selectInformationHoldNumCount(dept) + Integer.parseInt(informationVO.getCnum());
                    informationVO.setCnum(c.toString());
                }
            }
        }