This commit is contained in:
laodaming
2023-09-18 12:31:51 +08:00
parent b07473478b
commit 1a7ce5013e
6 changed files with 90 additions and 16 deletions

View File

@@ -37,11 +37,15 @@ func (d *FsProductModel3dModel) GetAllByIdsWithoutStatus(ctx context.Context, id
err = db.Find(&resp).Error
return resp, err
}
func (d *FsProductModel3dModel) GetAllByIdsTag(ctx context.Context, ids []int64, tag int64) (resp []FsProductModel3d, err error) {
func (d *FsProductModel3dModel) GetAllByIdsTag(ctx context.Context, ids []int64, tag int64, fields ...string) (resp []FsProductModel3d, err error) {
if len(ids) == 0 {
return
}
err = d.db.WithContext(ctx).Model(&FsProductModel3d{}).Where("`id` in (?) and `status` = ? and `tag` = ?", ids, 1, tag).Find(&resp).Error
db := d.db.WithContext(ctx).Model(&FsProductModel3d{}).Where("`id` in (?) and `status` = ? and `tag` = ?", ids, 1, tag)
if len(fields) > 0 {
db = db.Select(fields[0])
}
err = db.Find(&resp).Error
return resp, err
}