处理子系统多角色问题

This commit is contained in:
wanggeng 2022-02-16 11:48:01 +08:00
parent b2b2db4b02
commit 2b823268a0
4 changed files with 9 additions and 8 deletions

View File

@ -24,14 +24,14 @@ public interface IMenuRemoteService {
*
* @param server 服务地址
* @param clientId 客户端ID
* @param userId 用户ID
* @param roleIds 角色ID列表下划线分割
* @param accessToken token
* @return
*/
@RemoteGetMethod("/resource/oauth2client/list-all/{clientId}/{userId}")
@RemoteGetMethod("/resource/oauth2client/list-all/{clientId}/{roleIds}")
List<MenuDTO> listAll(@RemoteServerParams String server,
@RemotePathParams("clientId") String clientId,
@RemotePathParams("userId") String userId,
@RemotePathParams("roleIds") String roleIds,
@RemoteQueryParams("access_token") String accessToken);
}

View File

@ -38,7 +38,7 @@ public class MenuServiceImpl extends DefaultBaseService implements IMenuService
StringBuilder roleIdsSB = new StringBuilder();
for (RoleSimpleDTO role : roles) {
if (roleIdsSB.length() > 0) {
roleIdsSB.append(",");
roleIdsSB.append("_");
}
roleIdsSB.append(role.getRoleId());
}

View File

@ -13,6 +13,7 @@ import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Arrays;
import java.util.List;
/**
@ -34,12 +35,12 @@ public class OAuth2ClientResourceController extends DefaultBaseController {
@ApiOperation(value = "Oauth2客户端菜单列表", notes = "Oauth2客户端菜单列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "clientId", value = "客户端ID", paramType = "path"),
@ApiImplicitParam(name = "roleIds", value = "角色ID列表逗号分割", paramType = "path")
@ApiImplicitParam(name = "roleIds", value = "角色ID列表下划线分割", paramType = "path")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("list-all/{clientId}/{roleIds}")
public List<MenuDTO> list(@PathVariable("clientId") String clientId, @PathVariable("roleIds") List<String> roleIds) throws SearchException {
return oAuth2ClientMenuService.listAll(clientId, roleIds);
public List<MenuDTO> list(@PathVariable("clientId") String clientId, @PathVariable("roleIds") String roleIds) throws SearchException {
return oAuth2ClientMenuService.listAll(clientId, Arrays.asList(roleIds.split("\\_")));
}

View File

@ -162,7 +162,7 @@
gmt_modified = #{gmtModified}
WHERE
client_id IN
<foreach collection="secretIds" index="index" open="(" separator="," close=")">
<foreach collection="clientIds" index="index" open="(" separator="," close=")">
#{secretIds[${index}]}
</foreach>
</delete>