first commit
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
package com.budwk.app.base.enums;
|
||||
|
||||
/**
|
||||
* 浏览器平台
|
||||
*/
|
||||
public enum BrowserPlatform {
|
||||
|
||||
PC_WEB,
|
||||
|
||||
H5_WEB,
|
||||
|
||||
WEI_XIN,
|
||||
|
||||
QI_YE_WEI_XIN;
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.budwk.app.base.enums;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Optional;
|
||||
|
||||
public interface CodedEnum {
|
||||
|
||||
Integer getCode();
|
||||
|
||||
String getMessage();
|
||||
|
||||
public static <E extends Enum<?> & CodedEnum> Optional<E> codeOf(Class<E> enumClass, Object code) {
|
||||
try {
|
||||
return Arrays.stream(enumClass.getEnumConstants()).filter(e ->
|
||||
e.getCode().equals(Convert.toInt(code))
|
||||
|| e.name().equalsIgnoreCase(Convert.toStr(code))
|
||||
|| e.getMessage().equalsIgnoreCase(Convert.toStr(code))
|
||||
).findAny();
|
||||
} catch (Exception e) {
|
||||
return Optional.empty();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据类型,用于转换String或Integer
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
default Class<?> getDataType() {
|
||||
return Integer.class;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.budwk.app.base.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 登录类型
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum LoginType {
|
||||
|
||||
QI_YE_WECHAT("企业微信"),
|
||||
WECHAT("微信"),
|
||||
PC_LOCAL("PC本地"),
|
||||
MOBILE_LOCAL("手机本地"),
|
||||
CAS("CAS");
|
||||
|
||||
private final String value;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.budwk.app.base.enums;
|
||||
|
||||
/**
|
||||
* 文件存储桶的权限策略枚举
|
||||
*/
|
||||
public enum MinIoFileBucketAuthEnum {
|
||||
/**
|
||||
* 私有的(仅有 owner 可以读写)
|
||||
*/
|
||||
PRIVATE,
|
||||
|
||||
/**
|
||||
* 公有读,私有写( owner 可以读写, 其他客户可以读)
|
||||
*/
|
||||
PUBLIC_READ,
|
||||
|
||||
/**
|
||||
* 公共读写(即所有人都可以读写,慎用)
|
||||
*/
|
||||
PUBLIC_READ_WRITE
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.budwk.app.base.enums;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author mldong
|
||||
* @date 2023/9/27
|
||||
*/
|
||||
@Data
|
||||
//@ApiModel(value = "UpAndDownParam对象", description = "启用/禁用实体")
|
||||
public class UpAndDownParam {
|
||||
// @ApiModelProperty(value = "id集合")
|
||||
private List<Object> ids;
|
||||
// @ApiModelProperty(value = "操作类型")
|
||||
private YesNoEnum opType;
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.budwk.app.base.enums;
|
||||
|
||||
import com.budwk.app.base.annotation.DictEnum;
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
|
||||
/**
|
||||
* yes_no
|
||||
*
|
||||
* @author mldong
|
||||
*/
|
||||
@DictEnum(key = "yes_no", name = "是否")
|
||||
public enum YesNoEnum implements CodedEnum {
|
||||
/**
|
||||
* 是
|
||||
*/
|
||||
YES(1, "是"),
|
||||
/**
|
||||
* 否
|
||||
*/
|
||||
NO(0, "否");
|
||||
private Integer code;
|
||||
private String message;
|
||||
/**
|
||||
* 未删除
|
||||
*/
|
||||
public final static int Y = 1;
|
||||
/**
|
||||
* 已删除
|
||||
*/
|
||||
public final static int N = 0;
|
||||
|
||||
@JsonCreator
|
||||
public static YesNoEnum forValue(Object value) {
|
||||
return CodedEnum.codeOf(YesNoEnum.class, value).get();
|
||||
}
|
||||
|
||||
YesNoEnum(int value, String name) {
|
||||
this.code = value;
|
||||
this.message = name;
|
||||
}
|
||||
|
||||
@JsonValue
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user