fix: branch commits 接口返回分页参数
This commit is contained in:
@@ -64,12 +64,13 @@ public class GitController {
|
|||||||
@RequestParam(required = false) Integer current,
|
@RequestParam(required = false) Integer current,
|
||||||
@RequestParam(required = false) Integer size) {
|
@RequestParam(required = false) Integer size) {
|
||||||
List<Map<Object, Object>> records = gitService.listBranchCommit(workspaceId, branchName, path);
|
List<Map<Object, Object>> records = gitService.listBranchCommit(workspaceId, branchName, path);
|
||||||
|
long total = T.CollUtil.size(records);
|
||||||
if (null != current && null != size) {
|
if (null != current && null != size) {
|
||||||
int fromIndex = (current - 1) * size;
|
int fromIndex = (current - 1) * size;
|
||||||
int toIndex = Math.min(fromIndex + size, records.size());
|
int toIndex = Math.min(fromIndex + size, records.size());
|
||||||
records = records.subList(fromIndex, toIndex);
|
records = records.subList(fromIndex, toIndex);
|
||||||
}
|
}
|
||||||
return R.ok().putData("records", records);
|
return R.ok().putData("records", records).put("total", total);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping({
|
@GetMapping({
|
||||||
|
|||||||
Reference in New Issue
Block a user