This commit is contained in:
laodaming
2023-09-26 11:40:27 +08:00
parent 47a1ecfc79
commit 01cc115a60
8 changed files with 143 additions and 82 deletions

View File

@@ -142,3 +142,13 @@ func (d *FsProductModel3dModel) GetAllByProductIdTag(ctx context.Context, produc
err = db.Find(&resp).Error
return resp, err
}
func (d *FsProductModel3dModel) FindOneByProductIdSizeIdTag(ctx context.Context, productId, sizeId, tag int64, fields ...string) (resp *FsProductModel3d, err error) {
db := d.db.WithContext(ctx).Model(&FsProductModel3d{}).
Where("`product_id` = ? and `size_id` = ? and `tag` = ? and `status` = ?", productId, sizeId, tag, 1).
Order("sort DESC")
if len(fields) != 0 {
db = db.Select(fields[0])
}
err = db.Take(&resp).Error
return resp, err
}