Files
easygoadmin/app/model/layout.go
yaoyilin 1b36bd8fbe feat: 初始化项目
初始化项目
2022-10-31 22:29:16 +08:00

45 lines
1.7 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package model
import (
"easygoadmin/utils"
)
type Layout struct {
Id int `json:"id" xorm:"not null pk autoincr comment('主键ID') INT(10)"`
LayoutDescId int `json:"layout_desc_id" xorm:"not null default 0 comment('布局描述ID') INT(10)"`
Type int `json:"type" xorm:"not null default 0 comment('类型1资讯文章') TINYINT(1)"`
TypeId int `json:"type_id" xorm:"not null default 0 comment('对应的类型编号') INT(10)"`
Image string `json:"image" xorm:"not null comment('图片路径') VARCHAR(150)"`
Sort int `json:"sort" xorm:"not null default 125 comment('显示顺序') INT(11)"`
CreateUser int `json:"create_user" xorm:"not null default 0 comment('添加人') INT(10)"`
CreateTime int64 `json:"create_time" xorm:"default 'NULL' comment('添加时间') DATETIME"`
UpdateUser int `json:"update_user" xorm:"not null default 0 comment('更新人') INT(10)"`
UpdateTime int64 `json:"update_time" xorm:"default 'NULL' comment('更新时间') DATETIME"`
Mark int `json:"mark" xorm:"not null default 1 comment('有效标识(1正常 0删除)') TINYINT(1)"`
}
// 根据条件查询单条数据
func (r *Layout) Get() (bool, error) {
return utils.XormDb.Get(r)
}
// 插入数据
func (r *Layout) Insert() (int64, error) {
return utils.XormDb.Insert(r)
}
// 更新数据
func (r *Layout) Update() (int64, error) {
return utils.XormDb.Id(r.Id).Update(r)
}
// 删除
func (r *Layout) Delete() (int64, error) {
return utils.XormDb.Id(r.Id).Delete(&Layout{})
}
// 批量删除
func (r *Layout) BatchDelete(ids ...int64) (int64, error) {
return utils.XormDb.In("id", ids).Delete(&Layout{})
}