From 9c90e9bb83a7ded5c441fa38cb9fddaa3f18f813 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=98=BF=E6=B2=90?= Date: Mon, 29 Apr 2024 19:01:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=A7=92=E8=89=B2=E5=90=8D?= =?UTF-8?q?=E7=A7=B0=E5=88=97=E8=A1=A8=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../maku/system/controller/SysRoleController.java | 8 ++++++++ .../net/maku/system/service/SysRoleService.java | 22 +++++++++++++++------- .../system/service/impl/SysRoleServiceImpl.java | 9 +++++++++ 3 files changed, 32 insertions(+), 7 deletions(-) diff --git a/maku-boot-system/src/main/java/net/maku/system/controller/SysRoleController.java b/maku-boot-system/src/main/java/net/maku/system/controller/SysRoleController.java index e7e26c3..82fe0f5 100644 --- a/maku-boot-system/src/main/java/net/maku/system/controller/SysRoleController.java +++ b/maku-boot-system/src/main/java/net/maku/system/controller/SysRoleController.java @@ -159,4 +159,12 @@ public class SysRoleController { return Result.ok(); } + + @PostMapping("nameList") + @Operation(summary = "名称列表") + public Result> nameList(@RequestBody List idList) { + List list = sysRoleService.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/SysRoleService.java b/maku-boot-system/src/main/java/net/maku/system/service/SysRoleService.java index d9c5041..c9e1f92 100644 --- a/maku-boot-system/src/main/java/net/maku/system/service/SysRoleService.java +++ b/maku-boot-system/src/main/java/net/maku/system/service/SysRoleService.java @@ -11,21 +11,29 @@ import java.util.List; /** * 角色 - * + * * @author 阿沐 babamu@126.com * MAKU */ public interface SysRoleService extends BaseService { - PageResult page(SysRoleQuery query); + PageResult page(SysRoleQuery query); - List getList(SysRoleQuery query); + List getList(SysRoleQuery query); - void save(SysRoleVO vo); + void save(SysRoleVO vo); - void update(SysRoleVO vo); + void update(SysRoleVO vo); - void dataScope(SysRoleDataScopeVO vo); + void dataScope(SysRoleDataScopeVO vo); - void delete(List idList); + void delete(List idList); + + /** + * 获取角色名称列表 + * + * @param idList 角色ID列表 + * @return 角色名称列表 + */ + List getNameList(List idList); } diff --git a/maku-boot-system/src/main/java/net/maku/system/service/impl/SysRoleServiceImpl.java b/maku-boot-system/src/main/java/net/maku/system/service/impl/SysRoleServiceImpl.java index ed1b320..25f582f 100644 --- a/maku-boot-system/src/main/java/net/maku/system/service/impl/SysRoleServiceImpl.java +++ b/maku-boot-system/src/main/java/net/maku/system/service/impl/SysRoleServiceImpl.java @@ -125,4 +125,13 @@ public class SysRoleServiceImpl extends BaseServiceImpl getNameList(List idList) { + if (idList.isEmpty()) { + return null; + } + + return baseMapper.selectBatchIds(idList).stream().map(SysRoleEntity::getName).toList(); + } + } \ No newline at end of file