编写mvc基础代码添加ResponseMessage编写Message关键字
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
package com.qf.myafterprojecy.controller;
|
||||
|
||||
import com.qf.myafterprojecy.pojo.Article;
|
||||
import com.qf.myafterprojecy.pojo.ResponseMessage;
|
||||
import com.qf.myafterprojecy.pojo.dto.ArticleDto;
|
||||
import com.qf.myafterprojecy.service.IArticleService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/article")
|
||||
public class ArticleController {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Autowired
|
||||
IArticleService ArticleService;
|
||||
|
||||
@PostMapping
|
||||
public ResponseMessage<Iterable<Article>> getArticle(){
|
||||
return ArticleService.getArticleAll();
|
||||
};
|
||||
@GetMapping
|
||||
public ResponseMessage<Article> geybyID(@RequestBody ArticleDto articleDto){
|
||||
System.out.println("id:"+ articleDto.getArticleid());
|
||||
return ArticleService.getArticleByid(Integer.valueOf(articleDto.getArticleid()));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user