You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
2.6 KiB
Java
61 lines
2.6 KiB
Java
package com.glxp.api.controller.auth;
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
import com.github.pagehelper.PageInfo;
|
|
import com.glxp.api.annotation.AuthRuleAnnotation;
|
|
import com.glxp.api.common.res.BaseResponse;
|
|
import com.glxp.api.common.util.ResultVOUtils;
|
|
import com.glxp.api.entity.auth.AuthRole;
|
|
import com.glxp.api.res.PageSimpleResponse;
|
|
import com.glxp.api.res.auth.AuthAdminRoleResponse;
|
|
import com.glxp.api.service.auth.AuthRoleService;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
import javax.annotation.Resource;
|
|
import java.util.List;
|
|
import java.util.stream.Collectors;
|
|
|
|
/**
|
|
* 管理员相关
|
|
*/
|
|
@RestController
|
|
public class AuthAdminController {
|
|
|
|
@Resource
|
|
private AuthRoleService authRoleService;
|
|
|
|
@AuthRuleAnnotation("admin/auth/admin/customerRoles")
|
|
@GetMapping("/admin/auth/admin/customerRoles")
|
|
public BaseResponse customerRoles(@RequestParam(value = "page", defaultValue = "1") Integer page,
|
|
@RequestParam(value = "limit", defaultValue = "100") Integer limit) {
|
|
|
|
List<AuthRole> authRoleList = authRoleService.listCustomerRoles(page, limit, 1);
|
|
PageInfo<AuthRole> pageInfo = new PageInfo<>(authRoleList);
|
|
PageSimpleResponse<AuthAdminRoleResponse> pageSimpleResponse = new PageSimpleResponse<>();
|
|
pageSimpleResponse.setTotal(pageInfo.getTotal());
|
|
List<AuthAdminRoleResponse> authAdminRoleResponses = BeanUtil.copyToList(authRoleList, AuthAdminRoleResponse.class);
|
|
pageSimpleResponse.setList(authAdminRoleResponses);
|
|
|
|
return ResultVOUtils.success(pageSimpleResponse);
|
|
}
|
|
|
|
|
|
@AuthRuleAnnotation("admin/auth/admin/customerRoles")
|
|
@GetMapping("/admin/auth/admin/customerRolesList")
|
|
public BaseResponse customerRolesList(@RequestParam(value = "page", defaultValue = "1") Integer page,
|
|
@RequestParam(value = "limit", defaultValue = "100") Integer limit) {
|
|
|
|
List<AuthRole> authRoleList = authRoleService.getlistCustomerRoles(page, limit, 1);
|
|
PageInfo<AuthRole> pageInfo = new PageInfo<>(authRoleList);
|
|
PageSimpleResponse<AuthAdminRoleResponse> pageSimpleResponse = new PageSimpleResponse<>();
|
|
pageSimpleResponse.setTotal(pageInfo.getTotal());
|
|
List<AuthAdminRoleResponse> authAdminRoleResponses = BeanUtil.copyToList(authRoleList, AuthAdminRoleResponse.class);
|
|
pageSimpleResponse.setList(authAdminRoleResponses);
|
|
|
|
return ResultVOUtils.success(pageSimpleResponse);
|
|
}
|
|
|
|
}
|