refactor: 引入xxy-common相关依赖

This commit is contained in:
xiaoyang
2021-12-11 18:30:22 +08:00
parent 776083076c
commit 16e4c98a45
45 changed files with 252 additions and 899 deletions

View File

@ -1,10 +1,10 @@
package com.java2nb.novel.controller;
import com.github.pagehelper.PageInfo;
import com.java2nb.novel.core.bean.PageBean;
import com.java2nb.novel.core.bean.ResultBean;
import io.github.xxyopen.model.page.PageBean;
import com.java2nb.novel.entity.News;
import com.java2nb.novel.service.NewsService;
import io.github.xxyopen.model.resp.RestResult;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
@ -26,25 +26,25 @@ public class NewsController {
* 查询首页新闻
* */
@GetMapping("listIndexNews")
public ResultBean<List<News>> listIndexNews(){
return ResultBean.ok(newsService.listIndexNews());
public RestResult<List<News>> listIndexNews(){
return RestResult.ok(newsService.listIndexNews());
}
/**
* 分页查询新闻列表
* */
@GetMapping("listByPage")
public ResultBean<PageBean<News>> listByPage(@RequestParam(value = "curr", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "5") int pageSize){
return ResultBean.ok(newsService.listByPage(page,pageSize));
public RestResult<PageBean<News>> listByPage(@RequestParam(value = "curr", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "5") int pageSize){
return RestResult.ok(newsService.listByPage(page,pageSize));
}
/**
* 增加新闻阅读量
* */
@PostMapping("addReadCount")
public ResultBean<Void> addReadCount(@RequestParam(value = "newsId") Integer newsId){
public RestResult<Void> addReadCount(@RequestParam(value = "newsId") Integer newsId){
newsService.addReadCount(newsId);
return ResultBean.ok();
return RestResult.ok();
}