提交 6177f2ec 编写于 作者: sq3536's avatar sq3536

接口实体

上级 1d06780b
...@@ -95,8 +95,11 @@ public class ApiEntityModel extends BaseModel { ...@@ -95,8 +95,11 @@ public class ApiEntityModel extends BaseModel {
} }
} }
//接口关系方法 //接口关系方法
if (getApiDataEntity().getMinorPSDEServiceAPIRSs() != null) {
for (IPSDEServiceAPIRS iPSDEServiceAPIRS : getApiDataEntity().getMinorPSDEServiceAPIRSs()) { if (this.getApi().getSysServiceApi().getPSDEServiceAPIRSs() != null) {
for (IPSDEServiceAPIRS iPSDEServiceAPIRS : this.getApi().getSysServiceApi().getPSDEServiceAPIRSs()) {
if(!iPSDEServiceAPIRS.getMinorPSDEServiceAPI().getId().equalsIgnoreCase(this.getApiDataEntity().getId()))
continue;
if (iPSDEServiceAPIRS.getPSDEServiceAPIMethods() != null) { if (iPSDEServiceAPIRS.getPSDEServiceAPIMethods() != null) {
ApiEntityRSModel apiEntityRSModel = api.getApiEntityRS(iPSDEServiceAPIRS.getName()); ApiEntityRSModel apiEntityRSModel = api.getApiEntityRS(iPSDEServiceAPIRS.getName());
//计算父路径 //计算父路径
......
...@@ -96,6 +96,8 @@ public class VoFieldModel extends BaseModel { ...@@ -96,6 +96,8 @@ public class VoFieldModel extends BaseModel {
private boolean singleFile=false; private boolean singleFile=false;
private String fileExt;
private boolean fileList=false; private boolean fileList=false;
private boolean singleDict=false; private boolean singleDict=false;
...@@ -126,14 +128,23 @@ public class VoFieldModel extends BaseModel { ...@@ -126,14 +128,23 @@ public class VoFieldModel extends BaseModel {
} }
else if(this.getPSEditor()!=null&&(this.getPSDEFormItem() instanceof IPSFileUploader||"FILEUPLOADER".equals(this.getPSEditor().getEditorType()))) else if(this.getPSEditor()!=null&&(this.getPSDEFormItem() instanceof IPSFileUploader||"FILEUPLOADER".equals(this.getPSEditor().getEditorType())))
{ {
javaType = "List<FileDto>"; javaType = "FileListDto";
serializeUsing="com.alibaba.fastjson.serializer.ToStringSerializer.class";
fileList=true; fileList=true;
} }
else if(this.getPSEditor()!=null&&("hfh".equals(this.getPSEditor().getEditorStyle())||"zp".equals(this.getPSEditor().getEditorStyle()))) else if(this.getPSEditor()!=null&&("zp".equals(this.getPSEditor().getEditorStyle())))
{
javaType = "FileDto";
serializeUsing="com.alibaba.fastjson.serializer.ToStringSerializer.class";
singleFile=true;
fileExt=".png";
}
else if(this.getPSEditor()!=null&&("hfh".equals(this.getPSEditor().getEditorStyle())))
{ {
javaType = "FileDto"; javaType = "FileDto";
serializeUsing="com.alibaba.fastjson.serializer.ToStringSerializer.class"; serializeUsing="com.alibaba.fastjson.serializer.ToStringSerializer.class";
singleFile=true; singleFile=true;
fileExt=".doc";
} }
} }
return javaType; return javaType;
......
package cn.ibizlab.util.domain; package cn.ibizlab.util.domain;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.*;
import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonInclude.Include;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.SneakyThrows;
import java.nio.file.OpenOption;
import java.nio.file.Path;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
@Data @Data
@JsonInclude(Include.NON_NULL) @JsonInclude(Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true) @JsonIgnoreProperties(ignoreUnknown = true)
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor
@ApiModel("文件") @ApiModel("文件")
public class FileDto public class FileDto
{ {
...@@ -21,4 +33,55 @@ public class FileDto ...@@ -21,4 +33,55 @@ public class FileDto
private String name; private String name;
@ApiModelProperty(value = "文件流/base64", position = 3) @ApiModelProperty(value = "文件流/base64", position = 3)
private byte[] content; private byte[] content;
@SneakyThrows
@JsonIgnore
@JSONField(serialize = false)
public File getFile(String rootPath, boolean override) {
if(id==null&&content==null)
return null;
if(id==null)
id= UUID.randomUUID().toString();
if(name==null)
name=id;
Path path= Paths.get(rootPath,id,name);
if(override&&content!=null)
{
File dir=path.getParent().toFile();
if(!dir.exists())
dir.mkdirs();
Files.write(path,content);
}
if(Files.exists(path))
return path.toFile();
return null;
}
@JsonIgnore
@JSONField(serialize = false)
protected Map<String,Object> extensionparams=new HashMap<String,Object>();
@JsonIgnore
@JSONField(serialize = false)
public Object get(String field) {
return this.extensionparams.get(field);
}
@JsonAnyGetter
@JSONField(name = "_any", unwrapped = true, serialize = true, deserialize = false)
public Map<String , Object> any() {
return extensionparams;
}
@JsonAnySetter
@JSONField(name = "_any", unwrapped = true, serialize = false, deserialize = true)
public void set(String field, Object value) {
this.extensionparams.put(field ,value);
}
@Override
public String toString() {
return getId();
}
} }
\ No newline at end of file
package cn.ibizlab.util.domain;
import com.alibaba.fastjson.JSON;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@Data
@JsonInclude(Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
@AllArgsConstructor
@ApiModel("文件列表")
public class FileListDto extends ArrayList<FileDto>
{
@Override
public String toString() {
List<Map> list=new ArrayList<>();
this.forEach(item->{
Map map=new LinkedHashMap();
map.putAll(item.getExtensionparams());
map.put("id",item.getId());
map.put("name",item.getName());
});
return JSON.toJSONString(list);
}
}
\ No newline at end of file
...@@ -58,6 +58,20 @@ public class {{pascalCase ctrl.codeName}}AddDto extends {{pascalCase ctrl.codeNa ...@@ -58,6 +58,20 @@ public class {{pascalCase ctrl.codeName}}AddDto extends {{pascalCase ctrl.codeNa
@ApiModelProperty(value = "{{logicName}}{{#if userTag}}{{userTag}}{{/if}}{{#if dict}}{{#unless singleSelect}}多选{{/unless}}【字典:{{dict.name}}{{/if}}{{#if timeType}},格式:{{format}}{{/if}}", position = {{position}}{{#if timeType}}, notes = "格式:{{format}}"{{/if}}{{#if dict}}, notes = "字典:{{dict.name}}", dataType = "{{lowerCase type.java}}", reference = "{{dictCodeName}}"{{/if}}{{#if required}}, required = true{{/if}}{{#if hidden}}, hidden = true{{/if}}{{#if example}}, example = "{{example}}"{{/if}}) @ApiModelProperty(value = "{{logicName}}{{#if userTag}}{{userTag}}{{/if}}{{#if dict}}{{#unless singleSelect}}多选{{/unless}}【字典:{{dict.name}}{{/if}}{{#if timeType}},格式:{{format}}{{/if}}", position = {{position}}{{#if timeType}}, notes = "格式:{{format}}"{{/if}}{{#if dict}}, notes = "字典:{{dict.name}}", dataType = "{{lowerCase type.java}}", reference = "{{dictCodeName}}"{{/if}}{{#if required}}, required = true{{/if}}{{#if hidden}}, hidden = true{{/if}}{{#if example}}, example = "{{example}}"{{/if}})
protected {{javaType}} {{camelCase codeName}} {{#if createDefaultValue}}= {{createDefaultValue}}{{/if}}; protected {{javaType}} {{camelCase codeName}} {{#if createDefaultValue}}= {{createDefaultValue}}{{/if}};
{{/if}}
{{#if javaType}}
{{#if singleFile}}
public void set{{pascalCase codeName}}({{javaType}} {{camelCase codeName}}) {
this.{{camelCase codeName}} = {{camelCase codeName}};
}
{{/if}}
{{#if fileList}}
public void set{{pascalCase codeName}}({{javaType}} {{camelCase codeName}}) {
this.{{camelCase codeName}} = {{camelCase codeName}};
}
{{/if}}
{{/if}} {{/if}}
{{/each}} {{/each}}
@Override @Override
......
...@@ -67,7 +67,9 @@ public class {{pascalCase ctrl.codeName}}BaseDto implements Serializable { ...@@ -67,7 +67,9 @@ public class {{pascalCase ctrl.codeName}}BaseDto implements Serializable {
public void set{{pascalCase codeName}}(String {{camelCase codeName}}) { public void set{{pascalCase codeName}}(String {{camelCase codeName}}) {
if({{camelCase codeName}}==null) if({{camelCase codeName}}==null)
return; return;
FileDto fileDto = new FileDto({{camelCase codeName}},null,null); FileDto fileDto = new FileDto();
fileDto.setId({{camelCase codeName}});
{{#if fileExt}}fileDto.setName("{{camelCase codeName}}{{fileExt}}");{{/if}}
this.{{camelCase codeName}} = fileDto; this.{{camelCase codeName}} = fileDto;
} }
{{/if}} {{/if}}
...@@ -75,7 +77,7 @@ public class {{pascalCase ctrl.codeName}}BaseDto implements Serializable { ...@@ -75,7 +77,7 @@ public class {{pascalCase ctrl.codeName}}BaseDto implements Serializable {
public void set{{pascalCase codeName}}(String {{camelCase codeName}}) { public void set{{pascalCase codeName}}(String {{camelCase codeName}}) {
if({{camelCase codeName}}==null) if({{camelCase codeName}}==null)
return; return;
this.{{camelCase codeName}} = JSON.parseArray({{camelCase codeName}},FileDto.class); this.{{camelCase codeName}} = JSON.parseObject({{camelCase codeName}},FileListDto.class);
} }
{{/if}} {{/if}}
......
...@@ -58,6 +58,20 @@ public class {{pascalCase ctrl.codeName}}UpdateDto extends {{pascalCase ctrl.cod ...@@ -58,6 +58,20 @@ public class {{pascalCase ctrl.codeName}}UpdateDto extends {{pascalCase ctrl.cod
@ApiModelProperty(value = "{{logicName}}{{#if userTag}}{{userTag}}{{/if}}{{#if dict}}{{#unless singleSelect}}多选{{/unless}}【字典:{{dict.name}}{{/if}}{{#if timeType}},格式:{{format}}{{/if}}", position = {{position}}{{#if timeType}}, notes = "格式:{{format}}"{{/if}}{{#if dict}}, notes = "字典:{{dict.name}}", dataType = "{{lowerCase type.java}}", reference = "{{dictCodeName}}"{{/if}}{{#if required}}, required = true{{/if}}{{#if hidden}}, hidden = true{{/if}}{{#if example}}, example = "{{example}}"{{/if}}) @ApiModelProperty(value = "{{logicName}}{{#if userTag}}{{userTag}}{{/if}}{{#if dict}}{{#unless singleSelect}}多选{{/unless}}【字典:{{dict.name}}{{/if}}{{#if timeType}},格式:{{format}}{{/if}}", position = {{position}}{{#if timeType}}, notes = "格式:{{format}}"{{/if}}{{#if dict}}, notes = "字典:{{dict.name}}", dataType = "{{lowerCase type.java}}", reference = "{{dictCodeName}}"{{/if}}{{#if required}}, required = true{{/if}}{{#if hidden}}, hidden = true{{/if}}{{#if example}}, example = "{{example}}"{{/if}})
protected {{javaType}} {{camelCase codeName}} {{#if updateDefaultValue}}= {{updateDefaultValue}}{{/if}}; protected {{javaType}} {{camelCase codeName}} {{#if updateDefaultValue}}= {{updateDefaultValue}}{{/if}};
{{/if}}
{{#if javaType}}
{{#if singleFile}}
public void set{{pascalCase codeName}}({{javaType}} {{camelCase codeName}}) {
this.{{camelCase codeName}} = {{camelCase codeName}};
}
{{/if}}
{{#if fileList}}
public void set{{pascalCase codeName}}({{javaType}} {{camelCase codeName}}) {
this.{{camelCase codeName}} = {{camelCase codeName}};
}
{{/if}}
{{/if}} {{/if}}
{{/each}} {{/each}}
@Override @Override
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册