query.go 764 B

12345678910111213141516171819202122
  1. package user_report_chapter_set
  2. import "hongze/hongze_yb/global"
  3. // GetListByReportId 根据报告ID获取章节列表
  4. func GetUserReportChapterSet(userId uint64) (list []*UserReportChapterSet, err error) {
  5. err = global.MYSQL["rddp"].Model(UserReportChapterSet{}).
  6. Where(" user_id = ? ", userId).
  7. Scan(&list).Error
  8. return
  9. }
  10. func AddUserReportChapterSet(setList []*UserReportChapterSet) (err error) {
  11. err = global.MYSQL["rddp"].Model(UserReportChapterSet{}).CreateInBatches(setList, len(setList)).Error
  12. return
  13. }
  14. func ModifyReportChapterSet(isClose, userId, typeId uint64) (err error) {
  15. sql := ` UPDATE user_report_chapter_set SET is_close=? WHERE user_id=? AND type_id=? `
  16. err = global.MYSQL["rddp"].Exec(sql, isClose, userId, typeId).Error
  17. return
  18. }