From b82e18a4b3f8181ebcad7c65086c6079893ce610 Mon Sep 17 00:00:00 2001 From: wayn <1669738430@qq.com> Date: Tue, 29 Nov 2022 23:02:26 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E5=95=86=E5=9F=8E):=20=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/wayn/common/enums/domain/AbstractIntConverter.java | 4 +++- .../java/com/wayn/common/enums/domain/SexConverter.java | 6 ++++++ .../java/com/wayn/common/enums/domain/StatusConverter.java | 6 ++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/waynboot-common/src/main/java/com/wayn/common/enums/domain/AbstractIntConverter.java b/waynboot-common/src/main/java/com/wayn/common/enums/domain/AbstractIntConverter.java index 9edb0f3..50ed17d 100644 --- a/waynboot-common/src/main/java/com/wayn/common/enums/domain/AbstractIntConverter.java +++ b/waynboot-common/src/main/java/com/wayn/common/enums/domain/AbstractIntConverter.java @@ -5,12 +5,14 @@ import com.alibaba.excel.metadata.GlobalConfiguration; import com.alibaba.excel.metadata.data.WriteCellData; import com.alibaba.excel.metadata.property.ExcelContentProperty; -import java.util.Arrays; import java.util.List; import java.util.Map; import static java.util.stream.Collectors.toMap; +/** + * 定义int字段抽象转换类,实现通用转换逻辑 + */ public abstract class AbstractIntConverter implements Converter { abstract List getArr(); diff --git a/waynboot-common/src/main/java/com/wayn/common/enums/domain/SexConverter.java b/waynboot-common/src/main/java/com/wayn/common/enums/domain/SexConverter.java index 9af8f6e..701991f 100644 --- a/waynboot-common/src/main/java/com/wayn/common/enums/domain/SexConverter.java +++ b/waynboot-common/src/main/java/com/wayn/common/enums/domain/SexConverter.java @@ -4,6 +4,9 @@ package com.wayn.common.enums.domain; import java.util.Arrays; import java.util.List; +/** + * 通用性别字段转换类 + */ public class SexConverter extends AbstractIntConverter { @Override @@ -12,6 +15,9 @@ public class SexConverter extends AbstractIntConverter { return Arrays.stream(values).map(sexEnum -> new ConverterDTO(sexEnum.getType(), sexEnum.getDesc())).toList(); } + /** + * 性别枚举 + */ enum SexEnum { MAN(0, "男"), WOMAN(1, "女"); diff --git a/waynboot-common/src/main/java/com/wayn/common/enums/domain/StatusConverter.java b/waynboot-common/src/main/java/com/wayn/common/enums/domain/StatusConverter.java index d998aee..de84caf 100644 --- a/waynboot-common/src/main/java/com/wayn/common/enums/domain/StatusConverter.java +++ b/waynboot-common/src/main/java/com/wayn/common/enums/domain/StatusConverter.java @@ -3,6 +3,9 @@ package com.wayn.common.enums.domain; import java.util.Arrays; import java.util.List; +/** + * 通用状态字段转换类 + */ public class StatusConverter extends AbstractIntConverter { @Override @@ -11,6 +14,9 @@ public class StatusConverter extends AbstractIntConverter { return Arrays.stream(values).map(sexEnum -> new ConverterDTO(sexEnum.getType(), sexEnum.getDesc())).toList(); } + /** + * 状态枚举 + */ enum StatusEnum { MAN(0, "启用"),