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