增加文章分类
This commit is contained in:
parent
590cedb3a9
commit
c27cee9b55
|
|
@ -15,6 +15,7 @@ import org.springframework.validation.annotation.Validated;
|
|||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
|
|
@ -114,6 +115,18 @@ public class ArticleController {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 分类所有
|
||||
*
|
||||
* @author fzr
|
||||
* @return Object
|
||||
*/
|
||||
@GetMapping("/cateAll")
|
||||
public Object cateAll() {
|
||||
List<CategoryVo> voPageResult = iArticleService.cateAll();
|
||||
return AjaxResult.success(voPageResult);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分类列表
|
||||
*
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import com.hxkj.admin.vo.article.ArticleListVo;
|
|||
import com.hxkj.admin.vo.article.CategoryVo;
|
||||
import com.hxkj.common.core.PageResult;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
|
@ -57,6 +58,14 @@ public interface IArticleService {
|
|||
*/
|
||||
void articleDel(Integer id);
|
||||
|
||||
/**
|
||||
* 分类所有
|
||||
*
|
||||
* @author fzr
|
||||
* @return List<CategoryVo>
|
||||
*/
|
||||
List<CategoryVo> cateAll();
|
||||
|
||||
/**
|
||||
* 分类列表
|
||||
*
|
||||
|
|
|
|||
|
|
@ -180,6 +180,33 @@ public class ArticleServiceImpl implements IArticleService {
|
|||
articleMapper.updateById(article);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分类所有
|
||||
*
|
||||
* @author fzr
|
||||
* @return List<CategoryVo>
|
||||
*/
|
||||
@Override
|
||||
public List<CategoryVo> cateAll() {
|
||||
QueryWrapper<ArticleCategory> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.select("id", "name", "sort", "is_show", "create_time", "update_time")
|
||||
.eq("is_delete", 0);
|
||||
|
||||
List<ArticleCategory> lists = articleCategoryMapper.selectList(queryWrapper);
|
||||
|
||||
List<CategoryVo> vos = new ArrayList<>();
|
||||
for (ArticleCategory category : lists) {
|
||||
CategoryVo vo = new CategoryVo();
|
||||
BeanUtils.copyProperties(category, vo);
|
||||
|
||||
vo.setCreateTime(TimeUtil.timestampToDate(vo.getCreateTime()));
|
||||
vo.setUpdateTime(TimeUtil.timestampToDate(vo.getUpdateTime()));
|
||||
vos.add(vo);
|
||||
}
|
||||
|
||||
return vos;
|
||||
}
|
||||
|
||||
/**
|
||||
* 分类列表
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue