This commit is contained in:
laodaming
2023-09-01 15:48:47 +08:00
parent a095de178f
commit b64131dfe5
2 changed files with 82 additions and 39 deletions

View File

@@ -113,10 +113,20 @@ func (t *FsProductTemplateV2Model) GetProductTemplateListByParams(ctx context.Co
return resp, err
}
// 获取第一个尺寸下的模板
func (t *FsProductTemplateV2Model) FindFirstOneCloudRenderByProductIdModelIdTemplateTag(ctx context.Context, productId, modelId int64, templateTag string) (resp *FsProductTemplateV2, err error) {
// 获取开启云渲染模板
func (t *FsProductTemplateV2Model) FindOneCloudRenderByProductIdModelIdTemplateTag(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("product_id = ? and model_id = ? and template_tag = ? and element_model_id > ? ", productId, modelId, templateTag, 0).
Where("status = ? and is_del = ?", 1, 0).
Order("sort ASC").
Take(&resp).Error
return resp, err
}
// 获取开启云渲染模板2
func (t *FsProductTemplateV2Model) FindOneCloudRenderByProductIdTemplateTag(ctx context.Context, productId int64, templateTag string) (resp *FsProductTemplateV2, err error) {
err = t.db.WithContext(ctx).Model(&FsProductTemplateV2{}).
Where("product_id = ? and element_model_id > ? ", productId, templateTag, 0).
Where("status = ? and is_del = ?", 1, 0).
Order("sort ASC").
Take(&resp).Error