From 1ee5a1003b4140cbd23ea9a5d38f6c99f0f77cc6 Mon Sep 17 00:00:00 2001 From: lidongdong <1459917685@qq.com> Date: 星期日, 09 十月 2022 11:23:42 +0800 Subject: [PATCH] 修改组织机构删除 --- flower_city/src/main/java/com/dg/core/controller/OrganizationController.java | 21 ++++++++++++--------- 1 files changed, 12 insertions(+), 9 deletions(-) diff --git a/flower_city/src/main/java/com/dg/core/controller/OrganizationController.java b/flower_city/src/main/java/com/dg/core/controller/OrganizationController.java index 2cd8557..7efd705 100644 --- a/flower_city/src/main/java/com/dg/core/controller/OrganizationController.java +++ b/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; } - - - } -- Gitblit v1.7.1