12345678910111213141516171819202122232425262728293031 |
- package models
- import (
- "time"
- "github.com/beego/beego/v2/client/orm"
- )
- type Banner struct {
- BannerId int `orm:"pk" description:"id"`
- ImageUrl string `description:"图片地址"`
- CreateTime time.Time `description:"创建时间"`
- ModifyTime time.Time `description:"修改时间"`
- JumpUrl string `description:"跳转路径"`
- Remake string `description:"备注"`
- ImageUrlPc string `description:"pc端图片地址"`
- }
- func GetBannerList(startSize, pageSize int) (items []*Banner, err error) {
- o := orm.NewOrm()
- sql := `SELECT * FROM banner LIMIT ?,?`
- _, err = o.Raw(sql, startSize, pageSize).QueryRows(&items)
- return
- }
- func GetBannerById(bannerId int) (items *Banner, err error) {
- o := orm.NewOrm()
- sql := `SELECT * FROM banner WHERE banner_id = ?`
- err = o.Raw(sql, bannerId).QueryRow(&items)
- return
- }
|