package com.backendsys.modules.system.controller;

import com.backendsys.modules.common.utils.Result;
import com.backendsys.modules.system.service.SysUserRolePermissionService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@Validated
@RestController
@Tag(name = "系统用户角色权限")
public class SysUserRolePermissionController {

    @Autowired
    private SysUserRolePermissionService sysUserRolePermissionService;

    @Operation(summary = "获取系统用户角色权限列表")
    @PreAuthorize("@sr.hasPermission('4.1.5')")
    @GetMapping("/api/system/user/getUserRolePermission")
    public Result getUserRolePermission(Long role_id) {
        return Result.success().put("data", sysUserRolePermissionService.getUserRolePermission(role_id));
    }

}
