3D模型数据资源备份镜像批量处理

This commit is contained in:
momo
2023-11-21 11:45:12 +08:00
parent e2552f50be
commit 7bdb1f3385
12 changed files with 275 additions and 0 deletions

View File

@@ -11,6 +11,11 @@ func (m *FsProductModel) TableName() string {
return m.name
}
func (t *FsProductModel) FindAll(ctx context.Context) (resp []FsProduct, err error) {
err = t.db.WithContext(ctx).Model(&FsProduct{}).Find(&resp).Error
return resp, err
}
func (p *FsProductModel) FindOne(ctx context.Context, id int64, fields ...string) (resp *FsProduct, err error) {
db := p.db.WithContext(ctx).Model(&FsProduct{}).Where("`id` = ? ", id)
if len(fields) != 0 {

View File

@@ -2,6 +2,10 @@ package gmodel
import "context"
func (t *FsProductModel3dLightModel) FindAll(ctx context.Context) (resp []FsProductModel3dLight, err error) {
err = t.db.WithContext(ctx).Model(&FsProductModel3dLight{}).Limit(10).Find(&resp).Error
return resp, err
}
func (l *FsProductModel3dLightModel) FindOne(ctx context.Context, id int64) (resp *FsProductModel3dLight, err error) {
err = l.db.WithContext(ctx).Model(&FsProductModel3dLight{}).Where("`id` = ? and `status` = ?", id, 1).Take(&resp).Error
return resp, err

View File

@@ -19,6 +19,11 @@ type StepPriceJsonStruct struct {
MinBuyUnitsNum int64 `json:"min_buy_units_num"`
}
func (t *FsProductModel3dModel) FindAll(ctx context.Context) (resp []FsProductModel3d, err error) {
err = t.db.WithContext(ctx).Model(&FsProductModel3d{}).Find(&resp).Error
return resp, err
}
func (d *FsProductModel3dModel) FindOne(ctx context.Context, id int64, fields ...string) (resp *FsProductModel3d, err error) {
db := d.db.WithContext(ctx).Model(&FsProductModel3d{}).Where("`id` = ? and `status` =? ", id, 1)
if len(fields) > 0 {

View File

@@ -4,6 +4,11 @@ import (
"context"
)
func (t *FsProductTemplateTagsModel) FindAll(ctx context.Context) (resp []FsProductTemplateTags, err error) {
err = t.db.WithContext(ctx).Model(&FsProductTemplateTags{}).Find(&resp).Error
return resp, err
}
func (pt *FsProductTemplateTagsModel) GetListByIds(ctx context.Context, ids []int64) (resp []FsProductTemplateTags, err error) {
if len(ids) == 0 {
return

View File

@@ -4,6 +4,11 @@ import (
"context"
)
func (t *FsProductTemplateV2Model) FindAll(ctx context.Context) (resp []FsProductTemplateV2, err error) {
err = t.db.WithContext(ctx).Model(&FsProductTemplateV2{}).Find(&resp).Error
return resp, err
}
func (t *FsProductTemplateV2Model) FindAllByProductIds(ctx context.Context, productIds []int64, sort string, fields ...string) (resp []FsProductTemplateV2, err error) {
if len(productIds) == 0 {
return

View File

@@ -1,3 +1,9 @@
package gmodel
import "context"
// TODO: 使用model的属性做你想做的
func (t *FsToolLogsModel) FindAll(ctx context.Context) (resp []FsToolLogs, err error) {
err = t.db.WithContext(ctx).Model(&FsToolLogs{}).Limit(10).Find(&resp).Error
return resp, err
}