帮助中心
This commit is contained in:
parent
929d16c25b
commit
dd03652a01
|
@ -61,5 +61,5 @@ public interface ArticleService
|
||||||
*/
|
*/
|
||||||
public int deleteArticleById(Long id);
|
public int deleteArticleById(Long id);
|
||||||
|
|
||||||
public ArticleVO selectChildrenByCategoryId(Long id);
|
ArticleVO selectChildrenByCategoryId(Long id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,6 +89,16 @@ public class ArticleServiceImpl implements ArticleService
|
||||||
@Override
|
@Override
|
||||||
public int updateArticle(Article article)
|
public int updateArticle(Article article)
|
||||||
{
|
{
|
||||||
|
//分类必须存在
|
||||||
|
if(articleCategoryService.selectArticleCategoryById(article.getCategoryId()) ==null){
|
||||||
|
throw new ServiceException("当前分类不存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
//所属区域必须存在
|
||||||
|
if (areaService.selectAreaById(article.getAreaId()) == null){
|
||||||
|
throw new ServiceException("所属区域不存在");
|
||||||
|
}
|
||||||
|
|
||||||
article.setUpdateTime(DateUtils.getNowDate());
|
article.setUpdateTime(DateUtils.getNowDate());
|
||||||
return articleMapper.updateArticle(article);
|
return articleMapper.updateArticle(article);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,36 +0,0 @@
|
||||||
package com.ruoyi.web.app;
|
|
||||||
|
|
||||||
|
|
||||||
import com.ruoyi.bst.areaSub.domain.AreaSubQuery;
|
|
||||||
import com.ruoyi.bst.areaSub.domain.enums.AreaSubStatus;
|
|
||||||
import com.ruoyi.bst.article.domain.ArticleQuery;
|
|
||||||
import com.ruoyi.bst.article.service.ArticleService;
|
|
||||||
import com.ruoyi.bst.articleCategory.domain.ArticleCategoryQuery;
|
|
||||||
import com.ruoyi.bst.articleCategory.domain.enums.ArticleCategoryStatus;
|
|
||||||
import com.ruoyi.common.annotation.Anonymous;
|
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/app/article")
|
|
||||||
public class AppArticleController extends BaseController {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ArticleService articleService;
|
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation("查看文章")
|
|
||||||
@GetMapping
|
|
||||||
@Anonymous
|
|
||||||
public AjaxResult getCategoryList(ArticleQuery query) {
|
|
||||||
if(query.getId() == null){
|
|
||||||
return error("文章id不能为空");
|
|
||||||
}
|
|
||||||
return AjaxResult.success(articleService.selectArticleList(query));
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.ruoyi.web.app;
|
package com.ruoyi.web.app;
|
||||||
|
|
||||||
|
import com.ruoyi.bst.article.domain.ArticleQuery;
|
||||||
import com.ruoyi.bst.article.domain.ArticleVO;
|
import com.ruoyi.bst.article.domain.ArticleVO;
|
||||||
import com.ruoyi.bst.article.service.ArticleService;
|
import com.ruoyi.bst.article.service.ArticleService;
|
||||||
import com.ruoyi.bst.articleCategory.domain.ArticleCategoryQuery;
|
import com.ruoyi.bst.articleCategory.domain.ArticleCategoryQuery;
|
||||||
|
@ -30,23 +31,25 @@ public class AppAtricleCategoryController extends BaseController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private ArticleService articleService;
|
private ArticleService articleService;
|
||||||
|
|
||||||
@ApiOperation("帮助中心")
|
@ApiOperation("查询所有文章分类信息")
|
||||||
@GetMapping
|
@GetMapping("/list")
|
||||||
@Anonymous
|
@Anonymous
|
||||||
public TableDataInfo getCategoryList(ArticleCategoryQuery query) {
|
public TableDataInfo getArticleCategory(ArticleCategoryQuery articleCategoryQuery) {
|
||||||
startPage();
|
startPage();
|
||||||
query.setCategoryStatus(ArticleCategoryStatus.ENABLED.getCode());
|
articleCategoryQuery.setCategoryStatus(ArticleCategoryStatus.ENABLED.getCode());
|
||||||
|
return getDataTable(articleCategoryService.selectArticleCategoryList(articleCategoryQuery));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("查询分类下的文章")
|
||||||
|
@GetMapping("/article")
|
||||||
|
@Anonymous
|
||||||
|
public TableDataInfo getArticle(ArticleCategoryQuery articleCategoryQuery) {
|
||||||
|
startPage();
|
||||||
//查询分类的文章
|
//查询分类的文章
|
||||||
List<ArticleCategoryVO> list = articleCategoryService.selectArticleCategoryList(query);
|
ArticleQuery articleQuery = new ArticleQuery();
|
||||||
list.forEach(articleCategoryVO -> {
|
articleQuery.setCategoryId(articleCategoryQuery.getId());
|
||||||
ArticleVO children = articleService.selectChildrenByCategoryId(articleCategoryVO.getId());
|
List<ArticleVO> list = articleService.selectArticleList(articleQuery);
|
||||||
List<ArticleVO> childrenList = new ArrayList<>();
|
|
||||||
if (children != null) {
|
|
||||||
childrenList.add(children);
|
|
||||||
}
|
|
||||||
articleCategoryVO.setChildren(childrenList);
|
|
||||||
});
|
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user