huanghongfa
2021-09-06 4b17ad3c50490858f83cc9b3774ffdce6ff3fc1a
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActWorkGuideServiceImpl.java
@@ -1,10 +1,15 @@
package com.panzhihua.service_community.service.impl;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import javax.annotation.Resource;
import com.panzhihua.common.model.vos.community.ComActWorkGuideAppletsVO;
import com.panzhihua.common.model.vos.community.ComActWorkGuideDetailAppletsVO;
import com.panzhihua.service_community.dao.ComActWorkGuideClassifyDAO;
import com.panzhihua.service_community.service.ComActWorkGuideClassifyService;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
@@ -37,6 +42,8 @@
    ComActWorkGuideMaterialDAO workGuideMaterialDAO;
    @Resource
    ComActDAO comActDAO;
    @Resource
    private ComActWorkGuideClassifyDAO comActWorkGuideClassifyDAO;
    @Override
    public R addWorkGuide(ComActWorkGuideDTO workGuideDTO, Long userId) {
@@ -155,4 +162,37 @@
            .eq(ComActWorkGuideMaterialDO::getWorkGuideId, workGuideId));
        return R.ok();
    }
    /**
     * 办事指南列表-按分类查询
     * @param pageActWorkGuideDTO   请求参数
     * @return  办事指南分类列表
     */
    @Override
    public R listWorkGuide(PageActWorkGuideDTO pageActWorkGuideDTO){
        //结果数据集合
        List<ComActWorkGuideAppletsVO> resultList = new ArrayList<>();
        List<ComActWorkGuideAppletsVO> workGuideClassifyList = comActWorkGuideClassifyDAO.listWorkGuideClassify();
        //通过办事指南分类查询分类下办事指南
        workGuideClassifyList.forEach(workGuideClassify -> {
            List<ComActWorkGuideDetailAppletsVO> workGuideList = this.baseMapper.getWorkGuideListByClassifyId(workGuideClassify.getId(),10L);
            if(workGuideList != null && workGuideList.size() > 0){
                workGuideClassify.setGuideDetailList(workGuideList);
                //分类下办事指南数据大于0加入到结果集中向小程序展示
                resultList.add(workGuideClassify);
            }
        });
        return R.ok(resultList);
    }
    /**
     * 根据办事指南分类id查询办事指南列表
     * @param classifyId   办事指南分类id
     * @return  办事指南列表数据
     */
    @Override
    public R listWorkGuideByClassifyId(Long classifyId){
        return R.ok(this.baseMapper.getWorkGuideListByClassifyId(classifyId,null));
    }
}