BusinessServiceImpl.java
2.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
package com.skua.modules.biz.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.skua.modules.base.service.IBaseService;
import com.skua.modules.biz.IBusinessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Author:sonin
* @Date:2025/2/18 15:35
*/
@Service
public class BusinessServiceImpl implements IBusinessService {
@Autowired
private IBaseService baseService;
@Override
public Map<String, String> dictMap(String dictCode, Collection<?> inCol) {
String key0, value0, table0;
QueryWrapper<?> queryWrapper0 = new QueryWrapper<>();
if ("equipment_info".equals(dictCode)) {
key0 = "id";
value0 = "equipment_name";
table0 = dictCode;
} else if ("sys_user".equals(dictCode)) {
key0 = "id";
value0 = "realname";
table0 = dictCode;
} else if ("sys_struct_dict".equals(dictCode)) {
key0 = "id";
value0 = "struct_name";
table0 = dictCode;
} else if ("equipment_category".equals(dictCode)) {
key0 = "id";
value0 = "des";
table0 = dictCode;
} else if ("evaluate_score_desc".equals(dictCode)) {
key0 = "id";
value0 = "score_desc";
table0 = dictCode;
} else if ("carbon_qualitative_desc".equals(dictCode)) {
key0 = "id";
value0 = "qualitative_desc";
table0 = dictCode;
} else if ("sys_depart".equals(dictCode)) {
key0 = "id";
value0 = "depart_name";
table0 = dictCode;
} else {
// 数据字典查询
queryWrapper0.eq("sys_dict.dict_code", dictCode);
key0 = "sys_dict_item.item_value";
value0 = "sys_dict_item.item_text";
table0 = "sys_dict inner join sys_dict_item on sys_dict.id = sys_dict_item.dict_id";
}
String sqlSelect = "select " + key0 + " as key0, " + value0 + " as value0 from " + table0;
if (inCol != null && !inCol.isEmpty()) {
queryWrapper0.in(key0, inCol);
}
List<Map<String, Object>> queryMapList0 = baseService.queryForList(sqlSelect, queryWrapper0);
Map<String, String> dictMap = new HashMap<>(10);
for (Map<String, Object> item : queryMapList0) {
dictMap.put(String.valueOf(item.get("key0")), String.valueOf(item.get("value0")));
}
return dictMap;
}
}