From ed55b07e0000d99d0aeb796649077d178256fbb8 Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Sat, 09 Jan 2021 17:17:08 +0800
Subject: [PATCH] modify
---
zq-erp/src/main/java/com/matrix/system/app/action/ApiKnowledgeAction.java | 51 ++++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 48 insertions(+), 3 deletions(-)
diff --git a/zq-erp/src/main/java/com/matrix/system/app/action/ApiKnowledgeAction.java b/zq-erp/src/main/java/com/matrix/system/app/action/ApiKnowledgeAction.java
index 2e23de7..5089f28 100644
--- a/zq-erp/src/main/java/com/matrix/system/app/action/ApiKnowledgeAction.java
+++ b/zq-erp/src/main/java/com/matrix/system/app/action/ApiKnowledgeAction.java
@@ -1,8 +1,17 @@
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
@@ -11,6 +20,42 @@
@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;
+ }
}
--
Gitblit v1.9.1