资源的状态加入枚举
This commit is contained in:
parent
6e5d988f16
commit
dedb813021
|
@ -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<ResourceEntityDelFlag> 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;
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue