liurunyu
2023-11-14 fb5fd21a5515976a50e31c02bbea69a17833fbd5
pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/role/RoleCtrl.java
@@ -186,6 +186,41 @@
    }
    /**
     * 设置角色权限
     * @param id 角色ID
     * @return 是否成功
     */
    @Operation(summary = "设置角色权限", description = "提交角色ID,及所选择的权限ID集合(数组)")
    @ApiResponses(value = {
            @ApiResponse(
                    responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
                    description = "操作结果:true:成功,false:失败(BaseResponse.content)",
                    content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
                            schema = @Schema(implementation = Boolean.class))}
            )
    })
    @GetMapping(path = "setPrivs", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    @SsoAop("-1")//@SsoAop(power = "-1")
    public BaseResponse<Boolean> setPrivileges(@Parameter(description = "实体id", required = true) Long id,
                                          @Parameter(description = "权限id数组") Long[] privIds){
        Long[] privIds_lg = null ;
        if(privIds != null && privIds.length > 0){
            privIds_lg = new Long[privIds.length] ;
            int index = 0 ;
            for(Long privId : privIds){
                privIds_lg[index++] = privId ;
            }
        }
        try {
            this.sv.setRoles(id, privIds_lg);
        } catch (Exception e) {
            log.error("保存用户异常", e);
            return BaseResponseUtils.buildException(e.getMessage()) ;
        }
        return BaseResponseUtils.buildSuccess(true) ;
    }
    /**
     * 删除角色
     * @param id 角色ID