|
|
@@ -2,9 +2,7 @@ package com.ruoyi.web.modules.technology.service.impl;
|
|
2
|
2
|
|
|
3
|
3
|
import java.util.ArrayList;
|
|
4
|
4
|
import java.util.Collections;
|
|
5
|
|
-import java.util.LinkedHashSet;
|
|
6
|
5
|
import java.util.List;
|
|
7
|
|
-import java.util.Set;
|
|
8
|
6
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
9
|
7
|
import org.springframework.stereotype.Service;
|
|
10
|
8
|
import com.ruoyi.common.exception.ServiceException;
|
|
|
@@ -14,8 +12,6 @@ import com.ruoyi.web.modules.technology.domain.OnlineTrainingCourseListVo;
|
|
14
|
12
|
import com.ruoyi.web.modules.technology.domain.OnlineTrainingCourseQuery;
|
|
15
|
13
|
import com.ruoyi.web.modules.technology.domain.OnlineTrainingCourseRow;
|
|
16
|
14
|
import com.ruoyi.web.modules.category.domain.vo.InformationCategoryItemVo;
|
|
17
|
|
-import com.ruoyi.web.modules.category.service.IBizInformationCategoryService;
|
|
18
|
|
-import com.ruoyi.web.modules.farming.support.TechResourceCourseTopicValidator;
|
|
19
|
15
|
import com.ruoyi.web.modules.technology.mapper.BizOnlineTrainingCourseMapper;
|
|
20
|
16
|
import com.ruoyi.web.modules.technology.service.IBizOnlineTrainingCourseService;
|
|
21
|
17
|
import com.ruoyi.web.modules.technology.support.OnlineTrainingCourseRules;
|
|
|
@@ -26,9 +22,6 @@ public class BizOnlineTrainingCourseServiceImpl implements IBizOnlineTrainingCou
|
|
26
|
22
|
@Autowired
|
|
27
|
23
|
private BizOnlineTrainingCourseMapper onlineTrainingCourseMapper;
|
|
28
|
24
|
|
|
29
|
|
- @Autowired
|
|
30
|
|
- private IBizInformationCategoryService bizInformationCategoryService;
|
|
31
|
|
-
|
|
32
|
25
|
@Override
|
|
33
|
26
|
public List<OnlineTrainingCourseListVo> selectOnlineTrainingCourseList(OnlineTrainingCourseQuery query)
|
|
34
|
27
|
{
|
|
|
@@ -62,32 +55,22 @@ public class BizOnlineTrainingCourseServiceImpl implements IBizOnlineTrainingCou
|
|
62
|
55
|
}
|
|
63
|
56
|
|
|
64
|
57
|
@Override
|
|
65
|
|
- public List<String> selectCourseTopics()
|
|
|
58
|
+ public List<InformationCategoryItemVo> selectCourseTopics()
|
|
66
|
59
|
{
|
|
67
|
|
- Set<String> merged = new LinkedHashSet<>();
|
|
68
|
|
- for (InformationCategoryItemVo item : bizInformationCategoryService.selectChildren(
|
|
69
|
|
- TechResourceCourseTopicValidator.CATEGORY_PARENT_CODE,
|
|
70
|
|
- TechResourceCourseTopicValidator.CATEGORY_TYPE))
|
|
|
60
|
+ List<InformationCategoryItemVo> categories = onlineTrainingCourseMapper.selectDistinctCourseTopics();
|
|
|
61
|
+ if (categories == null || categories.isEmpty())
|
|
71
|
62
|
{
|
|
72
|
|
- if (item != null && StringUtils.isNotEmpty(item.getCode()))
|
|
73
|
|
- {
|
|
74
|
|
- merged.add(item.getCode().trim());
|
|
75
|
|
- }
|
|
|
63
|
+ return Collections.emptyList();
|
|
76
|
64
|
}
|
|
77
|
|
- List<String> fromDb = onlineTrainingCourseMapper.selectDistinctCourseTopics();
|
|
78
|
|
- if (fromDb != null)
|
|
|
65
|
+ List<InformationCategoryItemVo> result = new ArrayList<>(categories.size());
|
|
|
66
|
+ for (InformationCategoryItemVo item : categories)
|
|
79
|
67
|
{
|
|
80
|
|
- for (String topic : fromDb)
|
|
|
68
|
+ if (item != null && StringUtils.isNotEmpty(item.getCode()))
|
|
81
|
69
|
{
|
|
82
|
|
- if (StringUtils.isNotEmpty(topic))
|
|
83
|
|
- {
|
|
84
|
|
- merged.add(topic.trim());
|
|
85
|
|
- }
|
|
|
70
|
+ result.add(item);
|
|
86
|
71
|
}
|
|
87
|
72
|
}
|
|
88
|
|
- List<String> sorted = new ArrayList<>(merged);
|
|
89
|
|
- Collections.sort(sorted);
|
|
90
|
|
- return sorted;
|
|
|
73
|
+ return result;
|
|
91
|
74
|
}
|
|
92
|
75
|
|
|
93
|
76
|
private static OnlineTrainingCourseQuery normalizeQuery(OnlineTrainingCourseQuery query)
|