合并代码

This commit is contained in:
Hiven
2023-07-26 11:09:18 +08:00
20 changed files with 782 additions and 29 deletions

View File

@@ -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"` // 创建时间
}

View File

@@ -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
}