fix
This commit is contained in:
@@ -101,3 +101,14 @@ func (d *FsProductModel3dModel) FindOneJoinSize(ctx context.Context, productId i
|
||||
Order("s.sort ASC").Take(&resp).Error
|
||||
return resp, err
|
||||
}
|
||||
|
||||
func (d *FsProductModel3dModel) GetOneBySizeIdTag(ctx context.Context, sizeId int64, tag int64, fields ...string) (resp *FsProductModel3d, err error) {
|
||||
db := d.db.WithContext(ctx).Model(&FsProductModel3d{}).
|
||||
Where("`size_id` = ? and `tag` = ? and `status` = ?", sizeId, tag, 1).
|
||||
Order("sort DESC")
|
||||
if len(fields) != 0 {
|
||||
db = db.Select(fields[0])
|
||||
}
|
||||
err = db.Take(&resp).Error
|
||||
return resp, err
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ type FsProductTemplateV2 struct {
|
||||
Ctime *int64 `gorm:"default:0;" json:"ctime"` // 添加时间
|
||||
Tag *string `gorm:"default:'';" json:"tag"` // 标签(用户自填)
|
||||
IsDel *int64 `gorm:"default:0;" json:"is_del"` // 是否删除 1删除
|
||||
SwitchInfo *string `gorm:"default:'';" json:"switch_info"` // 开关信息
|
||||
GroupOptions *string `gorm:"default:'';" json:"group_options"` // 颜色分组
|
||||
Version *int64 `gorm:"default:0;" json:"version"` //
|
||||
}
|
||||
|
||||
@@ -140,22 +140,6 @@ func (t *FsProductTemplateV2Model) FindAllByModelIdsTemplateTag(ctx context.Cont
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// 获取产品某个物料下的第一个模板
|
||||
func (t *FsProductTemplateV2Model) GetSizeLatestTemplate(ctx context.Context, ids []int64, productId int64) (resp *FsProductTemplateV2, err error) {
|
||||
err = t.db.WithContext(ctx).Model(&FsProductTemplateV2{}).
|
||||
Where("id in (?) and product_id = ? and status = ? and is_del = ?", ids, productId, 1, 0).
|
||||
Order("sort ASC").Take(&resp).Error
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// 获取产品第一个物料下的第一个模板
|
||||
func (t *FsProductTemplateV2Model) GetProductLatestTemplate(ctx context.Context, ids []int64, productId int64) (resp *FsProductTemplateV2, err error) {
|
||||
err = t.db.WithContext(ctx).Model(&FsProductTemplateV2{}).
|
||||
Where("id in (?) and product_id = ? and status = ? and is_del = ?", ids, productId, 1, 0).
|
||||
Order("sort ASC").Take(&resp).Error
|
||||
return resp, err
|
||||
}
|
||||
|
||||
// 获取产品在指定模板标签下的所有模板
|
||||
func (t *FsProductTemplateV2Model) GetListByProductAndTemplateTag(ctx context.Context, templateTagId string, productId int64, fields ...string) (resp []FsProductTemplateV2, err error) {
|
||||
db := t.db.WithContext(ctx).Model(&FsProductTemplateV2{}).
|
||||
|
||||
Reference in New Issue
Block a user