fusenapi/model/gmodel/fsstandardlogomodel.go

29 lines
804 B
Go
Raw Normal View History

2023-06-12 08:47:48 +00:00
package gmodel
2023-06-12 09:00:37 +00:00
import (
"context"
"gorm.io/gorm"
)
2023-06-12 06:35:36 +00:00
type FsStandardLogo struct {
Id int64 `gorm:"primary_key" json:"id"` // ID
Name *string `gorm:"default:''" json:"name"` // logo名称
Image *string `gorm:"default:''" json:"image"` // 图片地址
Ctime *int64 `gorm:"default:0" json:"ctime"` // 添加时间
Status *int64 `gorm:"default:1" json:"status"` // 状态 1正常 0删除
2023-06-12 06:05:35 +00:00
}
2023-06-12 08:47:48 +00:00
type FsStandardLogoModel struct {
db *gorm.DB
}
func NewFsStandardLogoModel(db *gorm.DB) *FsStandardLogoModel {
return &FsStandardLogoModel{db}
}
2023-06-12 09:00:37 +00:00
func (l *FsStandardLogoModel) GetAll(ctx context.Context) (resp []FsStandardLogo, err error) {
err = l.db.WithContext(ctx).Model(&FsStandardLogoModel{}).Where("`status` = ? ", 1).Find(&resp).Error
if err != nil {
return nil, err
}
return
}