package data_manage import ( "time" "eta/eta_api/global" "eta/eta_api/utils" ) type ForumChartEdbMapping struct { ID int `gorm:"column:id;primaryKey" description:"主键"` ChartInfoId int EdbInfoIds string CreatedTime time.Time ModifyTime time.Time } // 根据chartInfoId获取edbInfoIds func GetForumEdbInfoIdsByChartInfoId(chartInfoId int) (edbInfoIds string, err error) { o := global.DbMap[utils.DbNameIndex] sql := `SELECT edb_info_ids FROM forum_chart_edb_mapping WHERE chart_info_id = ?` err = o.Raw(sql, chartInfoId).Scan(&edbInfoIds).Error return } // 新增 func AddForumChartEdbMapping(chartInfoId int, edbInfoIds string) (err error) { o := global.DbMap[utils.DbNameIndex] sql := `INSERT INTO forum_chart_edb_mapping (chart_info_id, edb_info_ids, created_time, modify_time) VALUES (?, ?, ?, ?)` err = o.Exec(sql, chartInfoId, edbInfoIds, time.Now(), time.Now()).Error return } // 更新 func UpdateForumChartEdbMapping(chartInfoId int, edbInfoIds string) (err error) { o := global.DbMap[utils.DbNameIndex] sql := `UPDATE forum_chart_edb_mapping SET edb_info_ids = ?, modify_time = ? WHERE chart_info_id = ?` err = o.Exec(sql, edbInfoIds, time.Now(), chartInfoId).Error return } // 删除 func DeleteForumChartEdbMapping(chartInfoId int) (err error) { o := global.DbMap[utils.DbNameIndex] sql := `DELETE FROM forum_chart_edb_mapping WHERE chart_info_id = ?` err = o.Exec(sql, chartInfoId).Error return }