fix
songhuangfeng123
2022-08-16 1f143d91c6f71d4bfe7bd628ffc152c32e238b12
goal-manage/goal-manage-service/src/main/java/com/gkhy/safePlatform/targetDuty/service/impl/TargetDutySummaryServiceImpl.java
@@ -5,6 +5,7 @@
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gkhy.safePlatform.targetDuty.repository.TargetDutySummaryRepository;
import com.gkhy.safePlatform.targetDuty.entity.TargetDutySummary;
import com.gkhy.safePlatform.targetDuty.service.CommonService;
import com.gkhy.safePlatform.targetDuty.service.TargetDutySummaryService;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
@@ -17,7 +18,11 @@
import com.gkhy.safePlatform.targetDuty.utils.QueryHelpPlus;
import com.gkhy.safePlatform.commons.utils.BeanCopyUtils;
import javax.annotation.Resource;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
 * (TargetDutySummary)表服务实现类
@@ -31,8 +36,10 @@
    @Autowired
    private TargetDutySummaryRepository targetDutySummaryRepository;
    @Resource
    private CommonService commonService;
   @Override
    public ResultVO queryAll(PageQuery<TargetDutySummaryQueryCriteria> pageQuery) {
        Long pageIndex = pageQuery.getPageIndex();
@@ -43,7 +50,18 @@
                QueryHelpPlus.getPredicate(TargetDutySummary.class, pageQuery.getSearchParams()));
        List<TargetDutySummaryDto> respList = BeanCopyUtils.copyBeanList(page.getRecords(), TargetDutySummaryDto.class);
        // TODO:获取责任部门名称
        // --------------------------- 获取部门信息-----------------------
        //收集所用到的部门ID
        Set<Long> collectDepIdSet = new HashSet();
        respList.forEach(f->{
            collectDepIdSet.add(f.getDepartmentId());
        });
        //获取部门名集合
        Map<Long,String> depNameMap = commonService.getDepName(collectDepIdSet);
        respList.forEach(f->{
            f.setDepartmentName(depNameMap.get(f.getDepartmentId()));
        });
        return new SearchResultVO<>(
                true,
@@ -60,4 +78,4 @@
    public List<TargetDutySummary> queryAll(TargetDutySummaryQueryCriteria criteria) {
        return baseMapper.selectList(QueryHelpPlus.getPredicate(TargetDutySummary.class, criteria));
    }
}
}