新增:获取系统商品列表-分页 库存排序
This commit is contained in:
+9
-1
@@ -143,7 +143,15 @@ func (r *ProductDao) GetProductPageSearch(req requests.GetProductPage, page, pag
|
||||
}
|
||||
|
||||
// 排序
|
||||
query = query.Order("created_at desc")
|
||||
if req.Order != nil {
|
||||
if req.Order.Stock != "" {
|
||||
query = query.Joins("JOIN gdxz_product_platform_amount ON gdxz_product_platform_amount.product_platform_id = gdxz_product.product_platform_id").
|
||||
Order("gdxz_product_platform_amount.stock " + req.Order.Stock)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
query = query.Order("gdxz_product.created_at desc")
|
||||
|
||||
// 查询总数量
|
||||
if err := query.Count(&totalRecords).Error; err != nil {
|
||||
|
||||
Reference in New Issue
Block a user