package com.yanzhu.system.rpc;

import com.yanzhu.common.core.domain.R;
import com.yanzhu.system.api.domain.SysUser;
import com.yanzhu.system.service.ISysUserService;
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/user")
public class SysUserRpc {

    @Resource
    private ISysUserService userService;

    @GetMapping("/list")
    public R<List<SysUser>> list(SysUser user) {
        List<SysUser> list = userService.selectUserList(user);
        return R.ok(list);
    }


    @GetMapping(value = {"/{userId}"})
    public R<SysUser> list(@PathVariable(value = "userId") Long userId) {
        SysUser user = userService.selectUserById(userId);
        return R.ok(user);
    }

}
