添加商品管理资产皮肤筛选

This commit is contained in:
yml2213
2026-07-05 20:21:18 +08:00
parent 090a90a268
commit 1984e07e91
8 changed files with 612 additions and 2 deletions
+31
View File
@@ -29,6 +29,37 @@ func (r *Repository) ListAdmin(ctx context.Context, query AdminListQuery) (*Admi
pageSize = 100
}
if hasAdminAssetFilters(query) {
var rows []listingRow
err := r.applyAdminListFilters(r.baseQuery(ctx), query).
Order("l.id DESC").
Scan(&rows).Error
if err != nil {
return nil, err
}
items := filterAdminListings(rowsToDTO(rows), query)
total := int64(len(items))
start := (page - 1) * pageSize
if start < 0 {
start = 0
}
if start >= len(items) {
items = []ListingDTO{}
} else {
end := start + pageSize
if end > len(items) {
end = len(items)
}
items = items[start:end]
}
return &AdminListResult{
Items: items,
Total: total,
Page: page,
PageSize: pageSize,
}, nil
}
countDB := r.applyAdminListFilters(r.db.WithContext(ctx).Table("rental_listings AS l"), query)
var total int64
if err := countDB.Count(&total).Error; err != nil {