From 973df7a9013b34921b40f17c2bd74d51de012617 Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Mon, 12 Jun 2023 17:47:20 +0800 Subject: [PATCH] fix --- model/gmodel/fsproductmodel.go | 4 ++-- model/gmodel/fsproductpricemodel.go | 4 ++-- model/gmodel/fsproductsizemodel.go | 6 +++--- model/gmodel/fsproducttemplatev2model.go | 2 +- model/gmodel/fsqrcodesetmodel.go | 4 ++-- model/gmodel/fsstandardlogomodel.go | 2 +- model/gmodel/fstagsmodel.go | 6 +++--- model/gmodel/fsusermodel.go | 2 +- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/model/gmodel/fsproductmodel.go b/model/gmodel/fsproductmodel.go index 08f969f1..de13a194 100755 --- a/model/gmodel/fsproductmodel.go +++ b/model/gmodel/fsproductmodel.go @@ -60,7 +60,7 @@ func (p *FsProductModel) GetProductListByIds(ctx context.Context, productIds []i } func (p *FsProductModel) GetProductListByTypeIds(ctx context.Context, productTypes []int64, sort string) (resp []FsProduct, err error) { - db := p.db.WithContext(ctx).Model(&FsProductModel{}).Where("`type` in (?) and `is_del` =? and `is_shelf` = ? and `status` =?", productTypes, 0, 1, 1) + db := p.db.WithContext(ctx).Model(&FsProduct{}).Where("`type` in (?) and `is_del` =? and `is_shelf` = ? and `status` =?", productTypes, 0, 1, 1) switch sort { case "sort-asc": db = db.Order("`sort` ASC") @@ -74,7 +74,7 @@ func (p *FsProductModel) GetProductListByTypeIds(ctx context.Context, productTyp return } func (p *FsProductModel) GetRandomProductList(ctx context.Context, limit int) (resp []FsProduct, err error) { - err = p.db.WithContext(ctx).Model(&FsProductModel{}). + err = p.db.WithContext(ctx).Model(&FsProduct{}). Where("`is_del` =? and `is_shelf` = ?", 0, 1).Order("RAND()").Limit(limit).Find(&resp).Error if err != nil { return nil, err diff --git a/model/gmodel/fsproductpricemodel.go b/model/gmodel/fsproductpricemodel.go index 318f61ce..1a29e34d 100755 --- a/model/gmodel/fsproductpricemodel.go +++ b/model/gmodel/fsproductpricemodel.go @@ -37,7 +37,7 @@ func (p *FsProductPriceModel) GetPriceListByProductIds(ctx context.Context, prod if len(productIds) == 0 { return nil, nil } - db := p.db.WithContext(ctx).Model(&FsProductPriceModel{}).Select("product_id,group_concat(step_price) as price"). + db := p.db.WithContext(ctx).Model(&FsProductPrice{}).Select("product_id,group_concat(step_price) as price"). Where("`product_id` in (?) and `status` = ? group by product_id", productIds, 1) if err = db.Find(&resp).Error; err != nil { return nil, err @@ -45,7 +45,7 @@ func (p *FsProductPriceModel) GetPriceListByProductIds(ctx context.Context, prod return } func (p *FsProductPriceModel) GetPriceListBySizeIds(ctx context.Context, sizeIds []int64) (resp []FsProductPrice, err error) { - err = p.db.WithContext(ctx).Model(&FsProductPriceModel{}).Where("`size_id` in (?) and `status` = ? ", sizeIds, 1).Find(&resp).Error + err = p.db.WithContext(ctx).Model(&FsProductPrice{}).Where("`size_id` in (?) and `status` = ? ", sizeIds, 1).Find(&resp).Error if err != nil { return nil, err } diff --git a/model/gmodel/fsproductsizemodel.go b/model/gmodel/fsproductsizemodel.go index d24dca5b..768d34f0 100755 --- a/model/gmodel/fsproductsizemodel.go +++ b/model/gmodel/fsproductsizemodel.go @@ -26,7 +26,7 @@ func NewFsProductSizeModel(db *gorm.DB) *FsProductSizeModel { } func (s *FsProductSizeModel) GetAllByIds(ctx context.Context, ids []int64, sort string) (resp []FsProductSize, err error) { - db := s.db.Model(&FsProductSizeModel{}).Where("`id` in (?) and `status` = ?", ids, 1) + db := s.db.Model(&FsProductSize{}).Where("`id` in (?) and `status` = ?", ids, 1) switch sort { case "sort-asc": db = db.Order("`sort` ASC") @@ -39,14 +39,14 @@ func (s *FsProductSizeModel) GetAllByIds(ctx context.Context, ids []int64, sort return } func (s *FsProductSizeModel) CountByStatus(ctx context.Context, status int) (total int64, err error) { - err = s.db.WithContext(ctx).Model(&FsProductSizeModel{}).Where("`status` = ? ", status).Count(&total).Error + err = s.db.WithContext(ctx).Model(&FsProductSize{}).Where("`status` = ? ", status).Count(&total).Error if err != nil { return 0, err } return } func (s *FsProductSizeModel) GetAllByProductIds(ctx context.Context, productIds []int64, sort string) (resp []FsProductSize, err error) { - db := s.db.WithContext(ctx).Model(&FsProductSizeModel{}).Where("`product_id` in(?) and `status` = ?", productIds, 1) + db := s.db.WithContext(ctx).Model(&FsProductSize{}).Where("`product_id` in(?) and `status` = ?", productIds, 1) switch sort { case "sort-asc": db = db.Order("`sort` ASC") diff --git a/model/gmodel/fsproducttemplatev2model.go b/model/gmodel/fsproducttemplatev2model.go index fafd1f60..ac97e70e 100755 --- a/model/gmodel/fsproducttemplatev2model.go +++ b/model/gmodel/fsproducttemplatev2model.go @@ -31,7 +31,7 @@ func NewFsProductTemplateV2Model(db *gorm.DB) *FsProductTemplateV2Model { return &FsProductTemplateV2Model{db} } func (t *FsProductTemplateV2Model) FindAllByProductIds(ctx context.Context, productIds []int64) (resp []FsProductTemplateV2, err error) { - err = t.db.WithContext(ctx).Model(&FsProductTemplateV2Model{}).Where("`id` in (?) and `is_del` = ? and `status` = ?", productIds, 0, 1).Find(&resp).Error + err = t.db.WithContext(ctx).Model(&FsProductTemplateV2{}).Where("`id` in (?) and `is_del` = ? and `status` = ?", productIds, 0, 1).Find(&resp).Error if err != nil { return nil, err } diff --git a/model/gmodel/fsqrcodesetmodel.go b/model/gmodel/fsqrcodesetmodel.go index defbc420..5a1d37d0 100755 --- a/model/gmodel/fsqrcodesetmodel.go +++ b/model/gmodel/fsqrcodesetmodel.go @@ -28,14 +28,14 @@ func NewFsQrcodeSetModel(db *gorm.DB) *FsQrcodeSetModel { return &FsQrcodeSetModel{db} } func (q *FsQrcodeSetModel) GetAll(ctx context.Context) (resp []FsQrcodeSet, err error) { - err = q.db.WithContext(ctx).Model(&FsQrcodeSetModel{}).Where("`status` = ?", 1).Find(&resp).Error + err = q.db.WithContext(ctx).Model(&FsQrcodeSet{}).Where("`status` = ?", 1).Find(&resp).Error if err != nil { return nil, err } return } func (q *FsQrcodeSetModel) FindOne(ctx context.Context, id int64) (resp FsQrcodeSet, err error) { - err = q.db.WithContext(ctx).Model(&FsQrcodeSetModel{}).Where("`id` = ?", id).First(&resp).Error + err = q.db.WithContext(ctx).Model(&FsQrcodeSet{}).Where("`id` = ?", id).First(&resp).Error if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) { return FsQrcodeSet{}, err } diff --git a/model/gmodel/fsstandardlogomodel.go b/model/gmodel/fsstandardlogomodel.go index c21d6b07..621f8c4b 100755 --- a/model/gmodel/fsstandardlogomodel.go +++ b/model/gmodel/fsstandardlogomodel.go @@ -20,7 +20,7 @@ func NewFsStandardLogoModel(db *gorm.DB) *FsStandardLogoModel { return &FsStandardLogoModel{db} } func (l *FsStandardLogoModel) GetAll(ctx context.Context) (resp []FsStandardLogo, err error) { - err = l.db.WithContext(ctx).Model(&FsStandardLogoModel{}).Where("`status` = ? ", 1).Find(&resp).Error + err = l.db.WithContext(ctx).Model(&FsStandardLogo{}).Where("`status` = ? ", 1).Find(&resp).Error if err != nil { return nil, err } diff --git a/model/gmodel/fstagsmodel.go b/model/gmodel/fstagsmodel.go index 54833221..75ff785c 100755 --- a/model/gmodel/fstagsmodel.go +++ b/model/gmodel/fstagsmodel.go @@ -27,21 +27,21 @@ func NewFsTagsModel(db *gorm.DB) *FsTagsModel { return &FsTagsModel{db} } func (t *FsTagsModel) FindOne(ctx context.Context, id int64) (resp FsTags, err error) { - err = t.db.WithContext(ctx).Model(&FsTagsModel{}).Where("`id` = ? and `status` = ?", id, 1).First(&resp).Error + err = t.db.WithContext(ctx).Model(&FsTags{}).Where("`id` = ? and `status` = ?", id, 1).First(&resp).Error if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) { return FsTags{}, err } return } func (t *FsTagsModel) GetAllByIds(ctx context.Context, ids []int64) (resp []FsTags, err error) { - err = t.db.WithContext(ctx).Model(&FsTagsModel{}).Where("`id` in(?) and `status` = ?", ids, 1).Find(&resp).Error + err = t.db.WithContext(ctx).Model(&FsTags{}).Where("`id` in(?) and `status` = ?", ids, 1).Find(&resp).Error if err != nil { return nil, err } return } func (t *FsTagsModel) GetAllByLevel(ctx context.Context, level int) (resp []FsTags, err error) { - err = t.db.Model(&FsTagsModel{}).Where("`level` = ? and `status` = ?", level, 1).Find(&resp).Error + err = t.db.Model(&FsTags{}).Where("`level` = ? and `status` = ?", level, 1).Find(&resp).Error if err != nil { return nil, err } diff --git a/model/gmodel/fsusermodel.go b/model/gmodel/fsusermodel.go index 688c4a27..8047928e 100755 --- a/model/gmodel/fsusermodel.go +++ b/model/gmodel/fsusermodel.go @@ -43,7 +43,7 @@ func NewFsUserModel(db *gorm.DB) *FsUserModel { } func (u *FsUserModel) FindOne(ctx context.Context, id int64) (resp FsUser, err error) { - err = u.db.WithContext(ctx).Model(&FsUserModel{}).Where("`id` = ? and is_del = ?", id, 0).First(&resp).Error + err = u.db.WithContext(ctx).Model(&FsUser{}).Where("`id` = ? and is_del = ?", id, 0).First(&resp).Error if err != nil && !errors.Is(err, gorm.ErrRecordNotFound) { return FsUser{}, err }