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

46 lines
1.8 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 AdSort struct {
Id int `json:"id" xorm:"not null pk autoincr comment('主键ID') INT(10)"`
Description string `json:"description" xorm:"not null comment('广告位描述') VARCHAR(255)"`
ItemId int `json:"itemId" xorm:"not null default 0 comment('站点ID') INT(10)"`
CateId int `json:"cateId" xorm:"not null default 0 comment('栏目ID') SMALLINT(5)"`
LocId int `json:"locId" xorm:"not null default 0 comment('广告页面位置') SMALLINT(5)"`
Platform int `json:"platform" xorm:"not null default 1 comment('站点类型1PC网站 2WAP手机站 3微信小程序 4APP移动端') TINYINT(1)"`
Sort int `json:"sort" xorm:"not null default 125 comment('广告位排序') SMALLINT(5)"`
CreateUser int `json:"create_user" xorm:"default 0 comment('添加人') INT(10)"`
CreateTime int64 `json:"create_time" xorm:"default 'NULL' comment('添加时间') DATETIME"`
UpdateUser int `json:"update_user" xorm:"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 *AdSort) Get() (bool, error) {
return utils.XormDb.Get(r)
}
// 插入数据
func (r *AdSort) Insert() (int64, error) {
return utils.XormDb.Insert(r)
}
// 更新数据
func (r *AdSort) Update() (int64, error) {
return utils.XormDb.Id(r.Id).Update(r)
}
// 删除
func (r *AdSort) Delete() (int64, error) {
return utils.XormDb.Id(r.Id).Delete(&AdSort{})
}
// 批量删除
func (r *AdSort) BatchDelete(ids ...int64) (int64, error) {
return utils.XormDb.In("id", ids).Delete(&AdSort{})
}