| 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.action.util.QueryUtil; | 
| import com.matrix.system.hive.bean.Article; | 
| import com.matrix.system.hive.bean.ArticleType; | 
| import com.matrix.system.hive.bean.SysShopInfo; | 
| import com.matrix.system.hive.dao.ArticleDao; | 
| import com.matrix.system.hive.dao.SysShopInfoDao; | 
| import com.matrix.system.hive.service.ArticleService; | 
| import com.matrix.system.hive.service.ArticleTypeService; | 
| import io.swagger.annotations.Api; | 
| import io.swagger.annotations.ApiOperation; | 
| import org.springframework.beans.factory.annotation.Autowired; | 
| import org.springframework.web.bind.annotation.*; | 
|   | 
| /** | 
|  * @author wzy | 
|  * @date 2020-12-27 | 
|  **/ | 
| @Api(value = "ApiKnowledgeAction", tags = "知识库接口类") | 
| @RestController | 
| @RequestMapping(value = "/api/know") | 
| 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.setCompanyId(getMe().getCompanyId()); | 
|         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(); | 
|         QueryUtil.setQueryLimitCom(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; | 
|     } | 
|   | 
| } |