提交 9b39e8e9 编写于 作者: sq3536's avatar sq3536

dto

上级 bb8546e9
package cn.ibizlab.util.domain;
import com.alibaba.fastjson.annotation.JSONField;
import com.alibaba.fastjson.util.TypeUtils;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
@Data
public class DTOBase implements Serializable {
@JsonIgnore
@JSONField(serialize = false)
private Map<String,Object> extensionparams=new HashMap<String,Object>();
@JsonIgnore
@JSONField(serialize = false)
public Map<String, Object> getExtensionparams() {
return extensionparams;
}
public void setExtensionparams(Map<String, Object> extensionparams) {
this.extensionparams = extensionparams;
}
@JsonAnyGetter
@JSONField(name = "_any", unwrapped = true, serialize = true, deserialize = false)
public Map<String , Object> any() {
return extensionparams;
}
public Object get(String field) {
return this.extensionparams.get(field.toLowerCase());
}
@JsonAnySetter
@JSONField(name = "_any", unwrapped = true, serialize = false, deserialize = true)
public void set(String field, Object value) {
this.extensionparams.put(field.toLowerCase(),value);
}
public <V> V getOrDefault(String field,V defaultValue) {
V v;
return ((v = (V)get(field)) != null)
? ((defaultValue!=null)? (V) TypeUtils.cast(v,defaultValue.getClass(),null):v)
: defaultValue;
}
}
...@@ -35,7 +35,7 @@ import {{packageName}}.api.{{apps}}.dict.*; ...@@ -35,7 +35,7 @@ import {{packageName}}.api.{{apps}}.dict.*;
@Data @Data
@JsonIgnoreProperties(ignoreUnknown = true) @JsonIgnoreProperties(ignoreUnknown = true)
@ApiModel(value = "{{ctrl.apiModelName}}BaseDto", description = "{{ctrl.appEntity.entity.logicName}}-{{pascalCase ctrl.codeName}}BaseDto-{{replace ctrl.logicName "表单" ""}}") @ApiModel(value = "{{ctrl.apiModelName}}BaseDto", description = "{{ctrl.appEntity.entity.logicName}}-{{pascalCase ctrl.codeName}}BaseDto-{{replace ctrl.logicName "表单" ""}}")
public class {{pascalCase ctrl.codeName}}BaseDto implements Serializable { public class {{pascalCase ctrl.codeName}}BaseDto extends DTOBase implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册