30 lines
706 B
Java
30 lines
706 B
Java
package com.test.controller;
|
|
|
|
import com.test.entity.User;
|
|
import com.test.service.UserService;
|
|
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;
|
|
|
|
/**
|
|
* ClassName: UserController
|
|
* Package: com.test.controller
|
|
*
|
|
* @author yovinchen
|
|
* @Create 2023/8/14 17:08
|
|
*/
|
|
@RestController
|
|
public class UserController {
|
|
|
|
@Resource
|
|
UserService service;
|
|
|
|
//这里以RESTFul风格为例
|
|
@RequestMapping("/user/{uid}")
|
|
public User findUserById(@PathVariable("uid") int uid) {
|
|
return service.getUserById(uid);
|
|
}
|
|
}
|