lidongdong
2022-10-09 1ee5a1003b4140cbd23ea9a5d38f6c99f0f77cc6
flower_city/src/main/java/com/dg/core/controller/OrganizationController.java
@@ -88,6 +88,14 @@
    public ResultData deleteConfigById(@RequestParam(value = "Id",required = false)  String Id)
    {
        Assert.notNull(Id, "Id 不能为空");
        OrganizationChartEntity entity=iOrganizationChartService.selectConfigById(Id);
        List<OrganizationChartEntity> list=iOrganizationChartService.selectConfigList(entity.getId()+"","");
        if(list.size()>0)
        {
            return ResultData.error("该机构下存在其他部门!请先删除子部门");
        }
        return toAjax(iOrganizationChartService.deleteConfigById(Id));
    }
@@ -133,7 +141,7 @@
     */
    @ApiOperation(value = "通过父级id查询对应机构下的全部部门",response = OrganizationChartEntity.class)
    @GetMapping("/getdepartment")
    public TableDataInfo getIds(@RequestParam(value = "department",required = false) String departmentId)
    public TableDataInfo getOrganizations(@RequestParam(value = "department",required = false) String departmentId)
    {
        List<OrganizationChartEntity> ids=new ArrayList<>();
        List<OrganizationChartEntity> lists = iOrganizationChartService.selectConfigList(departmentId,"");
@@ -141,19 +149,17 @@
        {
            lists.add(iOrganizationChartService.selectConfigById(departmentId));
        }
        ids=disposestreetId(lists);
        ids=disposestreet(lists);
        if(ids.size()<1)
        {
            return null;
        }
//        ids.add(streetId);
        ids.add(iOrganizationChartService.selectConfigById(departmentId));
        return getDataTable(ids);
    }
    //递归取id
    private List<OrganizationChartEntity> disposestreetId(List<OrganizationChartEntity> lists)
    private List<OrganizationChartEntity> disposestreet(List<OrganizationChartEntity> lists)
    {
        List<OrganizationChartEntity> ids=new ArrayList<>();
        for (OrganizationChartEntity sysStreet:lists)
@@ -161,7 +167,7 @@
            ids.add(sysStreet);
            if(sysStreet.getChild()!=null && sysStreet.getChild().size()>0)
            {
                ids.addAll(disposestreetId(sysStreet.getChild()));
                ids.addAll(disposestreet(sysStreet.getChild()));
            }
            else
            {
@@ -170,8 +176,5 @@
        }
        return ids;
    }
}