fix
This commit is contained in:
@@ -26,5 +26,5 @@ func (c *FsCanteenTypeModel) FindOne(ctx context.Context, id int64) (resp FsCant
|
||||
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return FsCanteenType{}, err
|
||||
}
|
||||
return
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ func (c *FsCartModel) FindOne(ctx context.Context, id int64) (resp FsCart, err e
|
||||
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return FsCart{}, err
|
||||
}
|
||||
return
|
||||
return resp, nil
|
||||
}
|
||||
func (c *FsCartModel) FindOneCartByParams(ctx context.Context, req FindOneCartByParamsReq) (resp FsCart, err error) {
|
||||
db := c.db.WithContext(ctx).Model(&FsCart{})
|
||||
@@ -64,7 +64,7 @@ func (c *FsCartModel) FindOneCartByParams(ctx context.Context, req FindOneCartBy
|
||||
db = db.Where("`template_id` = ?", req.TemplateId)
|
||||
}
|
||||
if req.PriceId != nil {
|
||||
db = db.Where("`price_id` = ?", req.ProductId)
|
||||
db = db.Where("`price_id` = ?", req.PriceId)
|
||||
}
|
||||
if req.DesignId != nil {
|
||||
db = db.Where("`design_id` = ?", req.DesignId)
|
||||
@@ -78,10 +78,10 @@ func (c *FsCartModel) FindOneCartByParams(ctx context.Context, req FindOneCartBy
|
||||
if err = db.First(&resp).Error; err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return FsCart{}, err
|
||||
}
|
||||
return
|
||||
return resp, nil
|
||||
}
|
||||
func (c *FsCartModel) Create(ctx context.Context, data FsCart) error {
|
||||
return c.db.WithContext(ctx).Model(&FsCart{}).Create(data).Error
|
||||
return c.db.WithContext(ctx).Model(&FsCart{}).Create(&data).Error
|
||||
}
|
||||
func (c *FsCartModel) Update(ctx context.Context, id int64, data FsCart) error {
|
||||
return c.db.WithContext(ctx).Model(&FsCart{}).Where("`id` = ?", id).Updates(data).Error
|
||||
|
||||
@@ -38,5 +38,5 @@ func (d *FsProductDesignModel) FindOneBySn(ctx context.Context, sn string) (resp
|
||||
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return FsProductDesign{}, err
|
||||
}
|
||||
return
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
@@ -80,5 +80,5 @@ func (p *FsProductPriceModel) FindOneProductPriceByParams(ctx context.Context, r
|
||||
if err = db.First(&resp).Error; err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return FsProductPrice{}, err
|
||||
}
|
||||
return
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
@@ -39,5 +39,5 @@ func (q *FsQrcodeSetModel) FindOne(ctx context.Context, id int64) (resp FsQrcode
|
||||
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return FsQrcodeSet{}, err
|
||||
}
|
||||
return
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ func (t *FsTagsModel) FindOne(ctx context.Context, id int64) (resp FsTags, err e
|
||||
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return FsTags{}, err
|
||||
}
|
||||
return
|
||||
return resp, nil
|
||||
}
|
||||
func (t *FsTagsModel) GetAllByIds(ctx context.Context, ids []int64) (resp []FsTags, err error) {
|
||||
if len(ids) == 0 {
|
||||
|
||||
@@ -47,5 +47,5 @@ func (u *FsUserModel) FindOne(ctx context.Context, id int64) (resp FsUser, err e
|
||||
if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return FsUser{}, err
|
||||
}
|
||||
return
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user