|  |  | 
 |  |  | package com.matrix.system.app.action; | 
 |  |  |  | 
 |  |  | import com.matrix.core.pojo.AjaxResult; | 
 |  |  | import com.matrix.core.pojo.PaginationVO; | 
 |  |  | import com.matrix.system.app.dto.ArticleListDto; | 
 |  |  | import com.matrix.system.hive.action.BaseController; | 
 |  |  | import com.matrix.system.hive.bean.Article; | 
 |  |  | import com.matrix.system.hive.bean.ArticleType; | 
 |  |  | import com.matrix.system.hive.service.ArticleService; | 
 |  |  | import com.matrix.system.hive.service.ArticleTypeService; | 
 |  |  | import io.swagger.annotations.Api; | 
 |  |  | import org.springframework.web.bind.annotation.RequestMapping; | 
 |  |  | import org.springframework.web.bind.annotation.RestController; | 
 |  |  | import io.swagger.annotations.ApiOperation; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.web.bind.annotation.*; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * @author wzy | 
 |  |  | 
 |  |  | @Api(value = "ApiKnowledgeAction", tags = "知识库接口类") | 
 |  |  | @RestController | 
 |  |  | @RequestMapping(value = "/api/know") | 
 |  |  | public class ApiKnowledgeAction { | 
 |  |  | public class ApiKnowledgeAction extends BaseController { | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private ArticleTypeService articleTypeService; | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private ArticleService articleService; | 
 |  |  |  | 
 |  |  |     @ApiOperation(value = "获取知识库分类", notes = "获取知识库分类") | 
 |  |  |     @GetMapping(value = "/findKnowledgeType") | 
 |  |  |     public AjaxResult findKnowledgeType() { | 
 |  |  |         ArticleType type = new ArticleType(); | 
 |  |  |         type.setShopId(getMe().getShopId()); | 
 |  |  |         type.setParentId(0L); | 
 |  |  |         return AjaxResult.buildSuccessInstance(articleTypeService.findByModel(type)); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @ApiOperation(value = "根据分类获取文章列表", notes = "根据分类获取文章列表") | 
 |  |  |     @PostMapping(value = "/findArticleList") | 
 |  |  |     public AjaxResult findArticleList(@RequestBody ArticleListDto articleListDto) { | 
 |  |  |         PaginationVO pageVo = new PaginationVO(); | 
 |  |  |         pageVo.setOffset((articleListDto.getPageNum() - 1) * articleListDto.getPageSize()); | 
 |  |  |         pageVo.setLimit(articleListDto.getPageSize()); | 
 |  |  |  | 
 |  |  |         Article article = new Article(); | 
 |  |  |         article.setTypeId(articleListDto.getTypeId()); | 
 |  |  |         return AjaxResult.buildSuccessInstance(articleService.findApiArticleListInPage(article, pageVo)); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @ApiOperation(value = "获取文章详情页", notes = "获取文章详情页") | 
 |  |  |     @GetMapping(value = "/findArticleDetail/{id}") | 
 |  |  |     public AjaxResult findArticleDetail(@PathVariable("id") Long id) { | 
 |  |  |         Article article = articleService.findById(id); | 
 |  |  |         AjaxResult ajaxResult = AjaxResult.buildSuccessInstance("获取成功"); | 
 |  |  |         ajaxResult.putInMap("article", article); | 
 |  |  |         return ajaxResult; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | } |