package com.kwan.springbootkwan.controller; import com.kwan.springbootkwan.entity.User; import com.kwan.springbootkwan.service.IUserService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.List; /** * 用户相关 * * @author : qinyingjie * @version : 2.2.0 * @date : 2022/12/19 16:08 */ @Slf4j @Api(description = "用户信息", tags = "UserController") @RestController @RequestMapping("/user") public class UserController { @Autowired private IUserService userService; @ApiOperation(value = "获取所有用户", notes = "获取所有用户") @RequestMapping(value = "/all", method = RequestMethod.GET) public List addAdvertise() { log.info("测试日志={}", "success"); return userService.getUsers(); } @ApiOperation(value = "根据id获取用户信息", notes = "根据id获取用户信息") @RequestMapping(value = "/getUserById/{id}", method = RequestMethod.GET) public User getUserById(@PathVariable Integer id) { return userService.getUserById(id); } }