zwZjut opened a new issue #6783:
URL: https://github.com/apache/dolphinscheduler/issues/6783


   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and 
found no similar issues.
   
   
   ### What happened
   
    int switchVersion = taskDefinitionMapper.updateById(taskDefinitionLog);   
//  t_ds_task_definition_log  id  is different from t_ds_task_definition id ,  
we may add   taskDefinitionLog.setId(taskDefinition.getId())
   @Override
       public Map<String, Object> switchVersion(User loginUser, long 
projectCode, long taskCode, int version) {
           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;
           }
           if (processService.isTaskOnline(taskCode)) {
               putMsg(result, Status.PROCESS_DEFINE_STATE_ONLINE);
               return result;
           }
           TaskDefinition taskDefinition = 
taskDefinitionMapper.queryByCode(taskCode);
           if (taskDefinition == null) {
               putMsg(result, Status.TASK_DEFINE_NOT_EXIST, taskCode);
               return result;
           }
           TaskDefinitionLog taskDefinitionLog = 
taskDefinitionLogMapper.queryByDefinitionCodeAndVersion(taskCode, version);
           taskDefinitionLog.setUserId(loginUser.getId());
           taskDefinitionLog.setUpdateTime(new Date());
           int switchVersion = 
taskDefinitionMapper.updateById(taskDefinitionLog);
           if (switchVersion > 0) {
               result.put(Constants.DATA_LIST, taskCode);
               putMsg(result, Status.SUCCESS);
           } else {
               putMsg(result, Status.SWITCH_TASK_DEFINITION_VERSION_ERROR);
           }
           return result;
       }
   
   
   ### What you expected to happen
   
   switchVersion success
   
   ### How to reproduce
   
   call  switchTaskDefinitionVersion  openapi  you will find "switch task 
definition version error"
   
   ### Anything else
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
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]


Reply via email to