提交 0cdb4735 编写于 作者: sq3536's avatar sq3536

model

上级 9cb292f8
......@@ -313,28 +313,49 @@ public class CtrlModel extends BaseModel{
return StringAdvUtils.pascalcase(getCodeName());
}
private List<VoFieldModel> voItems;
private Map<String,VoFieldModel> voItemSets;
public List<VoFieldModel> getVoItems()
public Map<String,VoFieldModel> getVoItemSets()
{
if(voItems==null && this.getControl() instanceof IPSDEEditForm)
if(voItemSets==null && this.getControl() instanceof IPSDEEditForm)
{
IPSDEEditForm editForm=(IPSDEEditForm)this.getControl();
if(editForm.getPSDEFormItems()!=null)
{
voItems = new ArrayList<>();
voItemSets = new LinkedHashMap<>();
editForm.getPSDEFormPages().forEach(page->{
loopItem(page.getPSDEFormDetails()).forEach(item->{
VoFieldModel field=new VoFieldModel(this,item);
field.setPosition(voItems.size()+1);
voItems.add(field);
field.setPosition(voItemSets.size()+1);
voItemSets.put(field.getName().toLowerCase(),field);
});
});
if(appEntity!=null&&appEntity.getEntity()!=null)
{
FieldModel keyField=appEntity.getEntity().getKeyField();
if(!voItemSets.containsKey(keyField.getCodeName().toLowerCase()))
sysField.put("key",keyField);
else
sysField.put("key",voItemSets.get(keyField.getCodeName().toLowerCase()));
FieldModel mainField=appEntity.getEntity().getMajorField();
if(mainField!=null && !voItemSets.containsKey(mainField.getCodeName().toLowerCase()))
sysField.put("major",mainField);
else if (voItemSets.containsKey(mainField.getCodeName().toLowerCase()))
sysField.put("major",voItemSets.get(mainField.getCodeName().toLowerCase()));
}
}
}
return voItems;
return voItemSets;
}
private Map<String,BaseModel> sysField=new LinkedHashMap<>();
public Collection<VoFieldModel> getVoItems()
{
if(getVoItemSets()!=null)
return voItemSets.values();
return null;
}
......
......@@ -221,6 +221,8 @@ public class EntityModel extends BaseModel {
private FieldModel orgField;
private FieldModel majorField;
public FieldModel getOrgField() {
if(fields!=null&&orgField==null)
......@@ -778,6 +780,9 @@ public class EntityModel extends BaseModel {
FieldModel fieldModel=new FieldModel(this,defield);
if(defield.isMajorDEField())
this.majorField=fieldModel;
try {
fieldModel.setDict(defield.getPSCodeList()!=null?defield.getPSCodeList().getCodeName():null);
} catch (Exception ex){}
......
......@@ -48,7 +48,7 @@ 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 = "{{jsonName}}"{{#timeType}} , format = "{{format}}"{{/timeType}}{{#if serializeUsing}} , serializeUsing = {{serializeUsing}}{{/if}})
@JSONField(name = "{{lowerCase name}}"{{#timeType}} , format = "{{format}}"{{/timeType}}{{#if serializeUsing}} , serializeUsing = {{serializeUsing}}{{/if}})
{{#eq javaType "Long"}}
@JsonSerialize(using = ToStringSerializer.class)
{{/eq}}
......@@ -57,5 +57,10 @@ public class {{pascalCase ctrl.codeName}}AddDto extends {{pascalCase ctrl.codeNa
{{/if}}
{{/each}}
@Override
public String getSrfuf() {
return srfuf==null?"0":srfuf;
}
}
{{/eq}}
\ No newline at end of file
......@@ -23,6 +23,7 @@ import lombok.experimental.Accessors;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.util.ObjectUtils;
import cn.ibizlab.util.domain.*;
import {{packageName}}.api.{{apps}}.dict.*;
......@@ -48,7 +49,7 @@ 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 = "{{jsonName}}"{{#timeType}} , format = "{{format}}"{{/timeType}}{{#if serializeUsing}} , serializeUsing = {{serializeUsing}}{{/if}})
@JSONField(name = "{{lowerCase name}}"{{#timeType}} , format = "{{format}}"{{/timeType}}{{#if serializeUsing}} , serializeUsing = {{serializeUsing}}{{/if}})
{{#eq javaType "Long"}}
@JsonSerialize(using = ToStringSerializer.class)
{{/eq}}
......@@ -57,5 +58,54 @@ public class {{pascalCase ctrl.codeName}}BaseDto implements Serializable {
{{/unless}}
{{/each}}
{{#if ctrl.sysField.key}}
{{#or ctrl.sysField.key.hidden ctrl.sysField.key.entity}}
@JsonProperty("{{ctrl.sysField.key.jsonName}}")
@JSONField(name = "{{lowerCase ctrl.sysField.key.jsonName}}")
@ApiModelProperty(value = "{{ctrl.sysField.key.logicName}}", position = {{#if ctrl.sysField.key.position}}{{ctrl.sysField.key.position}}{{else}}9980{{/if}})
protected {{ctrl.sysField.key.type.java}} {{camelCase ctrl.sysField.key.codeName}};
{{/or}}
@ApiModelProperty(value = "系统数据主键", hidden = true)
protected {{ctrl.sysField.key.type.java}} srfkey;
public {{ctrl.sysField.key.type.java}} getSrfkey() {
return this.get{{pascalCase ctrl.sysField.key.codeName}}();
}
public void setSrfkey({{ctrl.sysField.key.type.java}} {{camelCase ctrl.sysField.key.codeName}}) {
this.srfkey = {{camelCase ctrl.sysField.key.codeName}};
if(!ObjectUtils.isEmpty({{camelCase ctrl.sysField.key.codeName}}))
this.set{{pascalCase ctrl.sysField.key.codeName}}({{camelCase ctrl.sysField.key.codeName}});
}
{{/if}}
{{#if ctrl.sysField.major}}
{{#or ctrl.sysField.major.hidden ctrl.sysField.major.entity}}
@JsonProperty("{{ctrl.sysField.major.jsonName}}")
@JSONField(name = "{{lowerCase ctrl.sysField.major.jsonName}}")
@ApiModelProperty(value = "{{ctrl.sysField.major.logicName}}", position = {{#if ctrl.sysField.major.position}}{{ctrl.sysField.major.position}}{{else}}9981{{/if}})
protected {{ctrl.sysField.major.type.java}} {{camelCase ctrl.sysField.major.codeName}};
{{/or}}
@ApiModelProperty(value = "系统数据显示", hidden = true)
protected {{ctrl.sysField.major.type.java}} srfmajortext;
public {{ctrl.sysField.major.type.java}} getSrfmajortext() {
return this.get{{pascalCase ctrl.sysField.major.codeName}}();
}
public void setSrfmajortext({{ctrl.sysField.major.type.java}} {{camelCase ctrl.sysField.major.codeName}}) {
this.srfmajortext = {{camelCase ctrl.sysField.major.codeName}};
if(!ObjectUtils.isEmpty({{camelCase ctrl.sysField.major.codeName}}))
this.set{{pascalCase ctrl.sysField.major.codeName}}({{camelCase ctrl.sysField.major.codeName}});
}
{{/if}}
@JsonProperty("srfuf")
@JSONField(name = "srfuf")
@ApiModelProperty(value = "系统更新标志", hidden = true)
protected String srfuf;
}
{{/eq}}
\ No newline at end of file
......@@ -48,7 +48,7 @@ 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 = "{{jsonName}}"{{#timeType}} , format = "{{format}}"{{/timeType}}{{#if serializeUsing}} , serializeUsing = {{serializeUsing}}{{/if}})
@JSONField(name = "{{lowerCase name}}"{{#timeType}} , format = "{{format}}"{{/timeType}}{{#if serializeUsing}} , serializeUsing = {{serializeUsing}}{{/if}})
{{#eq javaType "Long"}}
@JsonSerialize(using = ToStringSerializer.class)
{{/eq}}
......
......@@ -48,7 +48,7 @@ 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 = "{{jsonName}}"{{#timeType}} , format = "{{format}}"{{/timeType}}{{#if serializeUsing}} , serializeUsing = {{serializeUsing}}{{/if}})
@JSONField(name = "{{lowerCase name}}"{{#timeType}} , format = "{{format}}"{{/timeType}}{{#if serializeUsing}} , serializeUsing = {{serializeUsing}}{{/if}})
{{#eq javaType "Long"}}
@JsonSerialize(using = ToStringSerializer.class)
{{/eq}}
......@@ -57,5 +57,10 @@ public class {{pascalCase ctrl.codeName}}UpdateDto extends {{pascalCase ctrl.cod
{{/if}}
{{/each}}
@Override
public String getSrfuf() {
return srfuf==null?"1":srfuf;
}
}
{{/eq}}
\ No newline at end of file
{{#eq apps "link"}}
package {{packageName}}.api.{{apps}}.dict;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import cn.ibizlab.edge.api.link.annotation.G1;
import java.util.*;
@Slf4j
@Api(tags = {"数据字典" })
@RestController("link-DictAllJsonResource")
@RequestMapping("/link/dict")
@G1
@ApiSupport(order = 98)
public class DictAllJsonResource {
@ApiOperationSupport(order = 1)
@ApiOperation(value = "全部字典", tags = {"数据字典" }, notes = "<a href=\"/xftong/link/dict/all.html\" target=\"_blank\">查看展示清单</a>&nbsp;&nbsp;<a href=\"/xftong/link/dict/all\" target=\"_blank\">查看json</a>")
@RequestMapping(method = RequestMethod.GET, value = "/all")
public ResponseEntity<Map<String,Object>> getDict() {
Map<String,Object> all=new LinkedHashMap<>();
{{#each app.dicts}}
{
Map<String,Object> dict=new LinkedHashMap<>();
dict.put("code","{{pascalCase codeName}}Dict");
dict.put("name","字典:{{name}}[{{pascalCase codeName}}Dict]");
dict.put("allItems",new {{pascalCase codeName}}Dict().getAllItems());
all.put("{{pascalCase codeName}}Dict",dict);
}
{{/each}}
return ResponseEntity.ok(all);
}
}
{{/eq}}
\ No newline at end of file
......@@ -18,7 +18,6 @@ import java.util.List;
@Api(tags = {"数据字典" })
@RestController("link-DictAllResource")
@RequestMapping("/link/dict")
@G1
@ApiSupport(order = 98)
public class DictAllResource {
......@@ -30,7 +29,7 @@ public class DictAllResource {
private String templateItem="<tr><td>%s</td><td>%s</td><td>%s</td></tr>";
@ApiOperationSupport(order = 1)
@ApiOperation(value = "全部字典", tags = {"数据字典" }, notes = "<a href=\"/xftong/link/dict/all.html\" target=\"_blank\">view</a>")
@ApiOperation(value = "全部字典", tags = {"数据字典" }, notes = "<a href=\"/xftong/link/dict/all.html\" target=\"_blank\">查看展示清单</a>&nbsp;&nbsp;<a href=\"/xftong/link/dict/all\" target=\"_blank\">查看json</a>")
@RequestMapping(method = RequestMethod.GET, value = "/all.html")
public ResponseEntity<String> getDict() {
List<String> all=new ArrayList<>();
......
......@@ -44,7 +44,7 @@ public class DictResource {
{{#each app.dicts}}
@ApiOperation(value = "字典:{{name}}[{{pascalCase codeName}}Dict]", tags = {"数据字典" }, notes = "字典:{{name}}[{{pascalCase codeName}}Dict]")
@ApiOperation(value = "字典:{{name}}[{{pascalCase codeName}}Dict]", tags = {"数据字典" }, notes = "字典:{{name}}[{{pascalCase codeName}}Dict]&nbsp;&nbsp;<a href=\"/xftong/link/dict/{{pascalCase codeName}}Dict.html\" target=\"_blank\">查看展示清单</a>&nbsp;&nbsp;<a href=\"/xftong/link/dict/{{pascalCase codeName}}Dict\" target=\"_blank\">查看json</a>")
@RequestMapping(method = RequestMethod.GET, value = "/{{pascalCase codeName}}Dict")
public ResponseEntity<{{pascalCase codeName}}Dict> get{{pascalCase codeName}}Dict() {
return ResponseEntity.ok(new {{pascalCase codeName}}Dict());
......
{{#each system.apps as |app|}}
{{#eq app.codeName "link"}}
{
{{#each app.appEntities as |appEntity|}}
"{{appEntity.entity.codeName}}":
{
"codeName": "{{appEntity.entity.codeName}}",
"tableName": "{{appEntity.entity.tableName}}",
"keyField": "{{appEntity.entity.keyField.jsonName}}",
"references": [
{{#each appEntity.entity.references}}
{{#eq entityCodeName "TYYW_KG_XFJSDJ"}}
{
"refTopic": "{{entityCodeName}}",
"keyField": "{{fkField.jsonName}}"
}
{{/eq}}
{{/each}}
]
}{{#unless @last}},{{/unless}}
{{/each}}
}
{{/eq}}
{{/each}}
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册