first commit

This commit is contained in:
蔡浩珊_信息数字化部
2026-05-23 17:20:26 +08:00
commit f053037227
152 changed files with 10574 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
package com.mikufufu.common.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public enum Channel {
WEB(1, "用户端"),
ADMIN(2, "管理端")
;
private final int type;
private final String name;
}

View File

@@ -0,0 +1,26 @@
package com.mikufufu.common.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public enum HtmlTemplate {
EMAIL_CODE("email_code", "email_code.html", "邮件验证码");
/**
* 模板名称
*/
private final String template;
/**
* 模板文件名称
*/
private final String fileName;
/**
* 描述
*/
private final String subject;
}

View File

@@ -0,0 +1,31 @@
package com.mikufufu.common.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 功能模块类型
*/
@Getter
@AllArgsConstructor
public enum ModuleType {
/**
* 用户模块
*/
USER(1, "用户模块"),
/**
* 系统模块
*/
SYSTEM(2, "系统模块"),
/**
* 其他模块
*/
OTHER(0, "其他");
private final int type;
private final String name;
}

View File

@@ -0,0 +1,48 @@
package com.mikufufu.common.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public enum OperationType {
/**
* 插入
*/
INSERT(1,"插入"),
/**
* 更新
*/
UPDATE(2,"更新"),
/**
* 删除
*/
DELETE(3,"删除"),
/**
* 登录
*/
LOGIN(4,"登录"),
/**
* 注册
*/
REGISTER(5,"注册"),
/**
* 发送邮件
*/
SEND_EMAIL(6,"发送邮件"),
/**
* 其他
*/
OTHER(0,"其他"),
;
private final int type;
private final String name;
}

View File

@@ -0,0 +1,21 @@
package com.mikufufu.common.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public enum ResultCode {
SUCCESS(200, "操作成功"),
FAIL(500, "操作失败"),
NOT_FOUND(404, "资源不存在"),
UNAUTHORIZED(401, "未授权"),
FORBIDDEN(403, "禁止访问"),
BAD_REQUEST(400, "请求参数错误"),
NOT_DATA(501, "暂无数据")
;
private final int code;
private final String message;
}

View File

@@ -0,0 +1,64 @@
package com.mikufufu.common.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
/**
* 系统角色枚举
*
*/
@Getter
@AllArgsConstructor
public enum RoleCode {
/**
* 超级管理员
*/
ROLE_SYSTEM_ADMIN("system_admin", 1, "超级管理员"),
/**
* 管理员
*/
ROLE_ADMIN("admin",2, "管理员"),
/**
* 普通用户
*/
ROLE_USER("user",3, "普通用户"),
/**
* 游客
*/
ROLE_VISITOR("visitor", 4, "游客");
/**
* 角色编码
*/
private final String code;
/**
* 角色值
*/
private final Integer value;
/**
* 描述
*/
private final String desc;
/**
* 根据角色编码获取枚举
* @param code 角色编码
* @return 枚举
*/
public static RoleCode getRoleCodeByCode(String code) {
return Arrays.stream(RoleCode.values())
.filter(role -> role.getCode().equals(code))
.findFirst()
.orElse(null);
}
public static RoleCode getRoleCodeByValue(Integer value) {
return Arrays.stream(RoleCode.values())
.filter(role -> role.getValue().equals(value))
.findFirst()
.orElse(null);
}
}

View File

@@ -0,0 +1,43 @@
package com.mikufufu.common.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
@Getter
@AllArgsConstructor
public enum SexType {
UNKNOWN(0,"未知"),
MAN(1,""),
WOMAN(2,"");
private final Integer type;
private final String name;
/**
* 根据type获取sexEnum
* @param type 类型
* @return sexEnum {@link SexType}
*/
public static SexType getByType(Integer type) {
return Arrays.stream(SexType.values())
.filter(sex -> sex.getType().equals(type))
.findFirst()
.orElse(UNKNOWN);
}
/**
* 根据type获取name
* @param type 类型
* @return 类型名称
*/
public static String getNameByType(Integer type) {
return Arrays.stream(SexType.values())
.filter(sex -> sex.getType().equals(type))
.findFirst()
.orElse(UNKNOWN).getName();
}
}

View File

@@ -0,0 +1,32 @@
package com.mikufufu.common.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 文件类型枚举类
*
*/
@Getter
@AllArgsConstructor
public enum UploadFileType {
/**
* 图片
*/
IMAGE("image"),
/**
* 视频
*/
VIDEO("video"),
/**
* 音频
*/
AUDIO("music"),
/**
* 文件
*/
FILE("file");
private final String path;
}

View File

@@ -0,0 +1,33 @@
package com.mikufufu.common.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public enum UserStatus {
NORMAL(0, "正常"),
DISABLED(1, "禁用"),
LOCKED(2, "锁定"),
;
private final Integer code;
private final String name;
/**
* 根据code获取枚举
*
* @param code code
* @return 枚举
*/
public static String getName(int code) {
for (UserStatus value : UserStatus.values()) {
if (value.code == code) {
return value.name;
}
}
return null;
}
}