12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- package bi_dashboard
- import (
- "github.com/beego/beego/v2/client/orm"
- "time"
- )
- type BiDashboardHomePage struct {
- BiDashboardHomePageId int `orm:"column(bi_dashboard_home_page_id);pk"`
- BiDashboardId int `gorm:"type:int(10);default:null;comment:'看板id'"`
- AdminId int `gorm:"type:int(10);default:null;"`
- CreateTime time.Time `gorm:"type:datetime;comment:'创建时间'"`
- ModifyTime time.Time `gorm:"type:datetime;comment:'更新时间'"`
- FromType int `gorm:"type:int(10);default:null;comment:'来源,前端跳转用 1我的 2共享 3公共"`
- }
- // tableName
- func (m *BiDashboardHomePage) TableName() string {
- return "bi_dashboard_home_page"
- }
- // get
- func GetBiDashboardHomePageById(id int) (item *BiDashboardHomePage, err error) {
- sql := ` SELECT a.* FROM bi_dashboard_home_page AS a INNER JOIN bi_dashboard AS b
- ON a.bi_dashboard_id = b.bi_dashboard_id WHERE a.admin_id = ? `
- o := orm.NewOrm()
- err = o.Raw(sql, id).QueryRow(&item)
- return
- }
- // save
- func SaveBiDashboardHomePage(item *BiDashboardHomePage) (err error) {
- //return global.DEFAULT_DmSQL.Save(item).Error
- o := orm.NewOrm()
- if item.BiDashboardHomePageId > 0 {
- _, err = o.Raw("UPDATE bi_dashboard_home_page SET bi_dashboard_id=?,modify_time=? WHERE bi_dashboard_home_page_id=?", item.BiDashboardId, item.ModifyTime, item.BiDashboardHomePageId).Exec()
- } else {
- _, err = o.Insert(item)
- }
- return
- }
- type SaveHomePageReq struct {
- BiDashboardId int `description:"看板id"`
- FromType int `description:"来源,前端跳转用 1我的 2共享 3公共"`
- }
|