fix
This commit is contained in:
@@ -24,12 +24,18 @@ func (s *FsProductSizeModel) GetAllByIds(ctx context.Context, ids []int64, sort
|
||||
}
|
||||
return
|
||||
}
|
||||
func (s *FsProductSizeModel) CountByStatus(ctx context.Context, status int) (total int64, err error) {
|
||||
err = s.db.WithContext(ctx).Model(&FsProductSize{}).Where("`status` = ? limit 1", status).Count(&total).Error
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return
|
||||
|
||||
type CountProductSizeByStatusRsp struct {
|
||||
ProductId int64 `json:"product_id"`
|
||||
Num int64 `json:"num"`
|
||||
}
|
||||
func (s *FsProductSizeModel) GetGroupProductSizeByStatus(ctx context.Context,productIds []int64, status int) (resp []CountProductSizeByStatusRsp, err error) {
|
||||
err = s.db.WithContext(ctx).Model(&FsProductSize{}).
|
||||
Select("product_id,count(*) as num").
|
||||
Where("`product_id` in (?) and `status` = ?",productIds ,status).
|
||||
Group("product_id").
|
||||
Find(&resp).Error
|
||||
return resp,err
|
||||
}
|
||||
func (s *FsProductSizeModel) GetAllByProductIds(ctx context.Context, productIds []int64, sort string) (resp []FsProductSize, err error) {
|
||||
if len(productIds) == 0 {
|
||||
|
||||
Reference in New Issue
Block a user