提交 abb0a44c 编写于 作者: xignzi006's avatar xignzi006

fix:Resource父关系计算bug

上级 cf83eadb
......@@ -70,6 +70,8 @@ public class ApiEntityModel extends BaseModel {
//主接口方法
if (getApiDataEntity().isMajor() && getApiDataEntity().getPSDEServiceAPIMethods() != null) {
for (IPSDEServiceAPIMethod iPSDEServiceAPIMethod : getApiDataEntity().getPSDEServiceAPIMethods()) {
if(iPSDEServiceAPIMethod.getPSDEDataSet()!=null && iPSDEServiceAPIMethod.getPSDEDataSet().getPSDEDataQueries()==null)
continue ;
methods.add(new ApiMethodModel(this, null, iPSDEServiceAPIMethod));
}
}
......@@ -83,6 +85,8 @@ public class ApiEntityModel extends BaseModel {
fillDEAPIRSPath(parentApiEntityList, apiEntityRSModel, null);
for (List<ApiEntityRSModel> parentApiEntities : parentApiEntityList) {
for (IPSDEServiceAPIMethod iPSDEServiceAPIMethod : iPSDEServiceAPIRS.getPSDEServiceAPIMethods()) {
if(iPSDEServiceAPIMethod.getPSDEDataSet()!=null && iPSDEServiceAPIMethod.getPSDEDataSet().getPSDEDataQueries()==null)
continue ;
methods.add(new ApiMethodModel(this, parentApiEntities, iPSDEServiceAPIMethod));
}
}
......@@ -118,7 +122,9 @@ public class ApiEntityModel extends BaseModel {
List<ApiEntityRSModel> parents = api.getApiEntityParentRSes(apiEntityRSModel.getMajorEntityCodeName());
if (!CollectionUtils.isEmpty(parents)) {
for (ApiEntityRSModel parentRs : parents) {
fillDEAPIRSPath(parentApiEntityList, parentRs, parentApiEntities);
List<ApiEntityRSModel> tempParentApiEntities = new ArrayList<>();
tempParentApiEntities.addAll(parentApiEntities);
fillDEAPIRSPath(parentApiEntityList, parentRs, tempParentApiEntities);
}
}
}
......
......@@ -107,6 +107,12 @@ public class ApiMethodModel extends BaseModel {
return iPSDEServiceAPIMethodInput.getPSDEMethodDTO().getName();
else if ("DEFILTER".equals(iPSDEServiceAPIMethodInput.getPSDEMethodDTO().getType()))
return iPSDEServiceAPIMethodInput.getPSDEMethodDTO().getName().replace("FilterDTO", "SearchContext");
} else if ("DTOS".equals(iPSDEServiceAPIMethodInput.getType())) {
return iPSDEServiceAPIMethodInput.getPSDEMethodDTO().getName();
} else if ("KEYFIELD".equals(iPSDEServiceAPIMethodInput.getType())
&& getPSDEServiceAPIMethod().getPSDEAction()!=null
&& getPSDEServiceAPIMethod().getPSDEAction().getActionType().equals("USERCUSTOM")) {
return apiEntity.getCodeName() + "DTO";
}
}
return null;
......
......@@ -57,12 +57,12 @@ public class {{apiEntity.codeName}}Resource {
{{#each apiEntity.methods}}
@ApiOperation(value = "{{apiEntity.entity.logicName}}", tags = {"{{apiEntity.entity.logicName}}" }, notes = "{{apiEntity.entity.logicName}}")
@RequestMapping(method = RequestMethod.{{requestMethod}}, value = "{{requestPath}}")
public ResponseEntity {{camelCase methodName}}({{#each pathVariables}}{{#unless @first}}, {{/unless}}@PathVariable("{{camelCase name}}") {{type.java}} {{camelCase name}}{{/each}}{{#if body}}{{#if pathVariables}}, {{/if}}@Validated @RequestBody {{body}} {{camelCase body}}{{/if}}) {
public ResponseEntity {{camelCase name}}{{#each pathVariables}}{{#if @first}}By{{else}}And{{/if}}{{pascalCase name}}{{/each}}({{#each pathVariables}}{{#unless @first}}, {{/unless}}@PathVariable("{{camelCase name}}") {{type.java}} {{camelCase name}}{{/each}}{{#if body}}{{#if pathVariables}}, {{/if}}@Validated @RequestBody {{#eq input.type "DTO"}}{{body}}{{/eq}}{{#eq input.type "KEYFIELD"}}{{#eq pSDEAction.actionType "USERCUSTOM"}}{{body}}{{/eq}}{{/eq}}{{#eq input.type "DTOS"}}List<{{body}}>{{/eq}} {{#eq input.type "DTO"}}{{camelCase body}}{{/eq}}{{#eq input.type "KEYFIELD"}}{{#eq pSDEAction.actionType "USERCUSTOM"}}{{camelCase body}}{{/eq}}{{/eq}}{{#eq input.type "DTOS"}}list{{/eq}}{{/if}}) {
{{!行为}}
{{#eq methodType "DEACTION"}}
{{!行为参数准备}}
{{#eq input.type "DTO"}}
{{apiEntity.entity.codeName}} {{camelCase apiEntity.entity.codeName}} = {{camelCase input.pSDEMethodDTO.name}}Mapping.toDomain({{camelCase body}});
{{apiEntity.entity.codeName}} {{camelCase apiEntity.entity.codeName}} = {{camelCase input.psDEMethodDTO.name}}Mapping.toDomain({{camelCase body}});
{{#each pathVariables}}
{{#if @last}}
{{camelCase apiEntity.entity.codeName}}.set{{pascalCase name}}({{camelCase name}});
......@@ -70,9 +70,23 @@ public class {{apiEntity.codeName}}Resource {
{{/each}}
{{camelCase apiEntity.entity.codeName}}Service.{{camelCase name}}({{camelCase apiEntity.entity.codeName}});
{{/eq}}
{{#eq input.type "DTOS"}}
{{camelCase apiEntity.entity.codeName}}Service.{{camelCase name}}Batch({{camelCase input.psDEMethodDTO.name}}Mapping.toDomain(list));
{{/eq}}
{{#eq input.type "KEYFIELD"}}
{{#eq return.type "DTO"}}
{{#if body}}
{{apiEntity.entity.codeName}} {{camelCase apiEntity.entity.codeName}} = {{camelCase body}}Mapping.toDomain({{camelCase body}});
{{#each pathVariables}}
{{#if @last}}
{{camelCase apiEntity.entity.codeName}}.set{{pascalCase name}}({{camelCase name}});
{{/if}}
{{/each}}
{{camelCase apiEntity.entity.codeName}}Service.{{camelCase name}}({{camelCase apiEntity.entity.codeName}});
{{/if}}
{{#unless body}}
{{apiEntity.entity.codeName}} {{camelCase apiEntity.entity.codeName}} = {{camelCase apiEntity.entity.codeName}}Service.{{camelCase name}}({{camelCase apiEntity.entity.keyField.codeName}});
{{/unless}}
{{/eq}}
{{#neq return.type "DTO"}}
{{camelCase apiEntity.entity.codeName}}Service.{{camelCase name}}({{camelCase apiEntity.entity.keyField.codeName}});
......@@ -80,7 +94,10 @@ public class {{apiEntity.codeName}}Resource {
{{/eq}}
{{!返回处理}}
{{#eq return.type "DTO"}}
return ResponseEntity.status(HttpStatus.OK).body({{camelCase return.pSDEMethodDTO.name}}Mapping.toDto({{camelCase apiEntity.entity.codeName}}));
return ResponseEntity.status(HttpStatus.OK).body({{camelCase return.psDEMethodDTO.name}}Mapping.toDto({{camelCase apiEntity.entity.codeName}}));
{{/eq}}
{{#eq return.type "DTOS"}}
return ResponseEntity.status(HttpStatus.OK).body(true);
{{/eq}}
{{#eq return.type "SIMPLE"}}
return ResponseEntity.status(HttpStatus.OK).body(0);
......@@ -91,6 +108,9 @@ public class {{apiEntity.codeName}}Resource {
{{#eq return.type "VOID"}}
return ResponseEntity.status(HttpStatus.OK).body(true);
{{/eq}}
{{#eq return.type "USER"}}
return ResponseEntity.status(HttpStatus.OK).body({{camelCase body}}Mapping.toDto({{camelCase apiEntity.entity.codeName}}));
{{/eq}}
{{/eq}}
{{!数据集}}
{{#eq methodType "FETCH"}}
......@@ -100,7 +120,7 @@ public class {{apiEntity.codeName}}Resource {
{{/if}}
{{/each}}
Page<{{apiEntity.entity.codeName}}> domains = {{camelCase apiEntity.entity.codeName}}Service.search{{pascalCase pSDEDataSet.codeName}}({{camelCase body}}) ;
List<{{return.pSDEMethodDTO.name}}> list = {{camelCase return.pSDEMethodDTO.name}}Mapping.toDto(domains.getContent());
List<{{return.psDEMethodDTO.name}}> list = {{camelCase return.psDEMethodDTO.name}}Mapping.toDto(domains.getContent());
return ResponseEntity.status(HttpStatus.OK)
.header("x-page", String.valueOf({{camelCase body}}.getPageable().getPageNumber()))
.header("x-per-page", String.valueOf({{camelCase body}}.getPageable().getPageSize()))
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册