fix(系统设置): 服务集成第三方定制化插件取消集成报错

--bug=1031749 --user=宋昌昌 【系统设置】github#27042,服务集成第三方插件成功后,取消服务集成失败。 https://www.tapd.cn/55049933/s/1425800
This commit is contained in:
song-cc-rock 2023-10-13 15:37:29 +08:00 committed by Craftsman
parent 4726ef6514
commit f46d0626fb
2 changed files with 6 additions and 9 deletions

View File

@ -186,15 +186,11 @@
</if>
<if test="platform == 'Tapd'">
tapd_id = NULL
</if>
<if test="platform == 'Zentao'">
zentao_id = NULL
</if>
<if test="platform == 'AzureDevops'">
azure_devops_id = NULL
</if>
</set>
@ -202,6 +198,7 @@
FROM project
WHERE workspace_id = #{workspaceId}) AS a)
</update>
<update id="updateUseDefaultCaseTemplateProject">
update project set case_template_id = #{templateId}
where (case_template_id = #{originId} or case_template_id is null or case_template_id = '')

View File

@ -5,20 +5,18 @@ import io.metersphere.base.domain.ServiceIntegrationExample;
import io.metersphere.base.mapper.ServiceIntegrationMapper;
import io.metersphere.base.mapper.ext.BaseProjectMapper;
import io.metersphere.commons.constants.MicroServiceName;
import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.JSON;
import io.metersphere.commons.utils.LogUtil;
import io.metersphere.log.utils.ReflexObjectUtil;
import io.metersphere.log.vo.DetailColumn;
import io.metersphere.log.vo.OperatingLogDetails;
import io.metersphere.log.vo.system.SystemReference;
import io.metersphere.request.IntegrationRequest;
import jakarta.annotation.Resource;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import jakarta.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
@ -76,8 +74,10 @@ public class BaseIntegrationService {
.andWorkspaceIdEqualTo(workspaceId)
.andPlatformEqualTo(platform);
serviceIntegrationMapper.deleteByExample(example);
// 删除项目关联的id/key
baseProjectMapper.removeIssuePlatform(platform, workspaceId);
// 删除项目关联的id/key(目前只有jira/tapd/zentao/azure才有项目对接的key)
if (StringUtils.equalsAny(platform, "Jira", "Tapd", "Zentao", "AzureDevops")) {
baseProjectMapper.removeIssuePlatform(platform, workspaceId);
}
}
public List<ServiceIntegration> getAll(String workspaceId) {