feat: 支持主列表选择每页条数 (#242)
This commit is contained in:
@@ -34,15 +34,21 @@ func ParseCatalogStatus(raw string) model.CatalogImportStatus {
|
||||
}
|
||||
|
||||
func ListCatalogHistory(q repository.Execer, source, statusRaw string, page int) (CatalogHistoryResult, error) {
|
||||
return ListCatalogHistoryWithPageSize(q, source, statusRaw, page, DefaultPageSize)
|
||||
}
|
||||
|
||||
// ListCatalogHistoryWithPageSize 按白名单页容量返回商品目录导入记录。
|
||||
func ListCatalogHistoryWithPageSize(q repository.Execer, source, statusRaw string, page, pageSize int) (CatalogHistoryResult, error) {
|
||||
pageSize = NormalizePageSize(pageSize)
|
||||
status := ParseCatalogStatus(statusRaw)
|
||||
totalPages := 1
|
||||
_, total, err := repository.ListCatalogImportRuns(q, strings.TrimSpace(source), status, 1, 0)
|
||||
if err != nil {
|
||||
return CatalogHistoryResult{}, err
|
||||
}
|
||||
totalPages = TotalPages(total)
|
||||
totalPages = TotalPages(total, pageSize)
|
||||
page = ClampPage(page, totalPages)
|
||||
runs, _, err := repository.ListCatalogImportRuns(q, strings.TrimSpace(source), status, PageSize, (page-1)*PageSize)
|
||||
runs, _, err := repository.ListCatalogImportRuns(q, strings.TrimSpace(source), status, pageSize, (page-1)*pageSize)
|
||||
if err != nil {
|
||||
return CatalogHistoryResult{}, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user