11package org .jon .lv .controller ;
22
3+ import io .swagger .annotations .ApiImplicitParam ;
4+ import io .swagger .annotations .ApiImplicitParams ;
5+ import io .swagger .annotations .ApiOperation ;
6+ import io .swagger .annotations .ApiResponse ;
37import org .jon .lv .domain .User ;
48import org .jon .lv .result .ResultDO ;
59import org .jon .lv .service .UserService ;
610import org .springframework .beans .factory .annotation .Autowired ;
711import org .springframework .boot .autoconfigure .EnableAutoConfiguration ;
8- import org .springframework .web .bind .annotation .PathVariable ;
9- import org .springframework .web .bind .annotation .RequestBody ;
10- import org .springframework .web .bind .annotation .RequestMapping ;
11- import org .springframework .web .bind .annotation .RestController ;
12+ import org .springframework .web .bind .annotation .*;
1213
1314/**
1415 * @Package org.jon.lv.controller.UserController
@@ -24,15 +25,23 @@ public class UserController {
2425 @ Autowired
2526 private UserService userService ;
2627
27- @ RequestMapping ("/get/{id}" )
28+ @ ApiOperation (value = "查询单个用户" ,notes = "根据传入id查找用户" ,httpMethod = "GET" )
29+ @ ApiResponse (code = 200 ,message = "Success" )
30+ @ RequestMapping (value ="/get/{id}" , method = RequestMethod .GET )
2831 public ResultDO <User > get (@ PathVariable ("id" )Integer id ){
2932 ResultDO <User > resultDO = new ResultDO <>();
3033 resultDO .setSuccess (true );
3134 resultDO .setData (userService .getUserById (id ));
3235 return resultDO ;
3336 }
3437
35- @ RequestMapping ("/add" )
38+ // @ApiOperation(value="更新用户详细信息", notes="根据url的id来指定更新对象,并根据传过来的user信息来更新用户详细信息")
39+ // @ApiImplicitParams({
40+ // @ApiImplicitParam(name = "id", value = "用户ID", required = true, dataType = "Long"),
41+ // @ApiImplicitParam(name = "user", value = "用户详细实体user", required = true, dataType = "User")
42+ // })
43+
44+ @ RequestMapping (value = "/add" , method = RequestMethod .POST )
3645 public ResultDO <Integer > add (User user ){
3746 ResultDO <Integer > resultDO = new ResultDO <>();
3847 resultDO .setSuccess (true );
0 commit comments