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

补充值规则异常信息

上级 34d6d766
......@@ -10,6 +10,19 @@ TARGET=PSDESERVICEAPI
<#if ((de.getPSSubSysServiceAPI().getServiceType())!'')=='MIDDLEPLATFORM'>
<#assign dtoBase="DTOClient">
</#if>
<#assign hasValueRuleGroup=false>
<#if sys.codeName == 'Sample'>
<#if de.getAllPSDEFValueRules()??>
<#list de.getAllPSDEFValueRules() as deRule>
<#if deRule.codeName!='Default'>
<#if deRule.getPSDEFVRGroupCondition()??>
<#assign hasValueRuleGroup=true>
<#break>
</#if>
</#if>
</#list>
</#if>
</#if>
package ${pubPkgCodeName}.${itemSysApiCodeNameLC}.dto;
import java.sql.Timestamp;
......@@ -32,11 +45,15 @@ import javax.validation.constraints.Size;
import ${pub.getPKGCodeName()}.util.domain.DTOBase;
import ${pub.getPKGCodeName()}.util.domain.DTOClient;
import lombok.Data;
<#if hasValueRuleGroup>
import ${pub.getPKGCodeName()}.util.annotation.ValueRuleCheck;
</#if>
/**
* 服务DTO对象[${item.getCodeName()}DTO]
*/
@Data
<@valueRuleGroup/>
public class ${item.getCodeName()}DTO extends ${dtoBase} implements Serializable {
private static final long serialVersionUID = 1L;
......@@ -159,3 +176,54 @@ public class ${item.getCodeName()}DTO extends ${dtoBase} implements Serializable
</#if>
</#if>
</#macro>
<#comment>属性值规则(规则组)</#comment>
<#macro valueRuleGroup>
<#if hasValueRuleGroup>
<#assign ruleMsg="">
@ValueRuleCheck.List({
<#list de.getAllPSDEFValueRules() as deRule>
<#if deRule.codeName!='Default'>
<#if deRule.getPSDEFVRGroupCondition()??>
<#assign ruleName=de.codeName+"_"+deRule.getPSDEField().codeName+"_"+deRule.codeName>
<#assign ruleField=deRule.getPSDEField().codeName>
<#assign group=deRule.getPSDEFVRGroupCondition()>
<#assign ruleMsg=getGroupCond(group)>
@ValueRuleCheck(field = "${ruleField}", rule = "${ruleName}", message = "${ruleMsg}"),
</#if>
</#if>
</#list>
})
</#if>
</#macro>
<#comment>获取group规则信息</#comment>
<#function getGroupCond group>
<#assign strRuleCond="(">
<#if group.getPSDEFVRConditions()??>
<#assign condOp=group.getCondOp()?replace("AND","并且")?replace("OR","或者")>
<#list group.getPSDEFVRConditions() as childRule>
<#assign childRuleType=childRule.getCondType()>
<#if childRuleType=='GROUP'>
<#assign strRuleCond=strRuleCond+getGroupCond(childRule)>
<#else>
<#assign strRuleCond=strRuleCond+getFieldCond(childRule)>
</#if>
<#if childRule_has_next>
<#assign strRuleCond=strRuleCond+condOp>
</#if>
</#list>
</#if>
<#assign strRuleCond=strRuleCond+")">
<#return strRuleCond/>
</#function>
<#comment>获取field规则信息</#comment>
<#function getFieldCond fieldRule>
<#assign childRuleType=fieldRule.getCondType()>
<#assign fieldCond="" >
<#if fieldRule.getRuleInfo?? && fieldRule.getRuleInfo()??>
<#assign fieldCond="("+fieldRule.getRuleInfo+")">
</#if>
<#return fieldCond/>
</#function>
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册