提交 7c80a0b1 编写于 作者: sq3536's avatar sq3536

修改说明

上级 4f8b0159
......@@ -122,7 +122,8 @@ public class EntityModel extends BaseModel {
{
return !ObjectUtils.isEmpty(references);
}
public boolean hasPhisicalLinkField=false;
private Map<String,RelationshipModel> refMaps;
......@@ -815,6 +816,10 @@ public class EntityModel extends BaseModel {
relationshipModel.setFkField(fieldModel);
relationshipModel.setFkFieldCodeName(fieldModel.getCodeName().toString());
}
else if(defield.isPhisicalDEField()||(!StringUtils.isEmpty(defield.getUnionKeyValue())))
{
hasPhisicalLinkField=true;
}
}
}
......
......@@ -325,5 +325,23 @@ public class VoFieldModel extends BaseModel {
return example;
}
private String columnName;
public String getColumnName() {
if(columnName==null) {
columnName = "";
if(getAppDEField()!=null) {
if(appDEField.isPhisicalDEField())
columnName="["+appDEField.getEntity().getTableName()+"."+appDEField.getColumnName().toUpperCase()+"]";
else if(appDEField.getDataEntityField().getDEFType()==5)
columnName="[TYYW_KG_XFJSDJZJB."+appDEField.getColumnName().toUpperCase()+"]";
else if(!ObjectUtils.isEmpty(appDEField.getRefFieldName()))
{
columnName="["+appDEField.getReference().getTableName()+"."+appDEField.getRefFieldName().toUpperCase()+"]";
}
}
}
return columnName;
}
}
......@@ -51,11 +51,11 @@ public class {{pascalCase ctrl.codeName}}AddDto extends {{pascalCase ctrl.codeNa
{{#if dict}}
@JsonFormat(shape = JsonFormat.Shape.{{#if singleSelect}}{{#eq type.java "String"}}STRING{{/eq}}{{#eq type.java "Integer"}}NUMBER{{/eq}}{{else}}STRING{{/if}})
{{/if}}
@JSONField(name = "{{lowerCase name}}"{{#timeType}} , format = "{{format}}"{{/timeType}}{{#if serializeUsing}} , serializeUsing = {{serializeUsing}}{{/if}})
@JSONField(name = "{{jsonName}}"{{#timeType}} , format = "{{format}}"{{/timeType}}{{#if serializeUsing}} , serializeUsing = {{serializeUsing}}{{/if}})
{{#eq javaType "Long"}}
@JsonSerialize(using = ToStringSerializer.class)
{{/eq}}
@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}}{{columnName}}{{#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}};
{{/if}}
......
......@@ -44,6 +44,9 @@ public class {{pascalCase ctrl.codeName}}BaseDto implements Serializable {
/**
* {{logicName}}
*/
{{#if required}}
{{#eq javaType "String"}}@NotBlank{{else}}@NotNull{{/eq}}(message = "{{logicName}}[{{jsonName}}]不能为空")
{{/if}}
@JsonProperty("{{jsonName}}")
{{#timeType}}
@JsonFormat(pattern = "{{format}}", locale = "zh", timezone = "GMT+8")
......@@ -52,11 +55,11 @@ public class {{pascalCase ctrl.codeName}}BaseDto implements Serializable {
{{#if dict}}
@JsonFormat(shape = JsonFormat.Shape.{{#if singleSelect}}{{#eq type.java "String"}}STRING{{/eq}}{{#eq type.java "Integer"}}NUMBER{{/eq}}{{else}}STRING{{/if}})
{{/if}}
@JSONField(name = "{{lowerCase name}}"{{#timeType}} , format = "{{format}}"{{/timeType}}{{#if serializeUsing}} , serializeUsing = {{serializeUsing}}{{/if}})
@JSONField(name = "{{jsonName}}"{{#timeType}} , format = "{{format}}"{{/timeType}}{{#if serializeUsing}} , serializeUsing = {{serializeUsing}}{{/if}})
{{#eq javaType "Long"}}
@JsonSerialize(using = ToStringSerializer.class)
{{/eq}}
@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}}{{columnName}}{{#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 dictList}}
public void set{{pascalCase codeName}}(String {{camelCase codeName}}) {
......
......@@ -43,6 +43,9 @@ public class {{pascalCase ctrl.codeName}}Dto extends {{pascalCase ctrl.codeName}
/**
* {{logicName}}
*/
{{#if required}}
{{#eq javaType "String"}}@NotBlank{{else}}@NotNull{{/eq}}(message = "{{logicName}}[{{jsonName}}]不能为空")
{{/if}}
@JsonProperty("{{jsonName}}")
{{#timeType}}
@JsonFormat(pattern = "{{format}}", locale = "zh", timezone = "GMT+8")
......@@ -51,11 +54,11 @@ public class {{pascalCase ctrl.codeName}}Dto extends {{pascalCase ctrl.codeName}
{{#if dict}}
@JsonFormat(shape = JsonFormat.Shape.{{#if singleSelect}}{{#eq type.java "String"}}STRING{{/eq}}{{#eq type.java "Integer"}}NUMBER{{/eq}}{{else}}STRING{{/if}})
{{/if}}
@JSONField(name = "{{lowerCase name}}"{{#timeType}} , format = "{{format}}"{{/timeType}}{{#if serializeUsing}} , serializeUsing = {{serializeUsing}}{{/if}})
@JSONField(name = "{{jsonName}}"{{#timeType}} , format = "{{format}}"{{/timeType}}{{#if serializeUsing}} , serializeUsing = {{serializeUsing}}{{/if}})
{{#eq javaType "Long"}}
@JsonSerialize(using = ToStringSerializer.class)
{{/eq}}
@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 example}}, example = "{{example}}"{{/if}})
@ApiModelProperty(value = "{{logicName}}{{columnName}}{{#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 example}}, example = "{{example}}"{{/if}})
protected {{javaType}} {{camelCase codeName}};
{{/if}}
......
......@@ -51,11 +51,11 @@ public class {{pascalCase ctrl.codeName}}UpdateDto extends {{pascalCase ctrl.cod
{{#if dict}}
@JsonFormat(shape = JsonFormat.Shape.{{#if singleSelect}}{{#eq type.java "String"}}STRING{{/eq}}{{#eq type.java "Integer"}}NUMBER{{/eq}}{{else}}STRING{{/if}})
{{/if}}
@JSONField(name = "{{lowerCase name}}"{{#timeType}} , format = "{{format}}"{{/timeType}}{{#if serializeUsing}} , serializeUsing = {{serializeUsing}}{{/if}})
@JSONField(name = "{{jsonName}}"{{#timeType}} , format = "{{format}}"{{/timeType}}{{#if serializeUsing}} , serializeUsing = {{serializeUsing}}{{/if}})
{{#eq javaType "Long"}}
@JsonSerialize(using = ToStringSerializer.class)
{{/eq}}
@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}}{{columnName}}{{#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}};
{{/if}}
......
{{#eq apps "link"}}
package {{packageName}}.api.{{apps}}.dict;
import cn.ibizlab.edge.api.link.service.DictService;
import org.springframework.beans.factory.annotation.Autowired;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -20,6 +22,16 @@ import java.util.List;
@ApiSupport(order = 99)
public class DictHtmlResource {
@Autowired
private DictService dictService;
@RequestMapping(method = RequestMethod.GET, value = "/sync")
public ResponseEntity<String> sync() {
dictService.syncDict();
return ResponseEntity.ok("同步完成");
}
private String html="<html lang=\"en\"><head><meta charset=\"UTF-8\"><title></title>" +
"<style>table.reference,table.tecspec {table-layout:fixed;word-break:break-all;border-collapse: collapse;width:100%%;margin: 4px} table.reference .fa {font-size: 24px;} table.reference td:nth-child(odd) {background-color: #f2f7f9} table.reference td:nth-child(even) {background-color: #fff} table.reference tr.fixzebra {background-color: #f6f4f0} table.reference th {line-height: 2em;min-width: 24px;color: #fff;background-color: #555;border: 1px solid #555;font-size: 12px;padding: 3px;vertical-align: top;text-align: left} table.reference td {line-height: 2em;min-width: 24px;border: 1px solid #d4d4d4;padding: 5px;padding-top: 7px;padding-bottom: 7px;font-size: 12px;vertical-align: top;color: #606266;} .captr{height:0px;border: 0px;margin:0px;padding:0px}" +
"</style></header><body>%s<br/></body></html>";
......
{{#eq apps "link"}}
package {{packageName}}.api.{{apps}}.service;
import cn.ibizlab.edge.core.common.domain.*;
import {{packageName}}.api.{{apps}}.dict.*;
import org.springframework.stereotype.Service;
import lombok.extern.slf4j.Slf4j;
import java.util.*;
import org.springframework.beans.factory.annotation.Autowired;
import cn.ibizlab.edge.core.common.service.DictCatalogService;
@Slf4j
@Service("link-DictService")
public class DictService {
@Autowired
private DictCatalogService dictCatalogService;
public void syncDict() {
{{#each app.dicts}}
{
DictCatalog dict=new DictCatalog();
dict.setCode("{{pascalCase codeName}}Dict");
dict.setName("{{name}}");
dict.setId(dict.getCode());
List<DictOption> options=new ArrayList<>();
new {{pascalCase codeName}}Dict().getAllItems().forEach(item->{
DictOption option=new DictOption();
option.setCatalog(dict);
option.setCatalogId(dict.getId());
option.setCatalogName(dict.getName());
option.setValue(item.getValue());
option.setLabel(item.getLabel());
option.setParent(item.getParent());
option.setShoworder(options.size()+1);
options.add(option);
});
dict.setOptions(options);
dictCatalogService.save(dict);
}
{{/each}}
}
}
{{/eq}}
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册