fix: branch commits 接口返回分页参数

This commit is contained in:
shizhendong
2024-11-04 09:43:09 +08:00
parent 5943b5c514
commit c05f37af1a

View File

@@ -64,12 +64,13 @@ public class GitController {
@RequestParam(required = false) Integer current,
@RequestParam(required = false) Integer size) {
List<Map<Object, Object>> records = gitService.listBranchCommit(workspaceId, branchName, path);
long total = T.CollUtil.size(records);
if (null != current && null != size) {
int fromIndex = (current - 1) * size;
int toIndex = Math.min(fromIndex + size, records.size());
records = records.subList(fromIndex, toIndex);
}
return R.ok().putData("records", records);
return R.ok().putData("records", records).put("total", total);
}
@GetMapping({