Skip to content

[fix-3843][api] When the update workflow definition name already exists, the prompt is not friendly add process define name verify.#3864

Merged
lgcareer merged 1 commit intoapache:devfrom
zhuangchong:dev-bug-api-fix-3843
Oct 14, 2020
Merged

[fix-3843][api] When the update workflow definition name already exists, the prompt is not friendly add process define name verify.#3864
lgcareer merged 1 commit intoapache:devfrom
zhuangchong:dev-bug-api-fix-3843

Conversation

@zhuangchong
Copy link
Copy Markdown
Contributor

What is the purpose of the pull request

#3843

problem:
The workflow definition name already exists, saved workflow ,prompt: update workflow definition error

The reason for this problem is that the user tenant or queue or project is empty. When the workflow definition is saved, the verification of the workflow definition name fails, the projectId and processDefineName construct unique constraints, and the workflow update fails when the data is saved.

I think that the workflow definition name verification only needs to verify the existence of projectId and processDefineName,The original query method is called in many places without modification.

 select pd.*,u.user_name,p.name as project_name,t.tenant_code,t.tenant_name,q.queue,q.queue_name
        from t_ds_process_definition pd
        JOIN t_ds_user u ON pd.user_id = u.id
        JOIN  t_ds_project p ON pd.project_id = p.id
        JOIN  t_ds_tenant t ON t.id = u.tenant_id
        JOIN t_ds_queue q ON t.queue_id = q.id
        WHERE p.id = #{projectId}
        and pd.name = #{processDefinitionName}

add verifyByDefineName

select pd.*
        from t_ds_process_definition pd
        WHERE pd.project_id = #{projectId}
        and pd.name = #{processDefinitionName}

Brief change log

add ProcessDefinitionMapper.verifyByDefineName(int projectId,String name)

Verify this pull request

This change added tests and can be verified as follows:

  • Manually verified the change by testing locally.

##拉取请求的目的是什么
问题
工作流程定义名称已存在,更新工作流定义,保存名称,提示:更新工作流程定义错误

出现这个问题的原因,用户租户或队列或项目为空导致,导致工作流定义保存时,工作流定义名称验证失败,projectId和processDefineName构建唯一约束,数据保存时报工作流更新失败。

我认为工作流定义名称验证,只需要验证projectId和processDefineName是否存在即可,原查询方法多处调用,并未做修改。

 select pd.*,u.user_name,p.name as project_name,t.tenant_code,t.tenant_name,q.queue,q.queue_name
        from t_ds_process_definition pd
        JOIN t_ds_user u ON pd.user_id = u.id
        JOIN  t_ds_project p ON pd.project_id = p.id
        JOIN  t_ds_tenant t ON t.id = u.tenant_id
        JOIN t_ds_queue q ON t.queue_id = q.id
        WHERE p.id = #{projectId}
        and pd.name = #{processDefinitionName}

add verifyByDefineName

select pd.*
        from t_ds_process_definition pd
        WHERE pd.project_id = #{projectId}
        and pd.name = #{processDefinitionName}

##简要更改日志

新增ProcessDefinitionMapper.verifyByDefineName(int projectId,String name)

@sonarqubecloud
Copy link
Copy Markdown

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

@xingchun-chen
Copy link
Copy Markdown
Contributor

can you mention the code in 1.3.3-release
 

Copy link
Copy Markdown
Contributor

@lenboo lenboo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@lenboo lenboo removed this from the 1.3.3-release milestone Oct 13, 2020
Copy link
Copy Markdown
Contributor

@lgcareer lgcareer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@lgcareer lgcareer merged commit d32300b into apache:dev Oct 14, 2020
@zhuangchong zhuangchong deleted the dev-bug-api-fix-3843 branch April 22, 2022 05:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants