11
This commit is contained in:
@@ -4,8 +4,12 @@ import (
|
||||
"context"
|
||||
)
|
||||
|
||||
func (d *FsProductModel3dModel) FindOne(ctx context.Context, id int64) (resp *FsProductModel3d, err error) {
|
||||
err = d.db.WithContext(ctx).Model(&FsProductModel3d{}).Where("`id` = ? ", id).First(&resp).Error
|
||||
func (d *FsProductModel3dModel) FindOne(ctx context.Context, id int64, fields ...string) (resp *FsProductModel3d, err error) {
|
||||
db := d.db.WithContext(ctx).Model(&FsProductModel3d{}).Where("`id` = ? ", id)
|
||||
if len(fields) > 0 {
|
||||
db = db.Select(fields[0])
|
||||
}
|
||||
err = db.Take(&resp).Error
|
||||
return resp, err
|
||||
}
|
||||
func (d *FsProductModel3dModel) GetAllByIds(ctx context.Context, ids []int64, orderBy string, fields ...string) (resp []FsProductModel3d, err error) {
|
||||
|
||||
@@ -4,8 +4,12 @@ import (
|
||||
"context"
|
||||
)
|
||||
|
||||
func (s *FsProductSizeModel) FindOne(ctx context.Context, id int64) (resp *FsProductSize, err error) {
|
||||
err = s.db.WithContext(ctx).Model(&FsProductSize{}).Where("`id` = ? ", id).Take(&resp).Error
|
||||
func (s *FsProductSizeModel) FindOne(ctx context.Context, id int64, fields ...string) (resp *FsProductSize, err error) {
|
||||
db := s.db.WithContext(ctx).Model(&FsProductSize{}).Where("`id` = ? ", id)
|
||||
if len(fields) > 0 {
|
||||
db = db.Select(fields[0])
|
||||
}
|
||||
err = db.Take(&resp).Error
|
||||
return resp, err
|
||||
}
|
||||
func (s *FsProductSizeModel) GetAllByIds(ctx context.Context, ids []int64, sort string) (resp []FsProductSize, err error) {
|
||||
|
||||
@@ -124,12 +124,17 @@ func (t *FsProductTemplateV2Model) FindOneCloudRenderByProductIdModelIdTemplateT
|
||||
}
|
||||
|
||||
// 获取开启云渲染模板2
|
||||
func (t *FsProductTemplateV2Model) FindOneCloudRenderByProductIdTemplateTag(ctx context.Context, productId int64, templateTag string) (resp *FsProductTemplateV2, err error) {
|
||||
err = t.db.WithContext(ctx).Model(&FsProductTemplateV2{}).
|
||||
func (t *FsProductTemplateV2Model) FindOneCloudRenderByProductIdTemplateTag(ctx context.Context, productId int64, templateTag string, sort string, fields ...string) (resp *FsProductTemplateV2, err error) {
|
||||
db := t.db.WithContext(ctx).Model(&FsProductTemplateV2{}).
|
||||
Where("product_id = ? and template_tag = ? and element_model_id > ? ", productId, templateTag, 0).
|
||||
Where("status = ? and is_del = ?", 1, 0).
|
||||
Order("sort ASC").
|
||||
Take(&resp).Error
|
||||
Where("status = ? and is_del = ?", 1, 0)
|
||||
if sort != "" {
|
||||
db = db.Order(sort)
|
||||
}
|
||||
if len(fields) > 0 {
|
||||
db = db.Select(fields[0])
|
||||
}
|
||||
err = db.Take(&resp).Error
|
||||
return resp, err
|
||||
}
|
||||
func (t *FsProductTemplateV2Model) FindAllByModelIdsTemplateTag(ctx context.Context, modelIds []int64, templateTag string, orderBy string, fields ...string) (resp []FsProductTemplateV2, err error) {
|
||||
|
||||
Reference in New Issue
Block a user