1
This commit is contained in:
@@ -0,0 +1,89 @@
|
||||
package com.ruoyi.jarvis.enums;
|
||||
|
||||
/**
|
||||
* @author Leo
|
||||
* @version 1.0
|
||||
* @create 2023/12/19 0019 上午 10:27
|
||||
* @description:
|
||||
*/
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public enum GroupType implements IEnum {
|
||||
|
||||
/**
|
||||
* 类型,1管理群,2评论群,3线报来源群,4线报推送群
|
||||
* */
|
||||
MANAGEMENT(1, "管理群"),
|
||||
COMMENT(2, "评论群"),
|
||||
LINE_REPORT_SOURCE(3, "线报来源群"),
|
||||
LINE_REPORT_PUSH(4, "线报推送群");
|
||||
private final int key;
|
||||
|
||||
private final String name;
|
||||
|
||||
GroupType(int key, String name) {
|
||||
this.key = key;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public static GroupType get(int key) {
|
||||
for (GroupType e : GroupType.values()) {
|
||||
if (e.getKey() == key) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String getName(Integer key) {
|
||||
//if (Object.isNotEmpty(key)) {
|
||||
GroupType[] items = GroupType.values();
|
||||
for (GroupType item : items) {
|
||||
if (item.getKey() == key) {
|
||||
return item.getName();
|
||||
}
|
||||
}
|
||||
//}
|
||||
return "";
|
||||
}
|
||||
|
||||
public static Map<String, String> getKeyVlue() {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
GroupType[] items = GroupType.values();
|
||||
for (GroupType item : items) {
|
||||
map.put(item.getKey() + "", item.getName());
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
public static List<Map<String, Object>> getSelectItems() {
|
||||
List<Map<String, Object>> result = new ArrayList<Map<String, Object>>();
|
||||
GroupType[] items = GroupType.values();
|
||||
for (GroupType item : items) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("label", item.getName());
|
||||
map.put("value", item.getKey());
|
||||
result.add(map);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
@JsonValue
|
||||
public Integer getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
14
ruoyi-system/src/main/java/com/ruoyi/jarvis/enums/IEnum.java
Normal file
14
ruoyi-system/src/main/java/com/ruoyi/jarvis/enums/IEnum.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package com.ruoyi.jarvis.enums;
|
||||
|
||||
/**
|
||||
* @author Leo
|
||||
* @version 1.0
|
||||
* @create 2023/12/19 0019 上午 10:33
|
||||
* @description:
|
||||
*/
|
||||
public interface IEnum {
|
||||
|
||||
Integer getKey();
|
||||
|
||||
String getName();
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.ruoyi.jarvis.enums;
|
||||
|
||||
/**
|
||||
* @author Leo
|
||||
* @version 1.0
|
||||
* @create 2023/12/19 0019 上午 10:33
|
||||
* @description:
|
||||
*/
|
||||
public interface IEnumForString {
|
||||
|
||||
String getKey();
|
||||
|
||||
String getName();
|
||||
}
|
||||
Reference in New Issue
Block a user