caishunfeng commented on code in PR #13070:
URL:
https://github.com/apache/dolphinscheduler/pull/13070#discussion_r1039275863
##########
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskInstanceServiceImpl.java:
##########
@@ -306,4 +306,31 @@ public Result stopTask(User loginUser, long projectCode,
Integer taskInstanceId)
return result;
}
+
+ @Override
+ public Result queryTaskInstanceByCode(User loginUser, long projectCode,
Long taskCode) {
+ Result result = new Result();
+
+ Project project = projectMapper.queryByCode(projectCode);
+ // check user access for project
+ Map<String, Object> checkResult =
+ projectService.checkProjectAndAuth(loginUser, project,
projectCode, FORCED_SUCCESS);
+ Status status = (Status) checkResult.get(Constants.STATUS);
+ if (status != Status.SUCCESS) {
+ putMsg(result, status);
+ return result;
+ }
Review Comment:
```suggestion
projectService.checkProjectAndAuthThrowException(loginUser, project,
projectCode, FORCED_SUCCESS);
```
##########
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskInstanceServiceImpl.java:
##########
@@ -306,4 +306,31 @@ public Result stopTask(User loginUser, long projectCode,
Integer taskInstanceId)
return result;
}
+
+ @Override
+ public Result queryTaskInstanceByCode(User loginUser, long projectCode,
Long taskCode) {
Review Comment:
This is a new method, I think we should return a exact object but not
result, WDYT? @zhongjiajie
```suggestion
public TaskInstance queryTaskInstanceByCode(User loginUser, long
projectCode, Long taskCode) {
```
##########
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/TaskInstanceMapper.java:
##########
@@ -154,5 +154,7 @@ IPage<TaskInstance>
queryStreamTaskInstanceListPaging(IPage<TaskInstance> page,
List<TaskInstance> loadAllInfosNoRelease(@Param("processInstanceId") int
processInstanceId,
@Param("status") int status);
+ TaskInstance selectByCode(Long taskCode);
Review Comment:
If select by task code, it may exist multi records.
```suggestion
List<TaskInstance> selectByCode(Long taskCode);
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]