fix
This commit is contained in:
31
model/gmodel/fsmaplibrarymodel.go
Executable file
31
model/gmodel/fsmaplibrarymodel.go
Executable file
@@ -0,0 +1,31 @@
|
||||
package gmodel
|
||||
|
||||
import (
|
||||
"context"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type FsMapLibrary struct {
|
||||
Id int64 `gorm:"primary_key" json:"id"` // Id
|
||||
Title *string `gorm:"default:''" json:"title"` // 名称
|
||||
Info *string `gorm:"default:''" json:"info"` // 贴图数据
|
||||
Sort *int64 `gorm:"default:0" json:"sort"` // 排序
|
||||
Status *int64 `gorm:"default:1" json:"status"` // 状态 1启用 0未启用
|
||||
Ctime *int64 `gorm:"default:0" json:"ctime"` // 创建时间
|
||||
TagId *int64 `gorm:"default:0" json:"tag_id"` // 模板标签id
|
||||
}
|
||||
type FsMapLibraryModel struct {
|
||||
db *gorm.DB
|
||||
}
|
||||
|
||||
func NewFsMapLibraryModel(db *gorm.DB) *FsMapLibraryModel {
|
||||
return &FsMapLibraryModel{db}
|
||||
}
|
||||
|
||||
func (ml *FsMapLibraryModel) GetAllEnabledList(ctx context.Context) (resp []FsMapLibrary, err error) {
|
||||
err = ml.db.WithContext(ctx).Model(&FsMapLibrary{}).Where("`status` = ?", 1).Find(&resp).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -1,6 +1,9 @@
|
||||
package gmodel
|
||||
|
||||
import "gorm.io/gorm"
|
||||
import (
|
||||
"context"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type FsProductTemplateTags struct {
|
||||
Id int64 `gorm:"primary_key" json:"id"` // ID
|
||||
@@ -15,3 +18,14 @@ type FsProductTemplateTagsModel struct {
|
||||
func NewFsProductTemplateTagsModel(db *gorm.DB) *FsProductTemplateTagsModel {
|
||||
return &FsProductTemplateTagsModel{db}
|
||||
}
|
||||
|
||||
func (pt *FsProductTemplateTagsModel) GetListByIds(ctx context.Context, ids []int64) (resp []FsProductTemplateTags, err error) {
|
||||
if len(ids) == 0 {
|
||||
return
|
||||
}
|
||||
err = pt.db.WithContext(ctx).Model(&FsProductTemplateTags{}).Where("`id` in (?)", ids).Find(&resp).Error
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user