fix
This commit is contained in:
@@ -99,3 +99,13 @@ func (s *FsProductSizeModel) GetAllByStatus(ctx context.Context, status int64, s
|
||||
err = db.Find(&resp).Error
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// 获取第一个尺寸
|
||||
func (s *FsProductSizeModel) GetProductFirstSize(ctx context.Context, productId int64) (resp *FsProductTemplateV2, err error) {
|
||||
err = s.db.WithContext(ctx).Model(&FsProductSize{}).
|
||||
Select("product_id,count(*) as num").
|
||||
Where("`product_id` = ? and `status` = ?", productId, 1).
|
||||
Order("sort ASC").
|
||||
Take(&resp).Error
|
||||
return resp, err
|
||||
}
|
||||
|
||||
@@ -114,14 +114,11 @@ func (t *FsProductTemplateV2Model) GetProductTemplateListByParams(ctx context.Co
|
||||
}
|
||||
|
||||
// 获取第一个尺寸下的模板
|
||||
func (t *FsProductTemplateV2Model) FindOneByProductIdTagIdWithSizeTable(ctx context.Context, productId int64, templateTag string) (resp *FsProductTemplateV2, err error) {
|
||||
err = t.db.WithContext(ctx).Table(t.name+" as t").
|
||||
Joins("inner join fs_product_size as s on t.product_id = s.product_id").
|
||||
Select("t.*").
|
||||
Where("t.product_id = ? and t.template_tag = ? ", productId, templateTag).
|
||||
Where("t.status = ? and t.is_del = ?", 1, 0).
|
||||
Where("s.status = ?", 1).
|
||||
Order("t.sort ASC,s.sort ASC").
|
||||
func (t *FsProductTemplateV2Model) FindFirstOneByProductIdModelIdTemplateTag(ctx context.Context, productId, modelId int64, templateTag string) (resp *FsProductTemplateV2, err error) {
|
||||
err = t.db.WithContext(ctx).Model(&FsProductTemplateV2{}).
|
||||
Where("product_id = ? and model_id = ? and template_tag = ? ", productId, modelId, templateTag).
|
||||
Where("status = ? and is_del = ?", 1, 0).
|
||||
Order("sort ASC").
|
||||
Take(&resp).Error
|
||||
return resp, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user