You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
487 B
Go
25 lines
487 B
Go
package model
|
|
|
|
import (
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
type Notice struct {
|
|
ID int `json:"id" gorm:"primaryKey" `
|
|
Notice string `json:"notice" gorm:"comment:'公告'"`
|
|
Status int `json:"status" gorm:"comment:'状态'"`
|
|
}
|
|
|
|
func (Notice) TableName() string {
|
|
return "yyz_notice"
|
|
}
|
|
|
|
func GetNotice(db *gorm.DB) ([]Notice, error) {
|
|
notice := []Notice{}
|
|
err := db.Debug().Find(¬ice).Error
|
|
if err != nil && err != gorm.ErrRecordNotFound {
|
|
return notice, err
|
|
}
|
|
return notice, nil
|
|
}
|