mirror of
https://github.com/vran-dev/databasir.git
synced 2025-08-09 23:27:09 +08:00
fix: disable auto sync after delete project/group (#5)
This commit is contained in:
@@ -86,4 +86,18 @@ public class ProjectDao extends BaseDao<ProjectRecord, ProjectPojo> {
|
||||
+ " where project.deleted = false and `group`.id in " + groupIdIn + " group by `group`.id;";
|
||||
return dslContext.resultQuery(sql).fetchInto(GroupProjectCountPojo.class);
|
||||
}
|
||||
|
||||
public void deleteByGroupId(Integer groupId) {
|
||||
dslContext
|
||||
.update(PROJECT).set(PROJECT.DELETED, true)
|
||||
.where(PROJECT.GROUP_ID.eq(groupId).and(PROJECT.DELETED.eq(false)))
|
||||
.execute();
|
||||
}
|
||||
|
||||
public List<Integer> selectProjectIdsByGroupId(Integer groupId) {
|
||||
return dslContext
|
||||
.select(PROJECT.ID).from(PROJECT)
|
||||
.where(PROJECT.GROUP_ID.eq(groupId).and(PROJECT.DELETED.eq(false)))
|
||||
.fetchInto(Integer.class);
|
||||
}
|
||||
}
|
||||
|
@@ -95,4 +95,22 @@ public class ProjectSyncRuleDao extends BaseDao<ProjectSyncRuleRecord, ProjectSy
|
||||
PROJECT_SYNC_RULE.PROJECT_ID.eq(projectId)
|
||||
.and(PROJECT_SYNC_RULE.AUTO_SYNC_CRON.eq(cron)));
|
||||
}
|
||||
|
||||
public void disableAutoSyncByProjectId(Integer projectId) {
|
||||
dslContext
|
||||
.update(PROJECT_SYNC_RULE).set(PROJECT_SYNC_RULE.IS_AUTO_SYNC, false)
|
||||
.where(PROJECT_SYNC_RULE.PROJECT_ID.eq(projectId))
|
||||
.execute();
|
||||
|
||||
}
|
||||
|
||||
public void disableAutoSyncByProjectIds(List<Integer> projectIds) {
|
||||
if (projectIds == null || projectIds.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
dslContext
|
||||
.update(PROJECT_SYNC_RULE).set(PROJECT_SYNC_RULE.IS_AUTO_SYNC, false)
|
||||
.where(PROJECT_SYNC_RULE.PROJECT_ID.in(projectIds))
|
||||
.execute();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user