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

行为附加逻辑优化

上级 f8936abf
......@@ -36,13 +36,64 @@ global org.slf4j.Logger logger;
when
then
System.out.println("开始执行[${dataentity.codeName}:${deactionCodeName}]实体[${afterlogic.getName()}]附加逻辑");
${pub.getPKGCodeName()}.core.${dataentity.getPSSystemModule().getCodeName()?lower_case}.domain.${dataentity.getCodeName()} entity =new ${pub.getPKGCodeName()}.core.${dataentity.getPSSystemModule().getCodeName()?lower_case}.domain.${dataentity.getCodeName()}();
et.copyTo(entity,true);
${dataentityCodeName}service.${deactionCodeName}(entity);
<@addActionLogic deaction afterlogic/>
System.out.println("[${dataentity.codeName}:${deactionCodeName}]实体[${afterlogic.getName()}]附加逻辑执行结束");
end
</#if>
</#list>
</#if>
</#if>
</#if>
\ No newline at end of file
</#if>
<#comment>附加实体行为</#comment>
<#macro addActionLogic deaction actionlogic>
<#assign actionLogicDE=actionlogic.getDstPSDE()>
<#assign actionLogicDEAction=actionlogic.getDstPSDEAction()>
<#assign sourceActionType=deaction.getActionType()>
<#assign sourceCodeName=deaction.getCodeName()?lower_case>
<#assign targetActionType=actionLogicDEAction.getActionType()>
<#assign targetCodeName=actionLogicDEAction.getCodeName()?lower_case>
<#if ((sourceActionType=='USERCUSTOM')|| sourceActionType=='DELOGIC'|| sourceCodeName == "create" || sourceCodeName == "update" ||
sourceCodeName == "save" || sourceCodeName == "getdraft" || sourceCodeName == "checkkey") &&
((targetActionType=='USERCUSTOM')|| targetActionType=='DELOGIC'|| targetCodeName == "create" || targetCodeName == "update" ||
targetCodeName == "save" || targetCodeName == "getdraft" || targetCodeName == "checkkey")>
<#if actionlogic.isIgnoreException()?? && actionlogic.isIgnoreException()==true>
try {
<@actionLogic_entity actionlogic/>
}
catch(Exception e) {
log.error("执行[${srfmethodname(actionLogicDEAction.getCodeName())}]行为附加逻辑发生异常");
}
<#else>
<@actionLogic_entity actionlogic/>
</#if>
<#elseif sourceCodeName=='remove' && targetCodeName == "remove">
<#if actionlogic.isIgnoreException()?? && actionlogic.isIgnoreException()==true>
try {
<@actionLogic_remove actionlogic/>
}
catch(Exception e) {
log.error("执行[${srfmethodname(actionLogicDEAction.getCodeName())}]行为附加逻辑发生异常");
}
<#else>
<@actionLogic_remove actionlogic/>
</#if>
</#if>
</#macro>
<#comment>实体行为附加逻辑-参数:实体</#comment>
<#macro actionLogic_entity actionlogic>
<#assign actionLogicDE=actionlogic.getDstPSDE()>
<#assign actionLogicDEAction=actionlogic.getDstPSDEAction()>
${pub.getPKGCodeName()}.core.${actionLogicDE.getPSSystemModule().getCodeName()?lower_case}.domain.${actionLogicDE.getCodeName()} actionLogicDE =new ${pub.getPKGCodeName()}.core.${actionLogicDE.getPSSystemModule().getCodeName()?lower_case}.domain.${actionLogicDE.getCodeName()}();
et.copyTo(actionLogicDE,true);
${srfcaseformat(actionLogicDE.getCodeName(),'l_u2lC')}Service.${srfmethodname(actionLogicDEAction.getCodeName())}(actionLogicDE);
</#macro>
<#comment>实体行为附加逻辑-remove</#comment>
<#macro actionLogic_remove actionlogic>
<#if de.getKeyPSDEField().getStdDataType()==actionLogicDE.getKeyPSDEField().getStdDataType()>
${srfcaseformat(actionLogicDE.getCodeName(),'l_u2lC')}Service.remove(key);
</#if>
</#macro>
\ No newline at end of file
......@@ -36,13 +36,63 @@ global org.slf4j.Logger logger;
when
then
System.out.println("开始执行[${dataentity.codeName}:${deactionCodeName}]实体[${beforelogic.getName()}]附加逻辑");
${pub.getPKGCodeName()}.core.${dataentity.getPSSystemModule().getCodeName()?lower_case}.domain.${dataentity.getCodeName()} entity =new ${pub.getPKGCodeName()}.core.${dataentity.getPSSystemModule().getCodeName()?lower_case}.domain.${dataentity.getCodeName()}();
et.copyTo(entity,true);
${dataentityCodeName}service.${deactionCodeName}(entity);
<@addActionLogic deaction beforelogic/>
System.out.println("[${dataentity.codeName}:${deactionCodeName}]实体[${beforelogic.getName()}]附加逻辑执行结束");
end
</#if>
</#list>
</#if>
</#if>
</#if>
\ No newline at end of file
</#if>
<#comment>附加实体行为</#comment>
<#macro addActionLogic deaction actionlogic>
<#assign actionLogicDE=actionlogic.getDstPSDE()>
<#assign actionLogicDEAction=actionlogic.getDstPSDEAction()>
<#assign sourceActionType=deaction.getActionType()>
<#assign sourceCodeName=deaction.getCodeName()?lower_case>
<#assign targetActionType=actionLogicDEAction.getActionType()>
<#assign targetCodeName=actionLogicDEAction.getCodeName()?lower_case>
<#if ((sourceActionType=='USERCUSTOM')|| sourceActionType=='DELOGIC'|| sourceCodeName == "create" || sourceCodeName == "update" ||
sourceCodeName == "save" || sourceCodeName == "getdraft" || sourceCodeName == "checkkey") &&
((targetActionType=='USERCUSTOM')|| targetActionType=='DELOGIC'|| targetCodeName == "create" || targetCodeName == "update" ||
targetCodeName == "save" || targetCodeName == "getdraft" || targetCodeName == "checkkey")>
<#if actionlogic.isIgnoreException()?? && actionlogic.isIgnoreException()==true>
try {
<@actionLogic_entity actionlogic/>
}
catch(Exception e) {
log.error("执行[${srfmethodname(actionLogicDEAction.getCodeName())}]行为附加逻辑发生异常");
}
<#else>
<@actionLogic_entity actionlogic/>
</#if>
<#elseif sourceCodeName=='remove' && targetCodeName == "remove">
<#if actionlogic.isIgnoreException()?? && actionlogic.isIgnoreException()==true>
try {
<@actionLogic_remove actionlogic/>
}
catch(Exception e) {
log.error("执行[${srfmethodname(actionLogicDEAction.getCodeName())}]行为附加逻辑发生异常");
}
<#else>
<@actionLogic_remove actionlogic/>
</#if>
</#if>
</#macro>
<#comment>实体行为附加逻辑-参数:实体</#comment>
<#macro actionLogic_entity actionlogic>
<#assign actionLogicDE=actionlogic.getDstPSDE()>
<#assign actionLogicDEAction=actionlogic.getDstPSDEAction()>
${pub.getPKGCodeName()}.core.${actionLogicDE.getPSSystemModule().getCodeName()?lower_case}.domain.${actionLogicDE.getCodeName()} actionLogicDE =new ${pub.getPKGCodeName()}.core.${actionLogicDE.getPSSystemModule().getCodeName()?lower_case}.domain.${actionLogicDE.getCodeName()}();
et.copyTo(actionLogicDE,true);
${srfcaseformat(actionLogicDE.getCodeName(),'l_u2lC')}Service.${srfmethodname(actionLogicDEAction.getCodeName())}(actionLogicDE);
</#macro>
<#comment>实体行为附加逻辑-remove</#comment>
<#macro actionLogic_remove actionlogic>
<#if de.getKeyPSDEField().getStdDataType()==actionLogicDE.getKeyPSDEField().getStdDataType()>
${srfcaseformat(actionLogicDE.getCodeName(),'l_u2lC')}Service.remove(key);
</#if>
</#macro>
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册