fix
This commit is contained in:
@@ -2,6 +2,13 @@ package gmodel
|
||||
|
||||
import "context"
|
||||
|
||||
func (p *FsProductModel) FindOne(ctx context.Context, id int64) (resp FsProduct, err error) {
|
||||
err = p.db.Model(&FsProduct{}).Where("`id` = ? and `is_del` =? and `is_shelf` = ? and `status` =?", id, 0, 1, 1).First(&resp).Error
|
||||
if err != nil {
|
||||
return FsProduct{}, err
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
func (p *FsProductModel) GetProductListByIds(ctx context.Context, productIds []int64, sort string) (resp []FsProduct, err error) {
|
||||
if len(productIds) == 0 {
|
||||
return
|
||||
|
||||
@@ -2,8 +2,17 @@ package gmodel
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
func (d *FsProductModel3dModel) FindOne(ctx context.Context, id int64) (resp FsProductModel3d, err error) {
|
||||
err = d.db.WithContext(ctx).Model(&FsProductModel3d{}).Where("`id` = ? ", id).Find(&resp).Error
|
||||
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return FsProductModel3d{}, err
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
func (d *FsProductModel3dModel) GetAllByIds(ctx context.Context, ids []int64) (resp []FsProductModel3d, err error) {
|
||||
if len(ids) == 0 {
|
||||
return
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
)
|
||||
|
||||
func (s *FsProductSizeModel) FindOne(ctx context.Context, id int64) (resp FsProductSize, err error) {
|
||||
err = s.db.WithContext(ctx).Model(&FsProductSize{}).Where("`id` = ? and `status` = ?", id, 1).First(&resp).Error
|
||||
err = s.db.WithContext(ctx).Model(&FsProductSize{}).Where("`id` = ? ", id).First(&resp).Error
|
||||
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return FsProductSize{}, err
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ func (t *FsProductTemplateV2Model) FindAllByIds(ctx context.Context, ids []int64
|
||||
}
|
||||
func (t *FsProductTemplateV2Model) FindOne(ctx context.Context, id int64) (resp FsProductTemplateV2, err error) {
|
||||
|
||||
err = t.db.WithContext(ctx).Model(&FsProductTemplateV2{}).Where("`id` = ? and `is_del` = ? and `status` = ?", id, 0, 1).Find(&resp).Error
|
||||
err = t.db.WithContext(ctx).Model(&FsProductTemplateV2{}).Where("`id` = ? ", id).Find(&resp).Error
|
||||
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return FsProductTemplateV2{}, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user