diff --git a/src/main/java/com/project/appeal/domain/service/Impl/SearchAppealDomainServiceImpl.java b/src/main/java/com/project/appeal/domain/service/Impl/SearchAppealDomainServiceImpl.java index 6370171..4713880 100644 --- a/src/main/java/com/project/appeal/domain/service/Impl/SearchAppealDomainServiceImpl.java +++ b/src/main/java/com/project/appeal/domain/service/Impl/SearchAppealDomainServiceImpl.java @@ -41,8 +41,6 @@ public class SearchAppealDomainServiceImpl implements SearchAppealDomainService private TaskMapper taskMapper; @Autowired private TaskKnowledgePointBaseService taskKnowledgePointBaseService; - @Autowired - private ProductLineMapper productLineMapper; private static final String KEY_VALUE_PATTERN = "\\{([^}]*)\\}\\:\\{([^}]*)\\}"; @@ -67,7 +65,7 @@ public class SearchAppealDomainServiceImpl implements SearchAppealDomainService //查询产品线相关的考试任务 Set taskIdSet = appealDTOIPage.getRecords().stream().map(AppealDTO::getTaskId).collect(Collectors.toSet()); if (!CollectionUtils.isEmpty(taskIdSet)){ - List taskByIds = productLineMapper.getSubLineByTaskIDS(taskIdSet); + List taskByIds = taskMapper.getSubLineByTaskIDS(taskIdSet); taskIdToLineAndCountMap = taskByIds.stream().collect(Collectors.toMap(TaskDTO::getId, taskDTO -> new Object[]{taskDTO.getSubLineName(),taskDTO.getShortAnswerScore()})); } }else{ diff --git a/src/main/java/com/project/classicpaper/application/impl/ClassicCategoryApplicationServiceImpl.java b/src/main/java/com/project/classicpaper/application/impl/ClassicCategoryApplicationServiceImpl.java index a063236..f668ed7 100644 --- a/src/main/java/com/project/classicpaper/application/impl/ClassicCategoryApplicationServiceImpl.java +++ b/src/main/java/com/project/classicpaper/application/impl/ClassicCategoryApplicationServiceImpl.java @@ -74,12 +74,12 @@ public class ClassicCategoryApplicationServiceImpl implements ClassicCategoryApp private void injectPaperSetCount(List nodes, Map countMap) { for (ClassicCategoryDTO node : nodes) { if (node.getChildrenList() != null && !node.getChildrenList().isEmpty()) { - // 一级分类:先递归处理子节点,再累加 + // 一级分类:先递归处理子节点,再累加自身及子节点 injectPaperSetCount(node.getChildrenList(), countMap); int sum = node.getChildrenList().stream() .mapToInt(c -> c.getPaperSetCount() != null ? c.getPaperSetCount() : 0) .sum(); - node.setPaperSetCount(sum); + node.setPaperSetCount(sum + countMap.getOrDefault(node.getId(), 0)); } else { // 二级分类:直接取统计值 node.setPaperSetCount(countMap.getOrDefault(node.getId(), 0)); diff --git a/src/main/java/com/project/information/mapper/ProductLineMapper.java b/src/main/java/com/project/information/mapper/ProductLineMapper.java index d4b97d3..0dda7df 100644 --- a/src/main/java/com/project/information/mapper/ProductLineMapper.java +++ b/src/main/java/com/project/information/mapper/ProductLineMapper.java @@ -15,17 +15,4 @@ public interface ProductLineMapper extends BaseMapper { @Select("SELECT * FROM evaluator_product_line WHERE id = #{id}") ProductLineEntity selectByIdIncludeDeleted(@Param("id") Long id); - - @Select({ - "" - }) - List getSubLineByTaskIDS(@Param("taskIds") Set taskIds); } diff --git a/src/main/java/com/project/task/mapper/TaskMapper.java b/src/main/java/com/project/task/mapper/TaskMapper.java index 764ed5b..3b56edf 100644 --- a/src/main/java/com/project/task/mapper/TaskMapper.java +++ b/src/main/java/com/project/task/mapper/TaskMapper.java @@ -8,6 +8,7 @@ import org.apache.ibatis.annotations.Select; import org.springframework.data.repository.query.Param; import java.util.List; +import java.util.Set; @Mapper public interface TaskMapper extends BaseMapper { @@ -55,4 +56,17 @@ public interface TaskMapper extends BaseMapper { @Param("lineId") Long lineId, @Param("businessId") Long businessId, @Param("subLineName") String subLineName); + + @Select({ + "" + }) + List getSubLineByTaskIDS(@Param("taskIds") Set taskIds); }