1 package com.supwisdom.institute.backend.admin.bff.api.v1.controller.open;
3 import java.util.ArrayList;
6 import org.springframework.beans.factory.annotation.Autowired;
7 import org.springframework.util.MimeTypeUtils;
8 import org.springframework.web.bind.annotation.RequestMapping;
9 import org.springframework.web.bind.annotation.RequestMethod;
10 import org.springframework.web.bind.annotation.RequestParam;
11 import org.springframework.web.bind.annotation.RestController;
13 import com.supwisdom.institute.backend.admin.bff.api.v1.model.base.Role;
14 import com.supwisdom.institute.backend.admin.bff.api.v1.model.open.SyncRoleModel;
15 import com.supwisdom.institute.backend.admin.bff.api.v1.service.base.AuthnService;
16 import com.supwisdom.institute.backend.admin.bff.api.v1.vo.open.response.data.OpenSyncRolesResponseData;
17 import com.supwisdom.institute.backend.common.framework.vo.response.DefaultApiResponse;
19 import io.swagger.annotations.Api;
20 import io.swagger.annotations.ApiOperation;
22 @Api(value = "BFFOpen", tags = { "open" }, description = "公开接口")
24 @RequestMapping(value = "/api/v1/open/sync")
25 public class OpenSyncController {
28 private AuthnService authnService;
32 value = "获取角色", notes = "获取角色", nickname = "openRoles"
34 @RequestMapping(method = RequestMethod.GET, path = "/roles", produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
35 public DefaultApiResponse<OpenSyncRolesResponseData> roles(
36 @RequestParam(name = "applicationId", required = true) String applicationId) {
38 List<SyncRoleModel> syncRoleModels = new ArrayList<>();
40 List<Role> systemRoles = authnService.roles();
41 for (Role systemRole : systemRoles) {
42 SyncRoleModel syncRoleModel = new SyncRoleModel(
46 systemRole.getMemo());
47 syncRoleModels.add(syncRoleModel);
50 OpenSyncRolesResponseData data = OpenSyncRolesResponseData.of(applicationId, syncRoleModels);
51 return new DefaultApiResponse<OpenSyncRolesResponseData>(data);