mirror of
https://gitee.com/dolphinscheduler/DolphinScheduler.git
synced 2024-12-04 21:28:00 +08:00
[Feature][API] add processDefinitionSimpleList api (#6814)
* add processDefinitionSimpleList api * add processDefinitionSimpleList api
This commit is contained in:
parent
975131e913
commit
da2a044947
@ -441,6 +441,24 @@ public class ProcessDefinitionController extends BaseController {
|
||||
return returnDataList(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* query Process definition simple list
|
||||
*
|
||||
* @param loginUser login user
|
||||
* @param projectCode project code
|
||||
* @return process definition list
|
||||
*/
|
||||
@ApiOperation(value = "querySimpleList", notes = "QUERY_PROCESS_DEFINITION_SIMPLE_LIST_NOTES")
|
||||
@GetMapping(value = "/simple-list")
|
||||
@ResponseStatus(HttpStatus.OK)
|
||||
@ApiException(QUERY_PROCESS_DEFINITION_LIST)
|
||||
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
|
||||
public Result queryProcessDefinitionSimpleList(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
|
||||
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode) {
|
||||
Map<String, Object> result = processDefinitionService.queryProcessDefinitionSimpleList(loginUser, projectCode);
|
||||
return returnDataList(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* query process definition list paging
|
||||
*
|
||||
|
@ -70,6 +70,16 @@ public interface ProcessDefinitionService {
|
||||
Map<String, Object> queryProcessDefinitionList(User loginUser,
|
||||
long projectCode);
|
||||
|
||||
/**
|
||||
* query process definition simple list
|
||||
*
|
||||
* @param loginUser login user
|
||||
* @param projectCode project code
|
||||
* @return definition simple list
|
||||
*/
|
||||
Map<String, Object> queryProcessDefinitionSimpleList(User loginUser,
|
||||
long projectCode);
|
||||
|
||||
/**
|
||||
* query process definition list paging
|
||||
*
|
||||
|
@ -103,6 +103,8 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fasterxml.jackson.databind.node.ArrayNode;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
/**
|
||||
@ -352,6 +354,36 @@ public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements Pro
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* query process definition simple list
|
||||
*
|
||||
* @param loginUser login user
|
||||
* @param projectCode project code
|
||||
* @return definition simple list
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> queryProcessDefinitionSimpleList(User loginUser, long projectCode) {
|
||||
Project project = projectMapper.queryByCode(projectCode);
|
||||
//check user access for project
|
||||
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode);
|
||||
if (result.get(Constants.STATUS) != Status.SUCCESS) {
|
||||
return result;
|
||||
}
|
||||
List<ProcessDefinition> processDefinitions = processDefinitionMapper.queryAllDefinitionList(projectCode);
|
||||
ArrayNode arrayNode = JSONUtils.createArrayNode();
|
||||
for (ProcessDefinition processDefinition : processDefinitions) {
|
||||
ObjectNode processDefinitionNode = JSONUtils.createObjectNode();
|
||||
processDefinitionNode.put("id", processDefinition.getId());
|
||||
processDefinitionNode.put("code", processDefinition.getCode());
|
||||
processDefinitionNode.put("name", processDefinition.getName());
|
||||
processDefinitionNode.put("projectCode", processDefinition.getCode());
|
||||
arrayNode.add(processDefinitionNode);
|
||||
}
|
||||
result.put(Constants.DATA_LIST, arrayNode);
|
||||
putMsg(result, Status.SUCCESS);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* query process definition list paging
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user