1010import io .swagger .annotations .ApiOperation ;
1111import org .springframework .beans .factory .annotation .Autowired ;
1212import org .springframework .http .MediaType ;
13- import org .springframework .web .bind .annotation .PathVariable ;
14- import org .springframework .web .bind .annotation .RequestMapping ;
15- import org .springframework .web .bind .annotation .RequestMethod ;
16- import org .springframework .web .bind .annotation .RestController ;
13+ import org .springframework .web .bind .annotation .*;
1714
1815/**
1916 * 把今天最好的表现当作明天最新的起点..~
@@ -47,7 +44,7 @@ public QuestionController(QuestionService service) {
4744 * @param id id
4845 * @return result
4946 */
50- @ ApiOperation (value = "查找用户 " , notes = "查找用户 " , httpMethod = "GET" , produces = MediaType .APPLICATION_JSON_UTF8_VALUE )
47+ @ ApiOperation (value = "查找问题 " , notes = "查找问题 " , httpMethod = "GET" , produces = MediaType .APPLICATION_JSON_UTF8_VALUE )
5148 @ RequestMapping (value = "findById/{id}" , method = RequestMethod .GET )
5249 @ ApiImplicitParams ({
5350 @ ApiImplicitParam (name = "id" , value = "唯一id" , required = true , dataType = "Long" , paramType = "path" ),
@@ -60,4 +57,16 @@ public Result findUserById(@PathVariable("id") Long id) {
6057 return new Result <>(questionModel );
6158 }
6259
60+ /**
61+ * 根据id 查找用户
62+ *
63+ * @return result
64+ */
65+ @ ApiOperation (value = "添加" , notes = "添加" , httpMethod = "POST" , produces = MediaType .APPLICATION_JSON_UTF8_VALUE )
66+ @ RequestMapping (value = "findById/{id}" , method = RequestMethod .POST )
67+ public Result addQuestion (@ RequestBody QuestionModel questionModel ) {
68+ boolean add = service .add (questionModel );
69+ return new Result <>(add );
70+ }
71+
6372}
0 commit comments