package com.ruoyi.account.enums;
|
|
import com.ruoyi.common.enums.BaseEnum;
|
import lombok.AllArgsConstructor;
|
import lombok.Getter;
|
|
/**
|
* 往来方类型枚举,对应 payment_record.party_type
|
*/
|
@Getter
|
@AllArgsConstructor
|
public enum PartyTypeEnum implements BaseEnum<Integer> {
|
|
CUSTOMER(1, "客户"),
|
SUPPLIER(2, "供应商"),
|
OUTSOURCING_PARTNER(3, "合作商");
|
|
private final Integer value;
|
private final String label;
|
|
@Override
|
public Integer getCode() {
|
return value;
|
}
|
|
@Override
|
public String getValue() {
|
return label;
|
}
|
|
public static PartyTypeEnum getByCode(Integer code) {
|
if (code == null) {
|
return null;
|
}
|
for (PartyTypeEnum partyType : values()) {
|
if (partyType.getCode().equals(code)) {
|
return partyType;
|
}
|
}
|
return null;
|
}
|
|
public static String getLabelByCode(Integer code) {
|
PartyTypeEnum partyType = getByCode(code);
|
return partyType == null ? "未知类型" : partyType.getValue();
|
}
|
}
|