diff --git a/maku-boot-system/src/main/java/net/maku/system/controller/SysOrgController.java b/maku-boot-system/src/main/java/net/maku/system/controller/SysOrgController.java index 34787e5..c131232 100644 --- a/maku-boot-system/src/main/java/net/maku/system/controller/SysOrgController.java +++ b/maku-boot-system/src/main/java/net/maku/system/controller/SysOrgController.java @@ -84,4 +84,12 @@ public class SysOrgController { return Result.ok(); } + @PostMapping("nameList") + @Operation(summary = "名称列表") + public Result> nameList(@RequestBody List idList) { + List list = sysOrgService.getNameList(idList); + + return Result.ok(list); + } + } \ No newline at end of file diff --git a/maku-boot-system/src/main/java/net/maku/system/service/SysOrgService.java b/maku-boot-system/src/main/java/net/maku/system/service/SysOrgService.java index bdfd9be..0ad29f0 100644 --- a/maku-boot-system/src/main/java/net/maku/system/service/SysOrgService.java +++ b/maku-boot-system/src/main/java/net/maku/system/service/SysOrgService.java @@ -8,23 +8,31 @@ import java.util.List; /** * 机构管理 - * + * * @author 阿沐 babamu@126.com * MAKU */ public interface SysOrgService extends BaseService { - List getList(); + List getList(); - void save(SysOrgVO vo); + void save(SysOrgVO vo); - void update(SysOrgVO vo); + void update(SysOrgVO vo); - void delete(Long id); + void delete(Long id); - /** - * 根据机构ID,获取子机构ID列表(包含本机构ID) - * @param id 机构ID - */ - List getSubOrgIdList(Long id); + /** + * 根据机构ID,获取子机构ID列表(包含本机构ID) + * + * @param id 机构ID + */ + List getSubOrgIdList(Long id); + + /** + * 根据机构ID列表,获取机构名称列表 + * + * @param idList 机构ID列表 + */ + List getNameList(List idList); } \ No newline at end of file diff --git a/maku-boot-system/src/main/java/net/maku/system/service/impl/SysOrgServiceImpl.java b/maku-boot-system/src/main/java/net/maku/system/service/impl/SysOrgServiceImpl.java index 35dd4b3..f10b30d 100644 --- a/maku-boot-system/src/main/java/net/maku/system/service/impl/SysOrgServiceImpl.java +++ b/maku-boot-system/src/main/java/net/maku/system/service/impl/SysOrgServiceImpl.java @@ -107,6 +107,15 @@ public class SysOrgServiceImpl extends BaseServiceImpl return subIdList; } + @Override + public List getNameList(List idList) { + if (idList.isEmpty()) { + return null; + } + + return baseMapper.selectBatchIds(idList).stream().map(SysOrgEntity::getName).toList(); + } + private void getTree(Long id, List orgList, List subIdList) { for (SysOrgEntity org : orgList) { if (ObjectUtil.equals(org.getPid(), id)) {