package com.yanzhu.system.rpc;

import com.yanzhu.common.core.domain.R;
import com.yanzhu.system.api.domain.SysRole;
import com.yanzhu.system.service.ISysRoleService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/rpc/role")
public class SysRoleRpc {

    @Resource
    private ISysRoleService roleService;

    @GetMapping("/list")
    public R<List<SysRole>> list(SysRole role) {
        List<SysRole> list = roleService.selectRoleList(role);
        return R.ok(list);
    }

    @GetMapping(value = {"/{roleId}"})
    public R<SysRole> list(@PathVariable(value = "roleId") Long roleId) {
        SysRole role = roleService.selectRoleById(roleId);
        return R.ok(role);
    }
}
