提交 996d6fc9 编写于 作者: zhouweidong's avatar zhouweidong

补充属性值规则

上级 800d59c3
......@@ -24,6 +24,9 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.alibaba.fastjson.annotation.JSONField;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import ${pub.getPKGCodeName()}.util.domain.DTOBase;
import ${pub.getPKGCodeName()}.util.domain.DTOClient;
import lombok.Data;
......@@ -44,6 +47,7 @@ public class ${item.getCodeName()}DTO extends ${dtoBase} implements Serializable
<#assign prvateCodeName = srfcaseformat(apifield.getCodeName(),'l_u2lC') >
<#assign publicCodeName = prvateCodeName?cap_first >
<#assign jsonfield = apifield.getCodeName()?lower_case >
<#assign defield=(apifield.getPSDEField())!"">
<#if defDataType!='ONE2MANYDATA'>
/**
* 属性 [${apifield.getName()}]
......@@ -62,6 +66,7 @@ public class ${item.getCodeName()}DTO extends ${dtoBase} implements Serializable
@JSONField(name = "${jsonfield}")
</#if>
@JsonProperty("${jsonfield}")
<@valueRule defield />
private ${srfr7javatype(apifield.getStdDataType())} ${prvateCodeName};
</#if>
......@@ -113,3 +118,38 @@ public class ${item.getCodeName()}DTO extends ${dtoBase} implements Serializable
}
</#if>
<#comment>属性值规则</#comment>
<#macro valueRule defield>
<#if defield !=''>
<#if defield.getAllPSDEFValueRules()??>
<#list defield.getAllPSDEFValueRules() as defieldVR>
<#if defieldVR.getPSDEFVRGroupCondition()??>
<#list defieldVR.getPSDEFVRGroupCondition() as defieldVRCond>
<#if defieldVRCond.getCondType()=='SIMPLE'>
<#comment>属性默认值规则</#comment>
<#elseif defieldVRCond.getCondType()=='GROUP' && defieldVR.getCodeName()=='Default'>
<#if defieldVRCond.getPSDEFVRConditions()??>
<#list defieldVRCond.getPSDEFVRConditions() as subVRCond>
<#if subVRCond.getCondType()=='STRINGLENGTH'>
<#if subVRCond.getMaxValue()?c!='-1'>
@Size(min = 0, max = ${subVRCond.getMaxValue()?c}, message = "${subVRCond.getRuleInfo()}")
</#if>
<#elseif subVRCond.getCondType()=='ISNOTNULL'>
<#assign notNullMsg="["+defield.getLogicName()+"]不允许为空!">
<#if srfr7javatype(defield.stdDataType)=='String'>
@NotBlank(message = "${notNullMsg}")
<#else>
@NotNull(message = "${notNullMsg}")
</#if>
</#if>
</#list>
</#if>
<#else>
</#if>
</#list>
</#if>
</#list>
</#if>
</#if>
</#macro>
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册