Commit a0363c21 authored by hanfeng's avatar hanfeng

文章列表

parent 19cb17ff
package com.xxfc.platform.uccn.biz; package com.xxfc.platform.uccn.biz;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.github.wxiaoqi.security.common.biz.BaseBiz; import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.xxfc.platform.uccn.entity.Article; import com.xxfc.platform.uccn.entity.Article;
...@@ -14,7 +16,9 @@ import java.util.List; ...@@ -14,7 +16,9 @@ import java.util.List;
@Service @Service
public class ArticleBiz extends BaseBiz<ArticleMapper, Article> { public class ArticleBiz extends BaseBiz<ArticleMapper, Article> {
public List<Article> getArticleList() { public PageInfo getArticleList(Integer page, Integer limit) {
return mapper.getArticleList(); PageHelper.startPage(page,limit);
List articleList = mapper.getArticleList();
return PageInfo.of(articleList);
} }
} }
...@@ -41,7 +41,7 @@ public class SwaggerConfig { ...@@ -41,7 +41,7 @@ public class SwaggerConfig {
return new Docket(DocumentationType.SWAGGER_2) return new Docket(DocumentationType.SWAGGER_2)
.select() .select()
.apis(RequestHandlerSelectors.basePackage("com.xxfc.platform.activity.rest")) .apis(RequestHandlerSelectors.basePackage("com.xxfc.platform.uccn"))
.build() .build()
.globalOperationParameters(pars) .globalOperationParameters(pars)
.apiInfo(apiInfo()); .apiInfo(apiInfo());
......
...@@ -5,8 +5,10 @@ import com.github.wxiaoqi.security.common.rest.BaseController; ...@@ -5,8 +5,10 @@ import com.github.wxiaoqi.security.common.rest.BaseController;
import com.xxfc.platform.uccn.biz.ArticleBiz; import com.xxfc.platform.uccn.biz.ArticleBiz;
import com.xxfc.platform.uccn.entity.Article; import com.xxfc.platform.uccn.entity.Article;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; 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.RestController;
/** /**
...@@ -19,7 +21,10 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -19,7 +21,10 @@ import org.springframework.web.bind.annotation.RestController;
public class ArticleController extends BaseController<ArticleBiz, Article> { public class ArticleController extends BaseController<ArticleBiz, Article> {
@GetMapping("/list") @GetMapping("/list")
public ObjectRestResponse getArticleList(){ @ApiOperation(value = "获取文章列表")
return ObjectRestResponse.succ(baseBiz.getArticleList()); public ObjectRestResponse getArticleList(
@RequestParam(name = "page",defaultValue = "1") Integer page,
@RequestParam(name = "limit",defaultValue = "10")Integer limit){
return ObjectRestResponse.succ(baseBiz.getArticleList(page,limit));
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment