From 00d9bf8224f4280ac6e5b35223c3eed2957fe682 Mon Sep 17 00:00:00 2001 From: ZhangJian He Date: Wed, 1 Mar 2023 09:43:25 +0800 Subject: [PATCH] [Multi-Database Support] Without Reliance on boolean integer compare --- CHANGES.md | 1 + .../java/com/ctrip/framework/apollo/biz/entity/AccessKey.java | 4 ++-- .../java/com/ctrip/framework/apollo/biz/entity/Audit.java | 4 ++-- .../java/com/ctrip/framework/apollo/biz/entity/Cluster.java | 4 ++-- .../java/com/ctrip/framework/apollo/biz/entity/Commit.java | 4 ++-- .../ctrip/framework/apollo/biz/entity/GrayReleaseRule.java | 4 ++-- .../main/java/com/ctrip/framework/apollo/biz/entity/Item.java | 4 ++-- .../java/com/ctrip/framework/apollo/biz/entity/Namespace.java | 4 ++-- .../com/ctrip/framework/apollo/biz/entity/NamespaceLock.java | 2 +- .../java/com/ctrip/framework/apollo/biz/entity/Privilege.java | 4 ++-- .../java/com/ctrip/framework/apollo/biz/entity/Release.java | 4 ++-- .../com/ctrip/framework/apollo/biz/entity/ReleaseHistory.java | 4 ++-- .../com/ctrip/framework/apollo/biz/entity/ServerConfig.java | 4 ++-- .../apollo/biz/repository/AppNamespaceRepository.java | 4 ++-- .../framework/apollo/biz/repository/CommitRepository.java | 2 +- .../ctrip/framework/apollo/biz/repository/ItemRepository.java | 2 +- .../framework/apollo/biz/repository/NamespaceRepository.java | 2 +- .../apollo/biz/repository/ReleaseHistoryRepository.java | 2 +- .../framework/apollo/biz/repository/ReleaseRepository.java | 2 +- .../java/com/ctrip/framework/apollo/common/entity/App.java | 4 ++-- .../ctrip/framework/apollo/common/entity/AppNamespace.java | 4 ++-- .../com/ctrip/framework/apollo/openapi/entity/Consumer.java | 4 ++-- .../ctrip/framework/apollo/openapi/entity/ConsumerRole.java | 4 ++-- .../ctrip/framework/apollo/openapi/entity/ConsumerToken.java | 4 ++-- .../apollo/openapi/repository/ConsumerRoleRepository.java | 2 +- .../com/ctrip/framework/apollo/portal/entity/po/Favorite.java | 4 ++-- .../ctrip/framework/apollo/portal/entity/po/Permission.java | 4 ++-- .../com/ctrip/framework/apollo/portal/entity/po/Role.java | 4 ++-- .../framework/apollo/portal/entity/po/RolePermission.java | 4 ++-- .../ctrip/framework/apollo/portal/entity/po/ServerConfig.java | 4 ++-- .../com/ctrip/framework/apollo/portal/entity/po/UserRole.java | 4 ++-- .../apollo/portal/repository/AppNamespaceRepository.java | 4 ++-- .../framework/apollo/portal/repository/AppRepository.java | 2 +- .../apollo/portal/repository/FavoriteRepository.java | 2 +- .../apollo/portal/repository/PermissionRepository.java | 2 +- .../apollo/portal/repository/RolePermissionRepository.java | 2 +- .../framework/apollo/portal/repository/RoleRepository.java | 2 +- .../apollo/portal/repository/UserRoleRepository.java | 2 +- 38 files changed, 62 insertions(+), 61 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 3b21d406791..430026af309 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -10,6 +10,7 @@ Apollo 2.2.0 * [rename mysql-connector-java to mysql-connector-j](https://github.com/apolloconfig/apollo/pull/4748) * [Bump springboot version from 2.7.8 to 2.7.9](https://github.com/apolloconfig/apollo/pull/4750) * [[Multi-Database Support] Without Reliance on globally_quoted_identifiers Variable](https://github.com/apolloconfig/apollo/pull/4749) +* [[Multi-Database Support] Without Reliance on boolean integer compare](https://github.com/apolloconfig/apollo/pull/4757) ------------------ All issues and pull requests are [here](https://github.com/apolloconfig/apollo/milestone/13?closed=1) \ No newline at end of file diff --git a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/AccessKey.java b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/AccessKey.java index b8e5f72b39b..550a468ace4 100644 --- a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/AccessKey.java +++ b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/AccessKey.java @@ -26,8 +26,8 @@ @Entity @Table(name = "AccessKey") -@SQLDelete(sql = "Update AccessKey set IsDeleted = 1, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000) where Id = ?") -@Where(clause = "isDeleted = 0") +@SQLDelete(sql = "Update AccessKey set IsDeleted = true, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000) where Id = ?") +@Where(clause = "isDeleted = false") public class AccessKey extends BaseEntity { @Column(name = "appId", nullable = false) diff --git a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/Audit.java b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/Audit.java index fe35751055d..f9a663a41cd 100644 --- a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/Audit.java +++ b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/Audit.java @@ -27,8 +27,8 @@ @Entity @Table(name = "Audit") -@SQLDelete(sql = "Update Audit set IsDeleted = 1, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000) where Id = ?") -@Where(clause = "isDeleted = 0") +@SQLDelete(sql = "Update Audit set IsDeleted = true, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000) where Id = ?") +@Where(clause = "isDeleted = false") public class Audit extends BaseEntity { public enum OP { diff --git a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/Cluster.java b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/Cluster.java index b296b7588dc..4279ffb4818 100644 --- a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/Cluster.java +++ b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/Cluster.java @@ -30,8 +30,8 @@ */ @Entity @Table(name = "Cluster") -@SQLDelete(sql = "Update Cluster set IsDeleted = 1, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000) where Id = ?") -@Where(clause = "isDeleted = 0") +@SQLDelete(sql = "Update Cluster set IsDeleted = true, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000) where Id = ?") +@Where(clause = "isDeleted = false") public class Cluster extends BaseEntity implements Comparable { @Column(name = "Name", nullable = false) diff --git a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/Commit.java b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/Commit.java index 4221c7f3071..7fbc75d696a 100644 --- a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/Commit.java +++ b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/Commit.java @@ -28,8 +28,8 @@ @Entity @Table(name = "Commit") -@SQLDelete(sql = "Update Commit set IsDeleted = 1, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000) where Id = ?") -@Where(clause = "isDeleted = 0") +@SQLDelete(sql = "Update Commit set IsDeleted = true, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000) where Id = ?") +@Where(clause = "isDeleted = false") public class Commit extends BaseEntity { @Lob diff --git a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/GrayReleaseRule.java b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/GrayReleaseRule.java index 89ee70735d2..39c46828dbf 100644 --- a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/GrayReleaseRule.java +++ b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/GrayReleaseRule.java @@ -27,8 +27,8 @@ @Entity @Table(name = "GrayReleaseRule") -@SQLDelete(sql = "Update GrayReleaseRule set IsDeleted = 1, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000) where Id = ?") -@Where(clause = "isDeleted = 0") +@SQLDelete(sql = "Update GrayReleaseRule set IsDeleted = true, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000) where Id = ?") +@Where(clause = "isDeleted = false") public class GrayReleaseRule extends BaseEntity{ @Column(name = "appId", nullable = false) diff --git a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/Item.java b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/Item.java index 18eccd5594b..6fb3689840e 100644 --- a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/Item.java +++ b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/Item.java @@ -28,8 +28,8 @@ @Entity @Table(name = "Item") -@SQLDelete(sql = "Update Item set IsDeleted = 1, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000) where Id = ?") -@Where(clause = "isDeleted = 0") +@SQLDelete(sql = "Update Item set IsDeleted = true, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000) where Id = ?") +@Where(clause = "isDeleted = false") public class Item extends BaseEntity { @Column(name = "NamespaceId", nullable = false) diff --git a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/Namespace.java b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/Namespace.java index 7ed92c24255..fb9a84fae6e 100644 --- a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/Namespace.java +++ b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/Namespace.java @@ -27,8 +27,8 @@ @Entity @Table(name = "`Namespace`") -@SQLDelete(sql = "Update Namespace set IsDeleted = 1, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000) where Id = ?") -@Where(clause = "isDeleted = 0") +@SQLDelete(sql = "Update Namespace set IsDeleted = true, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000) where Id = ?") +@Where(clause = "isDeleted = false") public class Namespace extends BaseEntity { @Column(name = "appId", nullable = false) diff --git a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/NamespaceLock.java b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/NamespaceLock.java index d4f9f2280cf..0e924330a84 100644 --- a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/NamespaceLock.java +++ b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/NamespaceLock.java @@ -26,7 +26,7 @@ @Entity @Table(name = "NamespaceLock") -@Where(clause = "isDeleted = 0") +@Where(clause = "isDeleted = false") public class NamespaceLock extends BaseEntity{ @Column(name = "NamespaceId") diff --git a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/Privilege.java b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/Privilege.java index 6033914b9ae..9e59d6861cf 100644 --- a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/Privilege.java +++ b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/Privilege.java @@ -27,8 +27,8 @@ @Entity @Table(name = "Privilege") -@SQLDelete(sql = "Update Privilege set IsDeleted = 1, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000) where Id = ?") -@Where(clause = "isDeleted = 0") +@SQLDelete(sql = "Update Privilege set IsDeleted = true, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000) where Id = ?") +@Where(clause = "isDeleted = false") public class Privilege extends BaseEntity { @Column(name = "Name", nullable = false) diff --git a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/Release.java b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/Release.java index a77d51730c8..21447638b30 100644 --- a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/Release.java +++ b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/Release.java @@ -31,8 +31,8 @@ */ @Entity @Table(name = "`Release`") -@SQLDelete(sql = "Update Release set IsDeleted = 1, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000) where Id = ?") -@Where(clause = "isDeleted = 0") +@SQLDelete(sql = "Update Release set IsDeleted = true, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000) where Id = ?") +@Where(clause = "isDeleted = false") public class Release extends BaseEntity { @Column(name = "ReleaseKey", nullable = false) private String releaseKey; diff --git a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/ReleaseHistory.java b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/ReleaseHistory.java index d0a312d3333..2401c4fa8ca 100644 --- a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/ReleaseHistory.java +++ b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/ReleaseHistory.java @@ -30,8 +30,8 @@ */ @Entity @Table(name = "ReleaseHistory") -@SQLDelete(sql = "Update ReleaseHistory set IsDeleted = 1, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000) where Id = ?") -@Where(clause = "isDeleted = 0") +@SQLDelete(sql = "Update ReleaseHistory set IsDeleted = true, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000) where Id = ?") +@Where(clause = "isDeleted = false") public class ReleaseHistory extends BaseEntity { @Column(name = "AppId", nullable = false) private String appId; diff --git a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/ServerConfig.java b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/ServerConfig.java index e5d02b78d0d..23cb89a2f4e 100644 --- a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/ServerConfig.java +++ b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/entity/ServerConfig.java @@ -30,8 +30,8 @@ */ @Entity @Table(name = "ServerConfig") -@SQLDelete(sql = "Update ServerConfig set IsDeleted = 1, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000) where Id = ?") -@Where(clause = "isDeleted = 0") +@SQLDelete(sql = "Update ServerConfig set IsDeleted = true, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000) where Id = ?") +@Where(clause = "isDeleted = false") public class ServerConfig extends BaseEntity { @Column(name = "`Key`", nullable = false) private String key; diff --git a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/repository/AppNamespaceRepository.java b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/repository/AppNamespaceRepository.java index 0d649c62e32..0fec33f2474 100644 --- a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/repository/AppNamespaceRepository.java +++ b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/repository/AppNamespaceRepository.java @@ -43,10 +43,10 @@ public interface AppNamespaceRepository extends PagingAndSortingRepository findFirst500ByIdGreaterThanOrderByIdAsc(long id); @Modifying - @Query("UPDATE AppNamespace SET IsDeleted = 1, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000), DataChange_LastModifiedBy = ?2 WHERE AppId=?1 and IsDeleted = 0") + @Query("UPDATE AppNamespace SET IsDeleted = true, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000), DataChange_LastModifiedBy = ?2 WHERE AppId=?1 and isDeleted = false") int batchDeleteByAppId(String appId, String operator); @Modifying - @Query("UPDATE AppNamespace SET IsDeleted = 1, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000), DataChange_LastModifiedBy = ?3 WHERE AppId=?1 and Name = ?2 and IsDeleted = 0") + @Query("UPDATE AppNamespace SET IsDeleted = true, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000), DataChange_LastModifiedBy = ?3 WHERE AppId=?1 and Name = ?2 and isDeleted = false") int delete(String appId, String namespaceName, String operator); } diff --git a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/repository/CommitRepository.java b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/repository/CommitRepository.java index eb4eacc52ef..afc0dff9819 100644 --- a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/repository/CommitRepository.java +++ b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/repository/CommitRepository.java @@ -35,7 +35,7 @@ List findByAppIdAndClusterNameAndNamespaceNameAndDataChangeLastModifiedT String appId, String clusterName, String namespaceName, Date dataChangeLastModifiedTime, Pageable pageable); @Modifying - @Query("update Commit set IsDeleted = 1, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000), DataChange_LastModifiedBy = ?4 where appId=?1 and clusterName=?2 and namespaceName = ?3 and IsDeleted = 0") + @Query("update Commit set IsDeleted = true, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000), DataChange_LastModifiedBy = ?4 where appId=?1 and clusterName=?2 and namespaceName = ?3 and isDeleted = false") int batchDelete(String appId, String clusterName, String namespaceName, String operator); List findByAppIdAndClusterNameAndNamespaceNameAndChangeSetsLikeOrderByIdDesc(String appId, String clusterName, String namespaceName,String changeSets, Pageable page); diff --git a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/repository/ItemRepository.java b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/repository/ItemRepository.java index 3294aaef583..0c3396bea80 100644 --- a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/repository/ItemRepository.java +++ b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/repository/ItemRepository.java @@ -44,7 +44,7 @@ public interface ItemRepository extends PagingAndSortingRepository { Item findFirst1ByNamespaceIdOrderByLineNumDesc(Long namespaceId); @Modifying - @Query("update Item set IsDeleted = 1, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000), DataChange_LastModifiedBy = ?2 where namespaceId = ?1 and IsDeleted = 0") + @Query("update Item set IsDeleted = true, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000), DataChange_LastModifiedBy = ?2 where namespaceId = ?1 and isDeleted = false") int deleteByNamespaceId(long namespaceId, String operator); } diff --git a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/repository/NamespaceRepository.java b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/repository/NamespaceRepository.java index 4fe47bb5928..6c3e1a0b983 100644 --- a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/repository/NamespaceRepository.java +++ b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/repository/NamespaceRepository.java @@ -33,7 +33,7 @@ public interface NamespaceRepository extends PagingAndSortingRepository findByAppIdAndNamespaceNameOrderByIdAsc(String appId, String namespaceName); diff --git a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/repository/ReleaseHistoryRepository.java b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/repository/ReleaseHistoryRepository.java index fc174f37c34..09e8d6b2d52 100644 --- a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/repository/ReleaseHistoryRepository.java +++ b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/repository/ReleaseHistoryRepository.java @@ -39,7 +39,7 @@ Page findByAppIdAndClusterNameAndNamespaceNameOrderByIdDesc(Stri Page findByReleaseIdAndOperationInOrderByIdDesc(long releaseId, Set operations, Pageable pageable); @Modifying - @Query("update ReleaseHistory set IsDeleted = 1, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000), DataChange_LastModifiedBy = ?4 where appId=?1 and clusterName=?2 and namespaceName = ?3 and IsDeleted = 0") + @Query("update ReleaseHistory set IsDeleted = true, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000), DataChange_LastModifiedBy = ?4 where appId=?1 and clusterName=?2 and namespaceName = ?3 and isDeleted = false") int batchDelete(String appId, String clusterName, String namespaceName, String operator); } diff --git a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/repository/ReleaseRepository.java b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/repository/ReleaseRepository.java index ceed3ff70d8..c7d3bff6ff4 100644 --- a/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/repository/ReleaseRepository.java +++ b/apollo-biz/src/main/java/com/ctrip/framework/apollo/biz/repository/ReleaseRepository.java @@ -48,7 +48,7 @@ Release findFirstByAppIdAndClusterNameAndNamespaceNameAndIsAbandonedFalseOrderBy List findByIdIn(Set releaseIds); @Modifying - @Query("update Release set IsDeleted = 1, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000), DataChange_LastModifiedBy = ?4 where appId=?1 and clusterName=?2 and namespaceName = ?3 and IsDeleted = 0") + @Query("update Release set IsDeleted = true, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000), DataChange_LastModifiedBy = ?4 where appId=?1 and clusterName=?2 and namespaceName = ?3 and isDeleted = false") int batchDelete(String appId, String clusterName, String namespaceName, String operator); // For release history conversion program, need to delete after conversion it done diff --git a/apollo-common/src/main/java/com/ctrip/framework/apollo/common/entity/App.java b/apollo-common/src/main/java/com/ctrip/framework/apollo/common/entity/App.java index f51a9b4ea0f..385d65996f3 100644 --- a/apollo-common/src/main/java/com/ctrip/framework/apollo/common/entity/App.java +++ b/apollo-common/src/main/java/com/ctrip/framework/apollo/common/entity/App.java @@ -28,8 +28,8 @@ @Entity @Table(name = "App") -@SQLDelete(sql = "Update App set IsDeleted = 1, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000) where Id = ?") -@Where(clause = "isDeleted = 0") +@SQLDelete(sql = "Update App set IsDeleted = true, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000) where Id = ?") +@Where(clause = "isDeleted = false") public class App extends BaseEntity { @NotBlank(message = "Name cannot be blank") diff --git a/apollo-common/src/main/java/com/ctrip/framework/apollo/common/entity/AppNamespace.java b/apollo-common/src/main/java/com/ctrip/framework/apollo/common/entity/AppNamespace.java index 937d95f20d1..252615519e6 100644 --- a/apollo-common/src/main/java/com/ctrip/framework/apollo/common/entity/AppNamespace.java +++ b/apollo-common/src/main/java/com/ctrip/framework/apollo/common/entity/AppNamespace.java @@ -31,8 +31,8 @@ @Entity @Table(name = "`AppNamespace`") -@SQLDelete(sql = "Update AppNamespace set IsDeleted = 1, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000) where Id = ?") -@Where(clause = "isDeleted = 0") +@SQLDelete(sql = "Update AppNamespace set IsDeleted = true, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000) where Id = ?") +@Where(clause = "isDeleted = false") public class AppNamespace extends BaseEntity { @NotBlank(message = "AppNamespace Name cannot be blank") diff --git a/apollo-portal/src/main/java/com/ctrip/framework/apollo/openapi/entity/Consumer.java b/apollo-portal/src/main/java/com/ctrip/framework/apollo/openapi/entity/Consumer.java index e418036594d..a112669e818 100644 --- a/apollo-portal/src/main/java/com/ctrip/framework/apollo/openapi/entity/Consumer.java +++ b/apollo-portal/src/main/java/com/ctrip/framework/apollo/openapi/entity/Consumer.java @@ -27,8 +27,8 @@ @Entity @Table(name = "Consumer") -@SQLDelete(sql = "Update Consumer set IsDeleted = 1, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000) where Id = ?") -@Where(clause = "isDeleted = 0") +@SQLDelete(sql = "Update Consumer set IsDeleted = true, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000) where Id = ?") +@Where(clause = "isDeleted = false") public class Consumer extends BaseEntity { @Column(name = "Name", nullable = false) diff --git a/apollo-portal/src/main/java/com/ctrip/framework/apollo/openapi/entity/ConsumerRole.java b/apollo-portal/src/main/java/com/ctrip/framework/apollo/openapi/entity/ConsumerRole.java index c86cc0b4580..ffa4f526130 100644 --- a/apollo-portal/src/main/java/com/ctrip/framework/apollo/openapi/entity/ConsumerRole.java +++ b/apollo-portal/src/main/java/com/ctrip/framework/apollo/openapi/entity/ConsumerRole.java @@ -30,8 +30,8 @@ */ @Entity @Table(name = "ConsumerRole") -@SQLDelete(sql = "Update ConsumerRole set IsDeleted = 1, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000) where Id = ?") -@Where(clause = "isDeleted = 0") +@SQLDelete(sql = "Update ConsumerRole set IsDeleted = true, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000) where Id = ?") +@Where(clause = "isDeleted = false") public class ConsumerRole extends BaseEntity { @Column(name = "ConsumerId", nullable = false) private long consumerId; diff --git a/apollo-portal/src/main/java/com/ctrip/framework/apollo/openapi/entity/ConsumerToken.java b/apollo-portal/src/main/java/com/ctrip/framework/apollo/openapi/entity/ConsumerToken.java index e837a7c70f3..771497b07d0 100644 --- a/apollo-portal/src/main/java/com/ctrip/framework/apollo/openapi/entity/ConsumerToken.java +++ b/apollo-portal/src/main/java/com/ctrip/framework/apollo/openapi/entity/ConsumerToken.java @@ -32,8 +32,8 @@ */ @Entity @Table(name = "ConsumerToken") -@SQLDelete(sql = "Update ConsumerToken set IsDeleted = 1, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000) where Id = ?") -@Where(clause = "isDeleted = 0") +@SQLDelete(sql = "Update ConsumerToken set IsDeleted = true, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000) where Id = ?") +@Where(clause = "isDeleted = false") public class ConsumerToken extends BaseEntity { @Column(name = "ConsumerId", nullable = false) private long consumerId; diff --git a/apollo-portal/src/main/java/com/ctrip/framework/apollo/openapi/repository/ConsumerRoleRepository.java b/apollo-portal/src/main/java/com/ctrip/framework/apollo/openapi/repository/ConsumerRoleRepository.java index a93c7f0fe31..27b7724977c 100644 --- a/apollo-portal/src/main/java/com/ctrip/framework/apollo/openapi/repository/ConsumerRoleRepository.java +++ b/apollo-portal/src/main/java/com/ctrip/framework/apollo/openapi/repository/ConsumerRoleRepository.java @@ -43,6 +43,6 @@ public interface ConsumerRoleRepository extends PagingAndSortingRepository roleIds, String operator); } diff --git a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/po/Favorite.java b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/po/Favorite.java index ece2021c406..6d1830d0af7 100644 --- a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/po/Favorite.java +++ b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/po/Favorite.java @@ -27,8 +27,8 @@ @Entity @Table(name = "Favorite") -@SQLDelete(sql = "Update Favorite set IsDeleted = 1, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000) where Id = ?") -@Where(clause = "isDeleted = 0") +@SQLDelete(sql = "Update Favorite set IsDeleted = true, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000) where Id = ?") +@Where(clause = "isDeleted = false") public class Favorite extends BaseEntity { @Column(name = "AppId", nullable = false) diff --git a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/po/Permission.java b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/po/Permission.java index 8101c2e08b7..beb639553be 100644 --- a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/po/Permission.java +++ b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/po/Permission.java @@ -30,8 +30,8 @@ */ @Entity @Table(name = "Permission") -@SQLDelete(sql = "Update Permission set IsDeleted = 1, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000) where Id = ?") -@Where(clause = "isDeleted = 0") +@SQLDelete(sql = "Update Permission set IsDeleted = true, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000) where Id = ?") +@Where(clause = "isDeleted = false") public class Permission extends BaseEntity { @Column(name = "PermissionType", nullable = false) private String permissionType; diff --git a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/po/Role.java b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/po/Role.java index 857804961fb..24dd567bcb8 100644 --- a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/po/Role.java +++ b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/po/Role.java @@ -30,8 +30,8 @@ */ @Entity @Table(name = "Role") -@SQLDelete(sql = "Update Role set IsDeleted = 1, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000) where Id = ?") -@Where(clause = "isDeleted = 0") +@SQLDelete(sql = "Update Role set IsDeleted = true, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000) where Id = ?") +@Where(clause = "isDeleted = false") public class Role extends BaseEntity { @Column(name = "RoleName", nullable = false) private String roleName; diff --git a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/po/RolePermission.java b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/po/RolePermission.java index a75818f88dd..dc154e6d3b6 100644 --- a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/po/RolePermission.java +++ b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/po/RolePermission.java @@ -30,8 +30,8 @@ */ @Entity @Table(name = "RolePermission") -@SQLDelete(sql = "Update RolePermission set IsDeleted = 1, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000) where Id = ?") -@Where(clause = "isDeleted = 0") +@SQLDelete(sql = "Update RolePermission set IsDeleted = true, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000) where Id = ?") +@Where(clause = "isDeleted = false") public class RolePermission extends BaseEntity { @Column(name = "RoleId", nullable = false) private long roleId; diff --git a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/po/ServerConfig.java b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/po/ServerConfig.java index bfdabdc3ace..951ee293c8a 100644 --- a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/po/ServerConfig.java +++ b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/po/ServerConfig.java @@ -31,8 +31,8 @@ */ @Entity @Table(name = "ServerConfig") -@SQLDelete(sql = "Update ServerConfig set IsDeleted = 1, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000) where Id = ?") -@Where(clause = "isDeleted = 0") +@SQLDelete(sql = "Update ServerConfig set IsDeleted = true, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000) where Id = ?") +@Where(clause = "isDeleted = false") public class ServerConfig extends BaseEntity { @NotBlank(message = "ServerConfig.Key cannot be blank") @Column(name = "`Key`", nullable = false) diff --git a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/po/UserRole.java b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/po/UserRole.java index e1acbd8859e..8a8ff7f79e0 100644 --- a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/po/UserRole.java +++ b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/entity/po/UserRole.java @@ -30,8 +30,8 @@ */ @Entity @Table(name = "UserRole") -@SQLDelete(sql = "Update UserRole set IsDeleted = 1, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000) where Id = ?") -@Where(clause = "isDeleted = 0") +@SQLDelete(sql = "Update UserRole set IsDeleted = true, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000) where Id = ?") +@Where(clause = "isDeleted = false") public class UserRole extends BaseEntity { @Column(name = "UserId", nullable = false) private String userId; diff --git a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/repository/AppNamespaceRepository.java b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/repository/AppNamespaceRepository.java index 32f17c635df..3f5f2888ded 100644 --- a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/repository/AppNamespaceRepository.java +++ b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/repository/AppNamespaceRepository.java @@ -35,10 +35,10 @@ public interface AppNamespaceRepository extends PagingAndSortingRepository findByAppId(String appId); @Modifying - @Query("UPDATE AppNamespace SET IsDeleted = 1, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000), DataChange_LastModifiedBy=?2 WHERE AppId=?1 and IsDeleted = 0") + @Query("UPDATE AppNamespace SET IsDeleted = true, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000), DataChange_LastModifiedBy=?2 WHERE AppId=?1 and isDeleted = false") int batchDeleteByAppId(String appId, String operator); @Modifying - @Query("UPDATE AppNamespace SET IsDeleted = 1, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000), DataChange_LastModifiedBy = ?3 WHERE AppId=?1 and Name = ?2 and IsDeleted = 0") + @Query("UPDATE AppNamespace SET IsDeleted = true, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000), DataChange_LastModifiedBy = ?3 WHERE AppId=?1 and Name = ?2 and isDeleted = false") int delete(String appId, String namespaceName, String operator); } diff --git a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/repository/AppRepository.java b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/repository/AppRepository.java index 9d034d85f3c..22550f3b322 100644 --- a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/repository/AppRepository.java +++ b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/repository/AppRepository.java @@ -41,6 +41,6 @@ public interface AppRepository extends PagingAndSortingRepository { Page findByAppIdContainingOrNameContaining(String appId, String name, Pageable pageable); @Modifying - @Query("UPDATE App SET IsDeleted = 1, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000), DataChange_LastModifiedBy = ?2 WHERE AppId=?1 and IsDeleted = 0") + @Query("UPDATE App SET IsDeleted = true, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000), DataChange_LastModifiedBy = ?2 WHERE AppId=?1 and isDeleted = false") int deleteApp(String appId, String operator); } diff --git a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/repository/FavoriteRepository.java b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/repository/FavoriteRepository.java index 8fdd04b4f34..cfc5d03d8cb 100644 --- a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/repository/FavoriteRepository.java +++ b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/repository/FavoriteRepository.java @@ -36,6 +36,6 @@ public interface FavoriteRepository extends PagingAndSortingRepository findByPermissionTypeInAndTargetId(Collection permission List findPermissionIdsByAppIdAndNamespace(String appId, String namespaceName); @Modifying - @Query("UPDATE Permission SET IsDeleted = 1, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000), DataChange_LastModifiedBy = ?2 WHERE Id in ?1 and IsDeleted = 0") + @Query("UPDATE Permission SET IsDeleted = true, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000), DataChange_LastModifiedBy = ?2 WHERE Id in ?1 and isDeleted = false") Integer batchDelete(List permissionIds, String operator); } diff --git a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/repository/RolePermissionRepository.java b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/repository/RolePermissionRepository.java index 9c7476584a0..ab3fb931388 100644 --- a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/repository/RolePermissionRepository.java +++ b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/repository/RolePermissionRepository.java @@ -36,6 +36,6 @@ public interface RolePermissionRepository extends PagingAndSortingRepository findByRoleIdIn(Collection roleId); @Modifying - @Query("UPDATE RolePermission SET IsDeleted = 1, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000), DataChange_LastModifiedBy = ?2 WHERE PermissionId in ?1 and IsDeleted = 0") + @Query("UPDATE RolePermission SET IsDeleted = true, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000), DataChange_LastModifiedBy = ?2 WHERE PermissionId in ?1 and isDeleted = false") Integer batchDeleteByPermissionIds(List permissionIds, String operator); } diff --git a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/repository/RoleRepository.java b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/repository/RoleRepository.java index ac109d31397..5df68f30206 100644 --- a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/repository/RoleRepository.java +++ b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/repository/RoleRepository.java @@ -43,6 +43,6 @@ public interface RoleRepository extends PagingAndSortingRepository { List findRoleIdsByAppIdAndNamespace(String appId, String namespaceName); @Modifying - @Query("UPDATE Role SET IsDeleted = 1, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000), DataChange_LastModifiedBy = ?2 WHERE Id in ?1 and IsDeleted = 0") + @Query("UPDATE Role SET IsDeleted = true, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000), DataChange_LastModifiedBy = ?2 WHERE Id in ?1 and isDeleted = false") Integer batchDelete(List roleIds, String operator); } diff --git a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/repository/UserRoleRepository.java b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/repository/UserRoleRepository.java index 3369a60c6e3..9c46d2f0132 100644 --- a/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/repository/UserRoleRepository.java +++ b/apollo-portal/src/main/java/com/ctrip/framework/apollo/portal/repository/UserRoleRepository.java @@ -45,7 +45,7 @@ public interface UserRoleRepository extends PagingAndSortingRepository findByUserIdInAndRoleId(Collection userId, long roleId); @Modifying - @Query("UPDATE UserRole SET IsDeleted = 1, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000), DataChange_LastModifiedBy = ?2 WHERE RoleId in ?1 and IsDeleted = 0") + @Query("UPDATE UserRole SET IsDeleted = true, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000), DataChange_LastModifiedBy = ?2 WHERE RoleId in ?1 and isDeleted = false") Integer batchDeleteByRoleIds(List roleIds, String operator); }