restful api改造

This commit is contained in:
xiongxiaoyang
2020-12-12 10:03:15 +08:00
parent a8c74d061c
commit 355cb80458
35 changed files with 95 additions and 135 deletions

View File

@ -5,10 +5,7 @@ import com.java2nb.novel.core.bean.ResultBean;
import com.java2nb.novel.service.NewsService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
/**
* @author 11797
@ -24,7 +21,7 @@ public class NewsController {
/**
* 查询首页新闻
* */
@PostMapping("listIndexNews")
@GetMapping("listIndexNews")
public ResultBean listIndexNews(){
return ResultBean.ok(newsService.listIndexNews());
}
@ -32,7 +29,7 @@ public class NewsController {
/**
* 分页查询新闻列表
* */
@PostMapping("listByPage")
@GetMapping("listByPage")
public ResultBean listByPage(@RequestParam(value = "curr", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "5") int pageSize){
return ResultBean.ok(new PageInfo<>(newsService.listByPage(page,pageSize)));
}