Skip to content

Commit a28b90f

Browse files
dragonpooludomikula
authored andcommitted
application snapshot history count logic fix
1 parent 138ebd8 commit a28b90f

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/application/service/ApplicationHistorySnapshotService.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ public interface ApplicationHistorySnapshotService {
1717
Mono<List<ApplicationHistorySnapshotTS>> listAllHistorySnapshotBriefInfoArchived(String applicationId, String compName, String theme, Instant from, Instant to, PageRequest pageRequest);
1818

1919
Mono<Long> countByApplicationId(String applicationId);
20+
Mono<Long> countByApplicationIdArchived(String applicationId);
2021

2122
Mono<ApplicationHistorySnapshot> getHistorySnapshotDetail(String historySnapshotId);
2223

server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/application/service/impl/ApplicationHistorySnapshotServiceImpl.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,13 @@ public Mono<Long> countByApplicationId(String applicationId) {
5959
e -> ofException(BizError.FETCH_HISTORY_SNAPSHOT_COUNT_FAILURE, "FETCH_HISTORY_SNAPSHOT_COUNT_FAILURE"));
6060
}
6161

62+
@Override
63+
public Mono<Long> countByApplicationIdArchived(String applicationId) {
64+
return repositoryArchived.countByApplicationId(applicationId)
65+
.onErrorMap(Exception.class,
66+
e -> ofException(BizError.FETCH_HISTORY_SNAPSHOT_COUNT_FAILURE, "FETCH_HISTORY_SNAPSHOT_COUNT_FAILURE"));
67+
}
68+
6269

6370
@Override
6471
public Mono<ApplicationHistorySnapshot> getHistorySnapshotDetail(String historySnapshotId) {

server/api-service/lowcoder-server/src/main/java/org/lowcoder/api/application/ApplicationHistorySnapshotController.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public Mono<ResponseView<Boolean>> create(@RequestBody ApplicationHistorySnapsho
5555

5656
@Override
5757
public Mono<ResponseView<Map<String, Object>>> listAllHistorySnapshotBriefInfo(@PathVariable String applicationId,
58-
@RequestParam(defaultValue = "0") int page,
58+
@RequestParam(defaultValue = "1") int page,
5959
@RequestParam(defaultValue = "10") int size,
6060
@RequestParam String compName,
6161
@RequestParam String theme,
@@ -92,7 +92,7 @@ public Mono<ResponseView<Map<String, Object>>> listAllHistorySnapshotBriefInfo(@
9292

9393
@Override
9494
public Mono<ResponseView<Map<String, Object>>> listAllHistorySnapshotBriefInfoArchived(@PathVariable String applicationId,
95-
@RequestParam(defaultValue = "0") int page,
95+
@RequestParam(defaultValue = "1") int page,
9696
@RequestParam(defaultValue = "10") int size,
9797
@RequestParam String compName,
9898
@RequestParam String theme,
@@ -119,7 +119,7 @@ public Mono<ResponseView<Map<String, Object>>> listAllHistorySnapshotBriefInfoAr
119119
)
120120
);
121121

122-
Mono<Long> applicationHistorySnapshotCount = applicationHistorySnapshotService.countByApplicationId(applicationId);
122+
Mono<Long> applicationHistorySnapshotCount = applicationHistorySnapshotService.countByApplicationIdArchived(applicationId);
123123

124124
return Mono.zip(snapshotBriefInfoList, applicationHistorySnapshotCount)
125125
.map(tuple -> ImmutableMap.of("list", tuple.getT1(), "count", tuple.getT2()));

0 commit comments

Comments
 (0)