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

调整扩展目录

上级 d944b729
......@@ -17,166 +17,14 @@ TARGET=PSDATAENTITY
<#if hasServiceEx && (de.getStorageMode()==1 || de.getStorageMode()==2 ||de.getStorageMode()==4||de.getStorageMode()==0 ) >
package ${pub.getPKGCodeName()}.core.extensions.service;
import ${pub.getPKGCodeName()}.core.${item.getPSSystemModule().getCodeName()?lower_case}.service.impl.${item.codeName}ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import ${pub.getPKGCodeName()}.core.${item.getPSSystemModule().getCodeName()?lower_case}.domain.${item.codeName};
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.context.annotation.Primary;
import java.util.*;
/**
* 实体[${item.getLogicName()}] 自定义服务对象
* 扩展目录已变更,请到[${pub.getPKGCodeName()}.core.extensions.service.xxServiceExt]中来进行扩展
* 若您之前有在当前目录下扩展过其它的service对象,请将扩展的代码移到新的扩展类中
*/
@Slf4j
@Primary
@Service("${item.codeName}ServiceEx")
public class ${item.codeName}ServiceEx extends ${item.codeName}ServiceImpl {
<#comment>SQL存储:解决mybatis继承service批操作报错</#comment>
<#if de.getStorageMode()==1>
@Override
protected Class currentModelClass() {
return com.baomidou.mybatisplus.core.toolkit.ReflectionKit.getSuperClassGenericType(this.getClass().getSuperclass(), 1);
}
</#if>
@Deprecated
public class ${item.codeName}ServiceEx{
<#comment>输出实体行为</#comment>
<#if item.getAllPSDEActions()??>
<#list item.getAllPSDEActions() as deaction>
<#if deaction.isEnableBackend()>
<#if deaction.getActionType()=='USERCUSTOM'>
/**
* 自定义行为[${deaction.getCodeName()}]用户扩展
* @param et
* @return
*/
@Override
@Transactional
public ${item.getCodeName()} ${srfmethodname(deaction.getCodeName())}(${item.getCodeName()} et) {
return super.${srfmethodname(deaction.getCodeName())}(et);
}
</#if>
<#comment>输出测试行为</#comment>
<@outputTestActionDetail deaction />
</#if>
</#list>
</#if>
}
</#if>
<#comment>输出测试行为</#comment>
<#macro outputTestActionDetail deaction>
<#if deaction.isEnableBackend() && deaction.getTestActionMode?? && deaction.getTestActionMode()??>
<#if deaction.getTestActionMode() ==1 || deaction.getTestActionMode() ==3>
<#if (deaction.getActionType()=='USERCUSTOM')>
@Override
@Transactional
public ${item.getCodeName()} test${srfmethodname(deaction.getCodeName())?cap_first}(${item.getCodeName()} et) {
return super.test${srfmethodname(deaction.getCodeName())?cap_first}(et);
}
<#elseif deaction.getActionType()=='DELOGIC'>
@Override
@Transactional
public ${item.getCodeName()} test${srfmethodname(deaction.getCodeName())?cap_first}(${item.getCodeName()} et) {
return super.test${srfmethodname(deaction.getCodeName())?cap_first}(et);
}
<#elseif deaction.getCodeName()?lower_case == 'get'>
@Override
@Transactional
public ${item.getCodeName()} testGet(${srfjavatype(keyfield.stdDataType)} key) {
return super.testGet(key);
}
<#elseif deaction.getCodeName()?lower_case == "createbatch">
<#elseif deaction.getCodeName()?lower_case == "updatebatch">
<#elseif deaction.getCodeName()?lower_case == "removebatch">
<#elseif deaction.getCodeName()?lower_case == "savebatch">
<#elseif deaction.getCodeName()?lower_case == "create">
@Override
@Transactional
public boolean testCreate(${item.getCodeName()} et) {
return super.testCreate(et);
}
@Override
public void testCreateBatch(List<${item.getCodeName()}> list) {
super.testCreateBatch(list);
}
<#elseif deaction.getCodeName()?lower_case == "update">
@Override
@Transactional
public boolean testUpdate(${item.getCodeName()} et) {
return super.testUpdate(et);
}
@Override
public void testUpdateBatch(List<${item.getCodeName()}> list) {
super.testUpdateBatch(list);
}
<#elseif deaction.getCodeName()?lower_case == "save">
@Override
@Transactional
public boolean testSave(${item.getCodeName()} et) {
return super.testSave(et);
}
@Override
@Transactional(
rollbackFor = {Exception.class}
)
public boolean testSaveOrUpdate(${item.getCodeName()} et) {
return super.testSaveOrUpdate(et);
}
@Override
public boolean testSaveBatch(Collection<${item.getCodeName()}> list) {
return super.testSaveBatch(list);
}
@Override
public void testSaveBatch(List<${item.getCodeName()}> list) {
super.testSaveBatch(list);
}
<#elseif deaction.getCodeName()?lower_case == "remove">
@Override
@Transactional
public boolean testRemove(${srfjavatype(keyfield.stdDataType)} key) {
return super.testRemove(key);
}
@Override
public void testRemoveBatch(Collection<${srfjavatype(keyfield.stdDataType)}> idList) {
super.testRemoveBatch(idList);
}
<#elseif deaction.getCodeName()?lower_case == "getdraft">
@Override
public ${item.getCodeName()} testGetDraft(${item.getCodeName()} et) {
return super.testGetDraft(et);
}
<#elseif deaction.getCodeName()?lower_case == "checkkey">
@Override
public boolean testCheckKey(${item.getCodeName()} et) {
return super.testCheckKey(et);
}
<#else>
@Override
@Transactional
public ${item.getCodeName()} test${srfmethodname(deaction.getCodeName())?cap_first}(${item.getCodeName()} et) {
return super.test${srfmethodname(deaction.getCodeName())?cap_first}(et);
}
</#if>
</#if>
</#if>
</#macro>
<#ibiztemplate>
TARGET=PSDATAENTITY
</#ibiztemplate>
<#comment>判断当前实体是否包含自定义行为</#comment>
<#assign hasServiceEx=false>
<#if item.getAllPSDEActions()??>
<#list item.getAllPSDEActions() as deaction>
<#if deaction.isEnableBackend() && deaction.getActionType()=='USERCUSTOM'>
<#assign hasServiceEx=true>
<#break>
<#elseif deaction.isEnableBackend() && deaction.getTestActionMode?? && deaction.getTestActionMode()?? && (deaction.getTestActionMode() ==1 || deaction.getTestActionMode() ==3)>
<#assign hasServiceEx=true>
<#break>
</#if>
</#list>
</#if>
<#if hasServiceEx && (de.getStorageMode()==1 || de.getStorageMode()==2 ||de.getStorageMode()==4||de.getStorageMode()==0 ) >
package ${pub.getPKGCodeName()}.core.extensions.service;
import ${pub.getPKGCodeName()}.core.${item.getPSSystemModule().getCodeName()?lower_case}.service.impl.${item.codeName}ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import ${pub.getPKGCodeName()}.core.${item.getPSSystemModule().getCodeName()?lower_case}.domain.${item.codeName};
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.context.annotation.Primary;
import java.util.*;
/**
* 实体[${item.getLogicName()}] 自定义服务对象
*/
@Slf4j
@Primary
@Service("${item.codeName}ServiceExt")
public class ${item.codeName}ServiceExt extends ${item.codeName}ServiceImpl {
<#comment>SQL存储:解决mybatis继承service批操作报错</#comment>
<#if de.getStorageMode()==1>
@Override
protected Class currentModelClass() {
return com.baomidou.mybatisplus.core.toolkit.ReflectionKit.getSuperClassGenericType(this.getClass().getSuperclass(), 1);
}
</#if>
<#comment>输出实体行为</#comment>
<#if item.getAllPSDEActions()??>
<#list item.getAllPSDEActions() as deaction>
<#if deaction.isEnableBackend()>
<#if deaction.getActionType()=='USERCUSTOM'>
/**
* 自定义行为[${deaction.getCodeName()}]用户扩展
* @param et
* @return
*/
@Override
@Transactional
public ${item.getCodeName()} ${srfmethodname(deaction.getCodeName())}(${item.getCodeName()} et) {
return super.${srfmethodname(deaction.getCodeName())}(et);
}
</#if>
<#comment>输出测试行为</#comment>
<@outputTestActionDetail deaction />
</#if>
</#list>
</#if>
}
</#if>
<#comment>输出测试行为</#comment>
<#macro outputTestActionDetail deaction>
<#if deaction.isEnableBackend() && deaction.getTestActionMode?? && deaction.getTestActionMode()??>
<#if deaction.getTestActionMode() ==1 || deaction.getTestActionMode() ==3>
<#if (deaction.getActionType()=='USERCUSTOM')>
@Override
@Transactional
public ${item.getCodeName()} test${srfmethodname(deaction.getCodeName())?cap_first}(${item.getCodeName()} et) {
return super.test${srfmethodname(deaction.getCodeName())?cap_first}(et);
}
<#elseif deaction.getActionType()=='DELOGIC'>
@Override
@Transactional
public ${item.getCodeName()} test${srfmethodname(deaction.getCodeName())?cap_first}(${item.getCodeName()} et) {
return super.test${srfmethodname(deaction.getCodeName())?cap_first}(et);
}
<#elseif deaction.getCodeName()?lower_case == 'get'>
@Override
@Transactional
public ${item.getCodeName()} testGet(${srfjavatype(keyfield.stdDataType)} key) {
return super.testGet(key);
}
<#elseif deaction.getCodeName()?lower_case == "createbatch">
<#elseif deaction.getCodeName()?lower_case == "updatebatch">
<#elseif deaction.getCodeName()?lower_case == "removebatch">
<#elseif deaction.getCodeName()?lower_case == "savebatch">
<#elseif deaction.getCodeName()?lower_case == "create">
@Override
@Transactional
public boolean testCreate(${item.getCodeName()} et) {
return super.testCreate(et);
}
@Override
public void testCreateBatch(List<${item.getCodeName()}> list) {
super.testCreateBatch(list);
}
<#elseif deaction.getCodeName()?lower_case == "update">
@Override
@Transactional
public boolean testUpdate(${item.getCodeName()} et) {
return super.testUpdate(et);
}
@Override
public void testUpdateBatch(List<${item.getCodeName()}> list) {
super.testUpdateBatch(list);
}
<#elseif deaction.getCodeName()?lower_case == "save">
@Override
@Transactional
public boolean testSave(${item.getCodeName()} et) {
return super.testSave(et);
}
@Override
@Transactional(
rollbackFor = {Exception.class}
)
public boolean testSaveOrUpdate(${item.getCodeName()} et) {
return super.testSaveOrUpdate(et);
}
@Override
public boolean testSaveBatch(Collection<${item.getCodeName()}> list) {
return super.testSaveBatch(list);
}
@Override
public void testSaveBatch(List<${item.getCodeName()}> list) {
super.testSaveBatch(list);
}
<#elseif deaction.getCodeName()?lower_case == "remove">
@Override
@Transactional
public boolean testRemove(${srfjavatype(keyfield.stdDataType)} key) {
return super.testRemove(key);
}
@Override
public void testRemoveBatch(Collection<${srfjavatype(keyfield.stdDataType)}> idList) {
super.testRemoveBatch(idList);
}
<#elseif deaction.getCodeName()?lower_case == "getdraft">
@Override
public ${item.getCodeName()} testGetDraft(${item.getCodeName()} et) {
return super.testGetDraft(et);
}
<#elseif deaction.getCodeName()?lower_case == "checkkey">
@Override
public boolean testCheckKey(${item.getCodeName()} et) {
return super.testCheckKey(et);
}
<#else>
@Override
@Transactional
public ${item.getCodeName()} test${srfmethodname(deaction.getCodeName())?cap_first}(${item.getCodeName()} et) {
return super.test${srfmethodname(deaction.getCodeName())?cap_first}(et);
}
</#if>
</#if>
</#if>
</#macro>
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册