Merge branch 'develop' of https://gitee.com/fusenpack/fusenapi into develop

This commit is contained in:
eson
2023-06-20 16:47:14 +08:00
15 changed files with 787 additions and 126 deletions

View File

@@ -3,7 +3,7 @@ package gmodel
import "context"
func (ml *FsMapLibraryModel) GetAllEnabledList(ctx context.Context, fields string) (resp []FsMapLibrary, err error) {
db := ml.db.WithContext(ctx).Model(&FsMapLibrary{}).Where("`status` = ?", 0)
db := ml.db.WithContext(ctx).Model(&FsMapLibrary{}).Where("`status` = ?", 1)
if fields != "" {
db = db.Select(fields)
}
@@ -14,14 +14,14 @@ func (ml *FsMapLibraryModel) GetAllEnabledList(ctx context.Context, fields strin
return
}
func (ml *FsMapLibraryModel) Create(ctx context.Context, data *FsMapLibrary) error {
return ml.db.WithContext(ctx).Create(data).Error
return ml.db.WithContext(ctx).Model(&FsMapLibrary{}).Create(data).Error
}
func (ml *FsMapLibraryModel) Update(ctx context.Context, id int64, data *FsMapLibrary) error {
return ml.db.WithContext(ctx).Where("`id` = ? ", id).Updates(data).Error
return ml.db.WithContext(ctx).Model(&FsMapLibrary{}).Where("`id` = ? ", id).Updates(data).Error
}
func (ml *FsMapLibraryModel) ChangeStatusByIds(ctx context.Context, ids []int64, status int64) error {
if len(ids) == 0 {
return nil
}
return ml.db.WithContext(ctx).Where("`id` in (?) ", ids).Update("status", 0).Error
return ml.db.WithContext(ctx).Model(&FsMapLibrary{}).Where("`id` in (?) ", ids).Update("status", 0).Error
}