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

修改模板自定义方法适配customCall参数

上级 8cf03901
......@@ -40,6 +40,56 @@ public class ActionModel extends BaseModel{
return codeName.toLowerCase().startsWith("get");
}
public String getInParam()
{
String param=this.getEntity().getCodeName();
if(getDEAction().getPSDEActionInput()==null)
return param;
if("KEYFIELD".equalsIgnoreCase(getDEAction().getPSDEActionInput().getType()))
param=this.getEntity().getKeyField().getType().java;
else if("KEYFIELDS".equalsIgnoreCase(getDEAction().getPSDEActionInput().getType()))
param="List<"+this.getEntity().getKeyField().getType().java+">";
return param;
}
public String getInParamName()
{
String param="dto";
if(getDEAction().getPSDEActionInput()==null)
return param;
if("KEYFIELD".equalsIgnoreCase(getDEAction().getPSDEActionInput().getType()))
param="key";
else if("KEYFIELDS".equalsIgnoreCase(getDEAction().getPSDEActionInput().getType()))
param="keys";
return param;
}
public boolean isVoidReturn()
{
if(getDEAction().getPSDEActionReturn()==null)
return true;
if (!"VOID".equalsIgnoreCase(getDEAction().getPSDEActionReturn().getType()))
return false;
return true;
}
public String getOutParam()
{
String param=this.getEntity().getCodeName();
if(getDEAction().getPSDEActionReturn()==null)
return param;
if ("VOID".equalsIgnoreCase(getDEAction().getPSDEActionReturn().getType()))
return getInParam();
if ("SIMPLE".equalsIgnoreCase(getDEAction().getPSDEActionReturn().getType()))
param=PropType.findType(this.getDEAction().getPSDEActionReturn().getStdDataType()).java;
else if ("SIMPLES".equalsIgnoreCase(getDEAction().getPSDEActionReturn().getType()))
param="List<"+PropType.findType(this.getDEAction().getPSDEActionReturn().getStdDataType()).java+">";
else if ("DTOS".equalsIgnoreCase(getDEAction().getPSDEActionReturn().getType())
||"OBJECTS".equalsIgnoreCase(getDEAction().getPSDEActionReturn().getType()))
param="List<"+param+">";
return param;
}
public Set<String> getLogics()
{
Set<String> validLogic=new HashSet<>();
......
......@@ -56,7 +56,7 @@ public class {{entity.codeName}} extends BaseData implements Serializable
{{else}}
@TableField(value = "{{columnName}}"{{#insertOnly}} , fill = FieldFill.INSERT{{/insertOnly}}{{^phisicalDEField}} , exist = false{{/phisicalDEField}})
{{#logicValidField}}
@TableLogic{{#validLogicValue}}(value = "{{validLogicValue}}"{{#invalidLogicValue}} , delval = "{{invalidLogicValue}}"{{/invalidLogicValue}}){{/validLogicValue}}
@TableLogic{{#entity.validLogicValue}}(value = "{{entity.validLogicValue}}"{{#entity.invalidLogicValue}} , delval = "{{entity.invalidLogicValue}}"{{/entity.invalidLogicValue}}){{/entity.validLogicValue}}
{{/logicValidField}}
{{/if}}
@JsonProperty("{{jsonName}}")
......
......@@ -8,6 +8,7 @@ import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.math.BigInteger;
import java.math.BigDecimal;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.scheduling.annotation.Async;
......@@ -135,29 +136,26 @@ public interface {{entity.codeName}}Service extends IBaseService<{{entity.codeNa
}
{{#each entity.extActions}}
{{#if action}}
default {{entity.codeName}} {{camelCase codeName}}({{entity.keyField.type.java}} key) {
{{entity.codeName}} dto = this.getRuntimeService().getDataEntityRuntime().executeAction("{{name}}", null, new Object[]{key}, true);
if(dto!=null)
afterAction("{{codeName}}",dto);
return dto;
}
default {{entity.codeName}} on{{pascalCase codeName}}({{entity.keyField.type.java}} key) {
return this.getDataEntityRuntimeContext().executeActionReal("{{name}}", null, new Object[]{key}, null);;
}
{{else}}
default boolean {{camelCase codeName}}({{entity.codeName}} dto) throws Throwable {
IBaseService.super.beforeAction("{{codeName}}",dto);
this.getRuntimeService().getDataEntityRuntime().executeAction("{{name}}", null, new Object[]{dto}, true);
IBaseService.super.afterAction("{{codeName}}",dto);
return true;
}
default boolean on{{pascalCase codeName}}({{entity.codeName}} dto) throws Throwable {
this.getDataEntityRuntimeContext().executeActionReal("{{name}}", null, new Object[]{dto}, null);
return true;
default {{outParam}} {{camelCase codeName}}({{inParam}} {{inParamName}}) throws Throwable {
{{#if voidReturn}}
IBaseService.super.callAction("{{codeName}}",{{inParamName}});
return {{inParamName}};
{{else}}
IBaseService.super.beforeAction("{{codeName}}",{{inParamName}});
{{outParam}} rt = ({{outParam}})IBaseService.super.forwardAction("{{name}}",{{inParamName}});
if(rt!=null)
IBaseService.super.afterAction("{{codeName}}",rt);
return rt;
{{/if}}
}
default {{outParam}} on{{pascalCase codeName}}({{inParam}} {{inParamName}}) throws Throwable {
{{#if voidReturn}}
IBaseService.super.onRealAction("{{codeName}}",{{inParamName}});
return {{inParamName}};
{{else}}
return ({{outParam}})IBaseService.super.onRealAction("{{codeName}}",{{inParamName}});
{{/if}}
}
{{/if}}
......@@ -167,15 +165,11 @@ public interface {{entity.codeName}}Service extends IBaseService<{{entity.codeNa
{{#entity.dataSets}}
default Page<{{entity.codeName}}> fetch{{pascalCase codeName}}({{entity.codeName}}SearchContext dto) throws Throwable {
IBaseService.super.beforeFetch("{{codeName}}",dto);
return (Page) this.getRuntimeService().getDataEntityRuntime().fetchDataSet("{{name}}", dto.getDataSet(), new Object[]{dto}, true);
return (Page) IBaseService.super.forwardFetch("{{name}}",dto);
}
default Page<{{entity.codeName}}> onFetch{{pascalCase codeName}}({{entity.codeName}}SearchContext dto) throws Throwable {
return (Page) this.getDataEntityRuntimeContext().fetchDataSetReal("{{name}}", dto.getDataSet(), new Object[]{dto}, null);
}
default List<{{entity.codeName}}> select{{pascalCase codeName}}({{entity.codeName}}SearchContext dto) throws Throwable {
return (List)this.getRuntimeService().getDataEntityRuntime().selectDataQuery("{{name}}", dto);
return (Page) IBaseService.super.onRealFetch("{{name}}",dto);
}
{{/entity.dataSets}}
......
......@@ -8,6 +8,7 @@ import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.math.BigInteger;
import java.math.BigDecimal;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.scheduling.annotation.Async;
......@@ -136,47 +137,38 @@ public interface {{entity.codeName}}Service extends IMPService<{{entity.codeName
}
{{#each entity.extActions}}
{{#if action}}
default {{entity.codeName}} {{camelCase codeName}}({{entity.keyField.type.java}} key) {
{{entity.codeName}} dto = this.getRuntimeService().getDataEntityRuntime().executeAction("{{name}}", null, new Object[]{key}, true);
if(dto!=null)
afterAction("{{codeName}}",dto);
return dto;
default {{outParam}} {{camelCase codeName}}({{inParam}} {{inParamName}}) throws Throwable {
{{#if voidReturn}}
IMPService.super.callAction("{{codeName}}",{{inParamName}});
return {{inParamName}};
{{else}}
IMPService.super.beforeAction("{{codeName}}",{{inParamName}});
{{outParam}} rt = ({{outParam}})IMPService.super.forwardAction("{{name}}",{{inParamName}});
if(rt!=null)
IMPService.super.afterAction("{{codeName}}",rt);
return rt;
{{/if}}
}
default {{outParam}} on{{pascalCase codeName}}({{inParam}} {{inParamName}}) throws Throwable {
{{#if voidReturn}}
IMPService.super.onRealAction("{{codeName}}",{{inParamName}});
return {{inParamName}};
{{else}}
return ({{outParam}})IMPService.super.onRealAction("{{codeName}}",{{inParamName}});
{{/if}}
}
default {{entity.codeName}} on{{pascalCase codeName}}({{entity.keyField.type.java}} key) {
return this.getDataEntityRuntimeContext().executeActionReal("{{name}}", null, new Object[]{key}, null);;
}
{{else}}
default boolean {{camelCase codeName}}({{entity.codeName}} dto) throws Throwable {
IMPService.super.beforeAction("{{codeName}}",dto);
this.getRuntimeService().getDataEntityRuntime().executeAction("{{name}}", null, new Object[]{dto}, true);
IMPService.super.afterAction("{{codeName}}",dto);
return true;
}
default boolean on{{pascalCase codeName}}({{entity.codeName}} dto) throws Throwable {
this.getDataEntityRuntimeContext().executeActionReal("{{name}}", null, new Object[]{dto}, null);
return true;
}
{{/if}}
{{/each}}
{{#entity.dataSets}}
default Page<{{entity.codeName}}> fetch{{pascalCase codeName}}({{entity.codeName}}SearchContext dto) throws Throwable {
IMPService.super.beforeFetch("{{codeName}}",dto);
return (Page) this.getRuntimeService().getDataEntityRuntime().fetchDataSet("{{name}}", dto.getDataSet(), new Object[]{dto}, true);
return (Page) IMPService.super.forwardFetch("{{name}}",dto);
}
default Page<{{entity.codeName}}> onFetch{{pascalCase codeName}}({{entity.codeName}}SearchContext dto) throws Throwable {
return (Page) this.getDataEntityRuntimeContext().fetchDataSetReal("{{name}}", dto.getDataSet(), new Object[]{dto}, null);
}
default List<{{entity.codeName}}> select{{pascalCase codeName}}({{entity.codeName}}SearchContext dto) throws Throwable {
return (List)this.getRuntimeService().getDataEntityRuntime().selectDataQuery("{{name}}", dto);
return (Page) IMPService.super.onRealFetch("{{name}}",dto);
}
{{/entity.dataSets}}
......
......@@ -8,6 +8,7 @@ import java.util.Map;
import java.util.HashMap;
import java.util.Collection;
import java.math.BigInteger;
import java.math.BigDecimal;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.scheduling.annotation.Async;
......@@ -135,47 +136,38 @@ public interface {{entity.codeName}}Service extends IBaseService<{{entity.codeNa
}
{{#each entity.extActions}}
{{#if action}}
default {{entity.codeName}} {{camelCase codeName}}({{entity.keyField.type.java}} key) {
{{entity.codeName}} dto = this.getRuntimeService().getDataEntityRuntime().executeAction("{{name}}", null, new Object[]{key}, true);
if(dto!=null)
afterAction("{{codeName}}",dto);
return dto;
default {{outParam}} {{camelCase codeName}}({{inParam}} {{inParamName}}) throws Throwable {
{{#if voidReturn}}
IBaseService.super.callAction("{{codeName}}",{{inParamName}});
return {{inParamName}};
{{else}}
IBaseService.super.beforeAction("{{codeName}}",{{inParamName}});
{{outParam}} rt = ({{outParam}})IBaseService.super.forwardAction("{{name}}",{{inParamName}});
if(rt!=null)
IBaseService.super.afterAction("{{codeName}}",rt);
return rt;
{{/if}}
}
default {{outParam}} on{{pascalCase codeName}}({{inParam}} {{inParamName}}) throws Throwable {
{{#if voidReturn}}
IBaseService.super.onRealAction("{{codeName}}",{{inParamName}});
return {{inParamName}};
{{else}}
return ({{outParam}})IBaseService.super.onRealAction("{{codeName}}",{{inParamName}});
{{/if}}
}
default {{entity.codeName}} on{{pascalCase codeName}}({{entity.keyField.type.java}} key) {
return this.getDataEntityRuntimeContext().executeActionReal("{{name}}", null, new Object[]{key}, null);;
}
{{else}}
default boolean {{camelCase codeName}}({{entity.codeName}} dto) throws Throwable {
IBaseService.super.beforeAction("{{codeName}}",dto);
this.getRuntimeService().getDataEntityRuntime().executeAction("{{name}}", null, new Object[]{dto}, true);
IBaseService.super.afterAction("{{codeName}}",dto);
return true;
}
default boolean on{{pascalCase codeName}}({{entity.codeName}} dto) throws Throwable {
this.getDataEntityRuntimeContext().executeActionReal("{{name}}", null, new Object[]{dto}, null);
return true;
}
{{/if}}
{{/each}}
{{#entity.dataSets}}
default Page<{{entity.codeName}}> fetch{{pascalCase codeName}}({{entity.codeName}}SearchContext dto) throws Throwable {
IBaseService.super.beforeFetch("{{codeName}}",dto);
return (Page) this.getRuntimeService().getDataEntityRuntime().fetchDataSet("{{name}}", dto.getDataSet(), new Object[]{dto}, true);
return (Page) IBaseService.super.forwardFetch("{{name}}",dto);
}
default Page<{{entity.codeName}}> onFetch{{pascalCase codeName}}({{entity.codeName}}SearchContext dto) throws Throwable {
return (Page) this.getDataEntityRuntimeContext().fetchDataSetReal("{{name}}", dto.getDataSet(), new Object[]{dto}, null);
}
default List<{{entity.codeName}}> select{{pascalCase codeName}}({{entity.codeName}}SearchContext dto) throws Throwable {
return (List)this.getRuntimeService().getDataEntityRuntime().selectDataQuery("{{name}}", dto);
return (Page) IBaseService.super.onRealFetch("{{name}}",dto);
}
{{/entity.dataSets}}
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册