From dedb813021285cea7397e16760381c6484e43923 Mon Sep 17 00:00:00 2001 From: wangliwen Date: Tue, 10 May 2022 09:57:18 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B5=84=E6=BA=90=E7=9A=84=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E5=8A=A0=E5=85=A5=E6=9E=9A=E4=B8=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/resource/dto/ResourceDTO.java | 28 ++++++++-- .../entity/ResourceEntityDelFlag.java | 51 +++++++++++++++++++ 2 files changed, 74 insertions(+), 5 deletions(-) create mode 100644 renren-admin/src/main/java/io/renren/modules/resource/entity/ResourceEntityDelFlag.java diff --git a/renren-admin/src/main/java/io/renren/modules/resource/dto/ResourceDTO.java b/renren-admin/src/main/java/io/renren/modules/resource/dto/ResourceDTO.java index ce5bb875..a4ed16b9 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/dto/ResourceDTO.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/dto/ResourceDTO.java @@ -1,6 +1,7 @@ package io.renren.modules.resource.dto; import io.renren.modules.resource.entity.AttrEntity; +import io.renren.modules.resource.entity.ResourceEntityDelFlag; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -8,13 +9,14 @@ import lombok.Data; import java.io.Serializable; import java.util.Date; import java.util.List; +import java.util.Optional; /** -* 资源表 -* -* @author dg -* @since 1.0 2022-04-13 -*/ + * 资源表 + * + * @author dg + * @since 1.0 2022-04-13 + */ @Data @ApiModel(value = "资源表") public class ResourceDTO implements Serializable { @@ -54,6 +56,8 @@ public class ResourceDTO implements Serializable { private Long visits; @ApiModelProperty(value = "删除标志:0:正常;1:已删除;2:待审核;3:审核中;9其他") private Integer delFlag; + @ApiModelProperty(value = "删除标志tip:0:正常;1:已删除;2:待审核;3:审核中;9其他") + private String delFlagTip; @ApiModelProperty(value = "创建人") private Long creator; @ApiModelProperty(value = "创建时间") @@ -93,4 +97,18 @@ public class ResourceDTO implements Serializable { @ApiModelProperty(value = "附件") private String enclosure; + public String getDelFlagTip() { + if (this.delFlag != null) { + Optional resourceEntityDelFlagOptional = Optional.of(ResourceEntityDelFlag.getByFlag(this.delFlag)); + if (resourceEntityDelFlagOptional.isPresent()) { + return resourceEntityDelFlagOptional.get().getTip(); + } + return delFlagTip; + } + return delFlagTip; + } + + public void setDelFlagTip(String delFlagTip) { + this.delFlagTip = delFlagTip; + } } \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/resource/entity/ResourceEntityDelFlag.java b/renren-admin/src/main/java/io/renren/modules/resource/entity/ResourceEntityDelFlag.java new file mode 100644 index 00000000..65eba940 --- /dev/null +++ b/renren-admin/src/main/java/io/renren/modules/resource/entity/ResourceEntityDelFlag.java @@ -0,0 +1,51 @@ +package io.renren.modules.resource.entity; + + +import java.util.Arrays; + +/** + * ResourceEntity del_flag 枚举 + */ +public enum ResourceEntityDelFlag { + + NORMAL(0, "正常"), + DELETED(1, "已删除"), + PENDING_REVIEW(2, "上架待审核"), + UNDER_REVIEW(3, "上架审核中"), + UNDERCARRIAGE_REVIEW(4, "下架审核中"), + UNDERCARRIAGE(5, "已下架"), + OTHER(9, "其他"); + + private int flag; + private String tip; + + ResourceEntityDelFlag(int flag, String tip) { + this.flag = flag; + this.tip = tip; + } + + public static ResourceEntityDelFlag getByFlag(int flag) { + if (flag < 1 || flag > ResourceEntityDelFlag.values().length) { + return null; + } + ResourceEntityDelFlag[] index = ResourceEntityDelFlag.values(); + return Arrays.asList(index).stream().filter(index_ -> index_.flag == flag).findAny().orElse(null); + } + + + public int getFlag() { + return flag; + } + + public void setFlag(int flag) { + this.flag = flag; + } + + public String getTip() { + return tip; + } + + public void setTip(String tip) { + this.tip = tip; + } +}