|
|
|
@ -2,9 +2,12 @@ package com.jingcheng.cms.service.impl;
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.baomidou.mybatisplus.generator.config.IFileCreate;
|
|
|
|
|
import com.jingcheng.cms.constants.Constants;
|
|
|
|
|
import com.jingcheng.cms.mapper.ArticleMapper;
|
|
|
|
|
import com.jingcheng.cms.mapper.CategoryMapper;
|
|
|
|
|
import com.jingcheng.cms.model.Article;
|
|
|
|
|
import com.jingcheng.cms.model.Category;
|
|
|
|
|
import com.jingcheng.cms.model.Users;
|
|
|
|
|
import com.jingcheng.cms.service.ArticleSerive;
|
|
|
|
|
import com.jingcheng.cms.util.AjaxResult;
|
|
|
|
@ -24,6 +27,8 @@ public class ArticleSerivceImpl implements ArticleSerive {
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private ArticleMapper articleMapper;
|
|
|
|
|
@Resource
|
|
|
|
|
private CategoryMapper categoryMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -177,5 +182,42 @@ public class ArticleSerivceImpl implements ArticleSerive {
|
|
|
|
|
return ajaxResult;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public AjaxResult getArticleDetail(Long id) {
|
|
|
|
|
AjaxResult ajaxResult = new AjaxResult();
|
|
|
|
|
Article article = articleMapper.selectByPrimaryKey(id);
|
|
|
|
|
if (null == article){
|
|
|
|
|
ajaxResult.setRetcode(AjaxResult.FAILED);
|
|
|
|
|
ajaxResult.setRetmsg("未找到该文章");
|
|
|
|
|
return ajaxResult;
|
|
|
|
|
}else {
|
|
|
|
|
Long firstCategoryId = article.getFirstCategory();
|
|
|
|
|
Long secondCategoryId = article.getSecondCategory();
|
|
|
|
|
Category firstCategory = categoryMapper.selectByPrimaryKey(firstCategoryId);
|
|
|
|
|
Category secondCategory = categoryMapper.selectByPrimaryKey(secondCategoryId);
|
|
|
|
|
ArticleVo articleVo = new ArticleVo();
|
|
|
|
|
articleVo.setTitle(article.getTitle());
|
|
|
|
|
articleVo.setFirstCategory(firstCategoryId);
|
|
|
|
|
articleVo.setSecondCategory(secondCategoryId);
|
|
|
|
|
articleVo.setContent(article.getContent());
|
|
|
|
|
articleVo.setFileType(article.getFileType());
|
|
|
|
|
articleVo.setKeyword(article.getKeyword());
|
|
|
|
|
articleVo.setDescribe(article.getDescribe());
|
|
|
|
|
articleVo.setCreateDateTime(article.getCreateDateTime());
|
|
|
|
|
if (null != firstCategory ){
|
|
|
|
|
articleVo.setFirstCategoryName(firstCategory.getName());
|
|
|
|
|
articleVo.setFirstLevel(firstCategory.getLevel());
|
|
|
|
|
articleVo.setFirstSortNum(firstCategory.getSortNum());
|
|
|
|
|
}
|
|
|
|
|
if (null != secondCategory ){
|
|
|
|
|
articleVo.setSecondCategoryName(secondCategory.getName());
|
|
|
|
|
articleVo.setSecondLevel(secondCategory.getLevel());
|
|
|
|
|
articleVo.setFirstSortNum(secondCategory.getSortNum());
|
|
|
|
|
}
|
|
|
|
|
ajaxResult.setData(articleVo);
|
|
|
|
|
}
|
|
|
|
|
return ajaxResult;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|