fix
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
type FsProductTemplateTags struct {
|
||||
Id int64 `gorm:"primary_key;default:0;auto_increment;" json:"id"` // ID
|
||||
Title *string `gorm:"default:'';" json:"title"` // 标题
|
||||
CoverImg *string `gorm:"default:'';" json:"cover_img"` // 封面图
|
||||
Status *int64 `gorm:"default:0;" json:"status"` // 状态 1:可用
|
||||
CreateAt *int64 `gorm:"default:0;" json:"create_at"` // 创建时间
|
||||
}
|
||||
|
||||
@@ -23,3 +23,12 @@ func (pt *FsProductTemplateTagsModel) FindOne(ctx context.Context, id int64, fie
|
||||
err = db.Take(&resp).Error
|
||||
return resp, err
|
||||
}
|
||||
func (pt *FsProductTemplateTagsModel) GetList(ctx context.Context, page, limit int, orderBy string) (resp []FsProductTemplateTags, err error) {
|
||||
db := pt.db.WithContext(ctx).Model(&FsProductTemplateTags{}).Where("`status` = ?", 1)
|
||||
if orderBy != "" {
|
||||
db = db.Order(orderBy)
|
||||
}
|
||||
offset := (page - 1) * limit
|
||||
err = db.Offset(offset).Limit(limit).Find(&resp).Error
|
||||
return resp, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user