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.
udi-spms-java/src/main/java/com/glxp/api/controller/auth/AuthAdminController.java

61 lines
2.6 KiB
Java

2 years ago
package com.glxp.api.controller.auth;
import cn.hutool.core.bean.BeanUtil;
2 years ago
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);
2 years ago
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) {
2 years ago
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);
}
2 years ago
}