PgEnums.java
1.4 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
package com.skua.modules.threedimensional.enums;
import com.skua.modules.threedimensional.service.IPgService;
import com.skua.modules.threedimensional.service.impl.OtherPgServiceImpl;
import com.skua.modules.threedimensional.service.impl.SZPgServiceImpl;
import com.skua.modules.threedimensional.service.impl.WSCLPgServiceImpl;
import org.apache.commons.lang.StringUtils;
/**
* @author sonin
* @date 2021/10/13 19:08
*/
public enum PgEnums {
SZ("SZ", SZPgServiceImpl.class),
WSCL("JSLJLL,CSLJLL", WSCLPgServiceImpl.class);
private String type;
private Class<? extends IPgService> clazz;
PgEnums(String type, Class<? extends IPgService> clazz) {
this.type = type;
this.clazz = clazz;
}
public static Class<? extends IPgService> getClazz(String groupType, String dictIds) {
Class<? extends IPgService> result = OtherPgServiceImpl.class;
// 优先从groupType查询
if (StringUtils.isNotEmpty(groupType)) {
for (PgEnums item : PgEnums.values()) {
if (groupType.equals(item.type)) {
result = item.clazz;
break;
}
}
} else {
// 再从dictIds查询
for (PgEnums item : PgEnums.values()) {
if (dictIds.equals(item.type)) {
result = item.clazz;
break;
}
}
}
return result;
}
}