feat: 引入店员资料审核状态枚举
Some checks failed
Build and Push Backend / docker (push) Failing after 8s

This commit is contained in:
irving
2025-10-19 17:37:51 -04:00
parent 3e079850e6
commit 82b86ae86e
4 changed files with 94 additions and 9 deletions

View File

@@ -0,0 +1,46 @@
package com.starry.common.enums;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel;
/**
* 店员资料审核状态枚举,集中维护状态代码及含义。
*/
@ApiModel(value = "店员资料审核状态", description = "店员资料审核状态枚举,避免魔法值")
public enum ClerkReviewState {
PENDING("0", "未审核"),
APPROVED("1", "审核通过"),
REJECTED("2", "审核不通过");
private final String code;
private final String description;
ClerkReviewState(String code, String description) {
this.code = code;
this.description = description;
}
@JsonValue
public String getCode() {
return code;
}
public String getDescription() {
return description;
}
@JsonCreator
public static ClerkReviewState fromCode(String code) {
if (code == null) {
return null;
}
for (ClerkReviewState state : ClerkReviewState.values()) {
if (state.code.equals(code)) {
return state;
}
}
throw new IllegalArgumentException("Unknown ClerkReviewState code: " + code);
}
}