From 8ca760dccf4e8d53257dc1e6cebcf9183bf6bdd2 Mon Sep 17 00:00:00 2001 From: lxd <1004405501@qq.com> Date: Fri, 23 May 2025 10:19:19 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=AA=8C=E8=AF=81=E6=9C=BA?= =?UTF-8?q?=E6=9E=84orgid=E6=98=AF=E5=90=A6=E5=AD=98=E5=9C=A8=E6=96=B9?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/admin/dept/DeptController.java | 6 ++++++ .../module/system/service/dept/DeptService.java | 4 ++++ .../system/service/dept/DeptServiceImpl.java | 15 +++++++++++++++ 3 files changed, 25 insertions(+) diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dept/DeptController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dept/DeptController.java index 9192e2d8ff..0bc2a5bf72 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dept/DeptController.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dept/DeptController.java @@ -52,6 +52,12 @@ public class DeptController { deptService.deleteDept(id); return success(true); } + @GetMapping("/verifyOrgid") + @Operation(summary = "验证机构ID是否存在") + public CommonResult validateOrgIdExists(String orgId) { + boolean isExist = deptService.validateOrgIdExists(orgId); + return success(isExist); + } @GetMapping("/list") @Operation(summary = "获取部门列表") diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dept/DeptService.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dept/DeptService.java index a0b765e590..303b38a963 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dept/DeptService.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dept/DeptService.java @@ -35,6 +35,10 @@ public interface DeptService { * @param id 部门编号 */ void deleteDept(Long id); + /* + * 验证机构orgid是否存在 + * */ + Boolean validateOrgIdExists(String orgId); /** * 获得部门信息 diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dept/DeptServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dept/DeptServiceImpl.java index 94a443535c..d8fa19cdde 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dept/DeptServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/dept/DeptServiceImpl.java @@ -87,6 +87,21 @@ public class DeptServiceImpl implements DeptService { // 删除部门 deptMapper.deleteById(id); } + @Override + public Boolean validateOrgIdExists(String orgId) + { + if (orgId == null) { + return false; + } + DeptDO dept = deptMapper.selectOne(DeptDO::getOrgid, orgId); + if (dept == null) { + return false; + } + else + { + return true; + } + } @VisibleForTesting void validateDeptExists(Long id) {