提交 53acf7a5 编写于 作者: sq3536's avatar sq3536

update

上级 24e16db1
package cn.ibizlab.codegen.model;
import cn.ibizlab.codegen.utils.DataObject;
import cn.ibizlab.codegen.utils.Inflector;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Getter;
......@@ -228,7 +229,9 @@ public class EntityModel extends BaseModel {
return unionKeyFields;
}
public boolean isUnionKeyMode(){
return !ObjectUtils.isEmpty(getUnionKeyFields());
}
public List<FieldModel> getKeyFields() {
if(this.getKeyField()!=null&&this.getKeyField().isPhisicalDEField()) {
......@@ -437,6 +440,12 @@ public class EntityModel extends BaseModel {
if(der.getMinorPSDataEntity().getPSSystemModule()!=null)
rel.setModule(der.getMinorPSDataEntity().getPSSystemModule().getCodeName().toLowerCase());
if(der1n.getPSOne2ManyDataDEField()!=null&&der1n.getPSOne2ManyDataDEField().isPhisicalDEField()&&der1n.getMinorPSDataEntity().getStorageMode()==0)
{
rel.setColumnName(der1n.getPSOne2ManyDataDEField().getName().toLowerCase());
}
String relfieldname=der1n.getPSPickupDEField().getObjectNode().get("getRelatedPSDEField").get("name").asText();
LookupModel lookupModel=new LookupModel().setRelationid(der.getId())
......
......@@ -77,6 +77,11 @@ public class FieldModel extends BaseModel {
return format;
}
public boolean isDeepStructure()
{
return "ONE2MANYDATA".equalsIgnoreCase(getDataEntityField().getDataType());
}
public boolean isEnableAudit()
{
return getDataEntityField().isEnableAudit()&&this.getEntity().getDataEntity()!=null&&this.getEntity().getDataEntity().getAuditMode()!=0;
......
......@@ -45,7 +45,7 @@ public class LabelExt implements java.io.Serializable, Comparable<String>, CharS
}
public String toPluralize() {
return Inflector.getInstance().pluralize(label);
return Inflector.getInstance().pluralize(toCamelCase());
}
public String getLowerCase()
......
......@@ -50,7 +50,14 @@ public class RelationshipModel extends BaseModel{
private boolean nested;
private String listCode;
public String getListCode()
{
if(this.getDer().getMinorPSDataEntity().getStorageMode()==0)
return getCodeName().toPluralize().toLowerCase();
return null;
}
private String columnName;
public IPSDERBase getDer()
......
......@@ -40,7 +40,9 @@ import com.baomidou.mybatisplus.core.toolkit.IdWorker;
@ApiModel("{{entity.logicName}}")
public class {{entity.codeName}} extends EntityMP implements Serializable
{
{{#entity.fields}}
{{^deepStructure}}
/**
* {{logicName}}
*/
......@@ -67,11 +69,12 @@ public class {{entity.codeName}} extends EntityMP implements Serializable
@ApiModelProperty("{{logicName}}")
private {{type.java}} {{codeName.camelCase}};
{{/deepStructure}}
{{/entity.fields}}
{{#entity.references}}
/**
* {{logicName}}
* {{entityLogicName}}
*/
@JsonIgnore
@JSONField(serialize = false)
......@@ -79,9 +82,34 @@ public class {{entity.codeName}} extends EntityMP implements Serializable
private {{packageName}}.core.{{module}}.domain.{{entityCodeName}} {{codeName.camelCase}};
{{/entity.references}}
{{#entity.nesteds}}
/**
* {{entityLogicName}}
*/
{{#listCode}}
@JSONField(name = "{{listCode}}")
@JsonProperty("{{listCode}}")
{{/listCode}}
{{^listCode}}
@JsonIgnore
@JSONField(serialize = false)
{{/listCode}}
{{#columnName}}
@TableField(value = "{{columnName}}" , typeHandler = {{packageName}}.core.{{module}}.domain.handlers.{{entityCodeName}}TypeHandler.class)
{{/columnName}}
{{^columnName}}
@TableField(exist = false)
{{/columnName}}
private List<{{packageName}}.core.{{module}}.domain.{{entityCodeName}}> {{codeName.camelCase}};
{{/entity.nesteds}}
{{#entity.fields}}
{{^deepStructure}}
{{^keyDEField}}
{{^predefinedType}}
/**
* 设置 [{{logicName}}]
*/
public {{entity.codeName}} set{{codeName.pascalCase}}({{type.java}} {{codeName.camelCase}}) {
this.{{codeName.camelCase}} = {{codeName.camelCase}};
this.modify("{{name.lowerCase}}", {{codeName.camelCase}});
......@@ -89,8 +117,37 @@ public class {{entity.codeName}} extends EntityMP implements Serializable
}
{{/predefinedType}}
{{/keyDEField}}
{{#timeType}}
/**
* 格式化日期 [{{logicName}}]
*/
public String format{{codeName.pascalCase}}() {
if (this.{{codeName.camelCase}} == null) {
return null;
}
SimpleDateFormat sdf = new SimpleDateFormat("{{format}}");
return sdf.format({{codeName.camelCase}});
}
{{/timeType}}
{{/deepStructure}}
{{/entity.fields}}
{{#entity.nesteds}}
{{#columnName}}
/**
* 设置 [{{entityLogicName}}]
*/
public {{entity.codeName}} set{{codeName.pascalCase}}(List<{{packageName}}.core.{{module}}.domain.{{entityCodeName}}> {{codeName.camelCase}}) {
this.{{codeName.camelCase}} = {{codeName.camelCase}};
this.modify("{{columnName}}", ({{codeName.camelCase}}!=null)?{{codeName.camelCase}}:(new ArrayList()));
return this;
}
{{/columnName}}
{{/entity.nesteds}}
{{#unionKeyMode}}
{{/unionKeyMode}}
}
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册