Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Multi-Database Support] Without Reliance on boolean integer compare #4757

Merged
merged 1 commit into from
Mar 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Cluster> {

@Column(name = "Name", nullable = false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

@Entity
@Table(name = "NamespaceLock")
@Where(clause = "isDeleted = 0")
@Where(clause = "isDeleted = false")
public class NamespaceLock extends BaseEntity{

@Column(name = "NamespaceId")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ public interface AppNamespaceRepository extends PagingAndSortingRepository<AppNa
List<AppNamespace> 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);
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ List<Commit> 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<Commit> findByAppIdAndClusterNameAndNamespaceNameAndChangeSetsLikeOrderByIdDesc(String appId, String clusterName, String namespaceName,String changeSets, Pageable page);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public interface ItemRepository extends PagingAndSortingRepository<Item, Long> {
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);

}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public interface NamespaceRepository extends PagingAndSortingRepository<Namespac
Namespace findByAppIdAndClusterNameAndNamespaceName(String appId, String clusterName, String namespaceName);

@Modifying
@Query("update Namespace set IsDeleted = 1, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000), DataChange_LastModifiedBy = ?3 where appId=?1 and clusterName=?2 and IsDeleted = 0")
@Query("update Namespace set IsDeleted = true, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000), DataChange_LastModifiedBy = ?3 where appId=?1 and clusterName=?2 and isDeleted = false")
int batchDelete(String appId, String clusterName, String operator);

List<Namespace> findByAppIdAndNamespaceNameOrderByIdAsc(String appId, String namespaceName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Page<ReleaseHistory> findByAppIdAndClusterNameAndNamespaceNameOrderByIdDesc(Stri
Page<ReleaseHistory> findByReleaseIdAndOperationInOrderByIdDesc(long releaseId, Set<Integer> 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);

}
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Release findFirstByAppIdAndClusterNameAndNamespaceNameAndIsAbandonedFalseOrderBy
List<Release> findByIdIn(Set<Long> 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ public interface ConsumerRoleRepository extends PagingAndSortingRepository<Consu
ConsumerRole findByConsumerIdAndRoleId(long consumerId, long roleId);

@Modifying
@Query("UPDATE ConsumerRole SET IsDeleted = 1, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000), DataChange_LastModifiedBy = ?2 WHERE RoleId in ?1 and IsDeleted = 0")
@Query("UPDATE ConsumerRole SET IsDeleted = true, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000), DataChange_LastModifiedBy = ?2 WHERE RoleId in ?1 and isDeleted = false")
Integer batchDeleteByRoleIds(List<Long> roleIds, String operator);
}
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ public interface AppNamespaceRepository extends PagingAndSortingRepository<AppNa
List<AppNamespace> 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);
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ public interface AppRepository extends PagingAndSortingRepository<App, Long> {
Page<App> 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);
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ public interface FavoriteRepository extends PagingAndSortingRepository<Favorite,
Favorite findByUserIdAndAppId(String userId, String appId);

@Modifying
@Query("UPDATE Favorite SET IsDeleted = 1, DeletedAt = ROUND(UNIX_TIMESTAMP(NOW(4))*1000), DataChange_LastModifiedBy = ?2 WHERE AppId=?1 and IsDeleted = 0")
@Query("UPDATE Favorite 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);
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@ List<Permission> findByPermissionTypeInAndTargetId(Collection<String> permission
List<Long> 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<Long> permissionIds, String operator);
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ public interface RolePermissionRepository extends PagingAndSortingRepository<Rol
List<RolePermission> findByRoleIdIn(Collection<Long> 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<Long> permissionIds, String operator);
}
Loading