model.go 448 B

12345678910111213141516
  1. package chart_info_future_good_profit
  2. import "hongze/hongze_yb/global"
  3. // GetItemById 主键获取
  4. func (m *ChartInfoFutureGoodProfit) GetItemById(primaryId int) (err error) {
  5. err = global.MYSQL["data"].Model(m).
  6. Where("chart_info_id = ?", primaryId).
  7. First(&m).Error
  8. return
  9. }
  10. func (m *ChartInfoFutureGoodProfit) Update(updateCols []string) (err error) {
  11. err = global.MYSQL["data"].Model(m).Select(updateCols).Updates(*m).Error
  12. return
  13. }