提交 09ef6edb 编写于 作者: sq3536's avatar sq3536

转移

上级 c722653f
package cn.ibizlab.util.dict;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.Accessors;
import java.util.ArrayList;
import java.util.List;
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class Catalog
{
private String code;
private String name;
@JSONField(name = "items")
@JsonProperty("items")
private List<Option> options = new ArrayList<>();
}
package cn.ibizlab.util.dict;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.Accessors;
import java.util.List;
import java.util.Map;
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class CodeItem
{
private String id;
private Object value;
private String label;
@JsonIgnore
@JSONField(serialize = false)
private List<CodeItem> children;
private String iconClass;
private String filter;
private Boolean disabled;
@JSONField(name = "pvalue")
@JsonProperty("pvalue")
private String parent;
private Map<String,Object> extension;
@JSONField(name = "text")
@JsonProperty("text")
public String getText()
{
return label;
}
}
package cn.ibizlab.util.dict;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.Accessors;
import java.util.ArrayList;
import java.util.List;
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class CodeList
{
@JSONField(name = "srfkey")
@JsonProperty("srfkey")
private String code;
private String name;
@JSONField(name = "emptytext")
@JsonProperty("emptytext")
public String getEmptytext()
{
return "";
}
@JSONField(name = "items")
@JsonProperty("items")
private List<CodeItem> options = new ArrayList<>();
public CodeItem findCodeItem(Object value){
for(CodeItem codeItem : options){
if(value != null && codeItem.getValue() != null && value.equals(codeItem.getValue()))
return codeItem;
}
return null;
}
public CodeItem findChildren(Object value){
CodeItem resultCodeItem = this.findCodeItem(value);
List<CodeItem> children = new ArrayList<>();
for(CodeItem codeItem : options){
if(value != null && resultCodeItem.getValue() != null && codeItem.getParent() != null && codeItem.getParent().equals(resultCodeItem.getValue()))
children.add(codeItem);
}
resultCodeItem.setChildren(children);
return resultCodeItem;
}
}
package cn.ibizlab.util.dict;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.Accessors;
import java.util.List;
import java.util.Map;
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class Option
{
private String id;
private Object value;
private String label;
private List<Option> children;
private String iconClass;
private String filter;
private Boolean disabled;
@JsonIgnore
@JSONField(serialize = false)
private String parent;
private Map<String,Object> extension;
}
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册