统一管理后台分页样式
- 新建 AdminTablePagination 组件,统一分页 UI - 改造 6 个前端页面使用统一分页组件: - 管理员管理 - 用户管理 - 申诉管理 - 审计日志 - 公告管理 - 钱包流水 - 订单管理前后端完整改造: - 后端:添加 PaginatedResult 结构,支持 page/page_size 参数 - 前端:API 支持分页参数,页面使用统一分页组件 - 所有列表页分页样式统一为商品管理的 .table-pagination 设计 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -707,20 +707,34 @@ func (r *Repository) ListForUser(userID uint64) ([]OrderDTO, error) {
|
||||
return items, nil
|
||||
}
|
||||
|
||||
func (r *Repository) ListAdmin() ([]OrderDTO, error) {
|
||||
func (r *Repository) ListAdmin(page, pageSize int) (*PaginatedResult, error) {
|
||||
var total int64
|
||||
if err := r.adminQuery().Count(&total).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
offset := (page - 1) * pageSize
|
||||
var rows []orderRow
|
||||
err := r.adminQuery().
|
||||
Order("o.id DESC").
|
||||
Limit(200).
|
||||
Limit(pageSize).
|
||||
Offset(offset).
|
||||
Scan(&rows).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
items := make([]OrderDTO, 0, len(rows))
|
||||
for _, row := range rows {
|
||||
items = append(items, row.toAdminDTO())
|
||||
}
|
||||
return items, nil
|
||||
|
||||
return &PaginatedResult{
|
||||
Items: items,
|
||||
Total: total,
|
||||
Page: page,
|
||||
PageSize: pageSize,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (r *Repository) FindAdmin(orderID uint64) (*OrderDTO, error) {
|
||||
|
||||
Reference in New Issue
Block a user