This commit is contained in:
laodaming
2023-09-27 11:13:37 +08:00
parent 6eccd11386
commit ab916ac13d
2 changed files with 53 additions and 20 deletions

View File

@@ -152,3 +152,17 @@ func (d *FsProductModel3dModel) FindOneByProductIdSizeIdTag(ctx context.Context,
err = db.Take(&resp).Error
return resp, err
}
func (d *FsProductModel3dModel) GetAllByProductIdsTags(ctx context.Context, productIds []int64, tags []int, fields ...string) (resp []FsProductModel3d, err error) {
if len(productIds) == 0 || len(tags) == 0 {
return
}
db := d.db.WithContext(ctx).Model(&FsProductModel3d{}).
Where("`product_id` in (?) and `tag` in (?) and `status` = ?", productIds, tags, 1).
Order("sort DESC")
if len(fields) != 0 {
db = db.Select(fields[0])
}
err = db.Find(&resp).Error
return resp, err
}