42 lines
1.3 KiB
Java
42 lines
1.3 KiB
Java
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.validation.annotation.Validated;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
@RestController
|
|
@RequestMapping("/article")
|
|
public class ArticleController {
|
|
|
|
/**
|
|
*
|
|
*/
|
|
@Autowired
|
|
IArticleService ArticleService;
|
|
|
|
@GetMapping
|
|
public ResponseMessage<Iterable<Article>> getArticleAllByID(@Validated @RequestBody ArticleDto articleDto){
|
|
return ArticleService.getArticleAllByID(articleDto);
|
|
}
|
|
|
|
@PutMapping
|
|
public ResponseMessage<Article> UpdateArticle(@RequestBody ArticleDto articleDto){
|
|
return ArticleService.SaveArticle(articleDto);
|
|
};
|
|
|
|
@PostMapping
|
|
public ResponseMessage<Article> AddArticle(@RequestBody ArticleDto articleDto){
|
|
return ArticleService.SaveArticle(articleDto);
|
|
}
|
|
|
|
@DeleteMapping
|
|
public ResponseMessage<Article> DeleteArticle(@RequestBody ArticleDto articleDto){
|
|
return ArticleService.deleteArticle(articleDto.getArticleid());
|
|
}
|
|
|
|
}
|