package bi_dashboard import ( "eta_gn/eta_api/global" "time" ) type BiDashboardDetail struct { BiDashboardDetailId int `gorm:"primaryKey;autoIncrement;column:bi_dashboard_detail_id" ` // bi看板id BiDashboardId int `gorm:"column:bi_dashboard_id" ` // 看板id Type int `gorm:"column:type" ` // 1图表 2表格 UniqueCode string `gorm:"column:unique_code;size:32;not null" ` // 报告唯一编码 Sort int `gorm:"column:sort" ` // 排序字段 CreateTime time.Time `gorm:"column:create_time" ` // 创建时间 ModifyTime time.Time `gorm:"column:modify_time" ` // 更新时间 } // tableName func (m *BiDashboardDetail) TableName() string { return "bi_dashboard_detail" } func GetBiDashboardDetailById(id int) (list []*BiDashboardDetail, err error) { err = global.DEFAULT_DmSQL.Table("bi_dashboard_detail").Where("bi_dashboard_id IN ?", id).Find(&list).Error return } // multiAdd func AddBiDashboardDetailMulti(items []*BiDashboardDetail) (err error) { return global.DEFAULT_DmSQL.CreateInBatches(items, 100).Error } // del func DeleteBiDashboardDetail(id int) (err error) { return global.DEFAULT_DmSQL.Where("bi_dashboard_id = ?", id).Delete(&BiDashboardDetail{}).Error } type MoveDashboardDetailReq struct { BiDashboardId int `description:"看板id"` BiDashboardDetailId int `description:"看板详情id"` Sort int `description:"排序"` OtherDetailId int `description:"交换的详情id"` OtherSort int `description:"交换的排序"` } // update func EditBiDashboardDetail(item *BiDashboardDetail) (err error) { return global.DEFAULT_DmSQL.Model(item).Where("bi_dashboard_detail_id = ?", item.BiDashboardDetailId).Updates(item).Error } type DelDashboardDetailReq struct { BiDashboardDetailId int `description:"看板详情id"` } // del func DeleteBiDashboardDetailByDetailId(id int) (err error) { return global.DEFAULT_DmSQL.Where("bi_dashboard_detail_id = ?", id).Delete(&BiDashboardDetail{}).Error }