diff --git a/src/main/java/club/joylink/rtss/controller/permission2/AcPermissionController.java b/src/main/java/club/joylink/rtss/controller/permission2/AcPermissionController.java index f8c70675c..c30a53103 100644 --- a/src/main/java/club/joylink/rtss/controller/permission2/AcPermissionController.java +++ b/src/main/java/club/joylink/rtss/controller/permission2/AcPermissionController.java @@ -68,6 +68,16 @@ public class AcPermissionController { return this.permissionService.findPermissionAbilities(permissionId); } + /** + * 查询所有权限列表 + * @param name 模糊匹配权限名称 + * @return + */ + @GetMapping("/all") + public List findAllPermission(@RequestParam(value = "name",required = false) String name) { + return this.permissionService.findAllPermission(name); + } + /** * 删除权限的功能 */ diff --git a/src/main/java/club/joylink/rtss/services/permission/AcPermissionService.java b/src/main/java/club/joylink/rtss/services/permission/AcPermissionService.java index 027442009..d6f1c9dcf 100644 --- a/src/main/java/club/joylink/rtss/services/permission/AcPermissionService.java +++ b/src/main/java/club/joylink/rtss/services/permission/AcPermissionService.java @@ -19,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; +import org.springframework.util.StringUtils; import java.time.LocalDateTime; import java.util.ArrayList; @@ -144,6 +145,16 @@ public class AcPermissionService { permissionSystemAbilityDAO.insertSelective(permissionAddAbility); } + public List findAllPermission(String name){ + PermissionExample example = new PermissionExample(); + if(StringUtils.hasText(name)){ + example.createCriteria().andNameLike(String.format("%s%%",name)); + + } + List list = permissionDAO.selectByExample(example); + return list.stream().map(PermissionConvertor::convertPermissionBasicRspVoFrom).collect(Collectors.toList()); + } + /** * 获取权限的所有功能 *