FengChaoYu před 4 týdny
rodič
revize
fafe0cc191

+ 2 - 1
src/main/java/com/gree/mall/manager/controller/admin/AdminRoleController.java

@@ -30,10 +30,11 @@ public class AdminRoleController {
             @ApiParam(value = "商户名称") @RequestParam(required = false) String companyName,
             @ApiParam(value = "上级商户") @RequestParam(required = false) String adminCompanyId,
             @ApiParam(value = "适用机构 2:商家 1:商户 0:平台") @RequestParam(required = false) Integer type,
+            @ApiParam(value = "显示全部能见角色 true=显示 false=不显示") @RequestParam(required = false, defaultValue = "false") Boolean canShow,
             @ApiParam(value = "页号", required = true) @RequestParam Integer pageNum,
             @ApiParam(value = "页大小", required = true) @RequestParam Integer pageSize
     ) throws RemoteServiceException {
-        IPage<AdminRole> adminRoleIPage = adminRoleLogic.listPage(request, companyName, adminCompanyId, type, pageNum, pageSize);
+        IPage<AdminRole> adminRoleIPage = adminRoleLogic.listPage(request, companyName, adminCompanyId, type, canShow, pageNum, pageSize);
         return ResponseHelper.success(adminRoleIPage);
     }
 

+ 3 - 2
src/main/java/com/gree/mall/manager/logic/admin/AdminRoleLogic.java

@@ -36,7 +36,8 @@ public class AdminRoleLogic {
     /**
      * 角色列表
      */
-    public IPage<AdminRole> listPage(HttpServletRequest request, String companyName, String adminCompanyId, Integer type, Integer pageNo, Integer pageSize) {
+    public IPage<AdminRole> listPage(HttpServletRequest request, String companyName, String adminCompanyId, Integer type,
+                                     Boolean canShow, Integer pageNo, Integer pageSize) {
         AdminUserCom adminUser = commonLogic.getAdminUser(request);
         List<String> companyIds = adminUser.getAdminCompanyIds();
 
@@ -48,7 +49,7 @@ public class AdminRoleLogic {
                 .eq(Objects.nonNull(type), AdminRole::getType, type)
                 .ge(userType > 0, AdminRole::getType, userType)
                 .and(CollectionUtils.isNotEmpty(companyIds), v -> {
-                    if (!adminUser.getUserName().equals("admin") && adminUser.getType().equals(0)) {
+                    if (!adminUser.getUserName().equals("admin") && adminUser.getType().equals(0) || canShow) {
                         v.in(CollectionUtils.isNotEmpty(companyIds), AdminRole::getCompanyId, companyIds)
                                 .or()
                                 .isNull(AdminRole::getCompanyId);