From f4e382865415c7b3e4fe8047c717f119faef5546 Mon Sep 17 00:00:00 2001 From: mingshewhe Date: Sat, 11 Nov 2023 16:40:12 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90PAC=E3=80=91feat=EF=BC=9A=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E4=BB=A3=E7=A0=81=E5=BA=93=E8=AF=A6=E6=83=85=E9=A1=B5?= =?UTF-8?q?=20#8118?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 删除代码库时重置代码库别名 --- .../com/tencent/devops/repository/dao/RepositoryDao.kt | 3 ++- .../devops/repository/service/RepositoryService.kt | 9 ++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/backend/ci/core/repository/biz-repository/src/main/kotlin/com/tencent/devops/repository/dao/RepositoryDao.kt b/src/backend/ci/core/repository/biz-repository/src/main/kotlin/com/tencent/devops/repository/dao/RepositoryDao.kt index 82627c16054..c1485baacaa 100644 --- a/src/backend/ci/core/repository/biz-repository/src/main/kotlin/com/tencent/devops/repository/dao/RepositoryDao.kt +++ b/src/backend/ci/core/repository/biz-repository/src/main/kotlin/com/tencent/devops/repository/dao/RepositoryDao.kt @@ -286,10 +286,11 @@ class RepositoryDao { } } - fun delete(dslContext: DSLContext, repositoryId: Long, updateUser: String) { + fun delete(dslContext: DSLContext, repositoryId: Long, deleteAliasName: String, updateUser: String) { with(TRepository.T_REPOSITORY) { dslContext.update(this) .set(IS_DELETED, true) + .set(ALIAS_NAME, deleteAliasName) .set(UPDATED_USER, updateUser) .where(REPOSITORY_ID.eq(repositoryId)) .execute() diff --git a/src/backend/ci/core/repository/biz-repository/src/main/kotlin/com/tencent/devops/repository/service/RepositoryService.kt b/src/backend/ci/core/repository/biz-repository/src/main/kotlin/com/tencent/devops/repository/service/RepositoryService.kt index 75c2c4109fc..d443d5fa7e1 100644 --- a/src/backend/ci/core/repository/biz-repository/src/main/kotlin/com/tencent/devops/repository/service/RepositoryService.kt +++ b/src/backend/ci/core/repository/biz-repository/src/main/kotlin/com/tencent/devops/repository/service/RepositoryService.kt @@ -858,7 +858,14 @@ class RepositoryService @Autowired constructor( } deleteResource(projectId, repositoryId) - repositoryDao.delete(dslContext, repositoryId, userId) + val deleteTime = org.joda.time.LocalDateTime.now().toString("yyMMddHHmmSS") + val deleteAliasName = "${record.aliasName}[$deleteTime]" + repositoryDao.delete( + dslContext = dslContext, + repositoryId = repositoryId, + deleteAliasName = deleteAliasName, + updateUser = userId + ) } fun validatePermission(user: String, projectId: String, authPermission: AuthPermission, message: String) {