package user_report_chapter_set

import "hongze/hongze_yb/global"

// GetListByReportId 根据报告ID获取章节列表
func GetUserReportChapterSet(userId uint64) (list []*UserReportChapterSet, err error) {
	err = global.MYSQL["rddp"].Model(UserReportChapterSet{}).
		Where(" user_id = ? ", userId).
		Scan(&list).Error
	return
}

func AddUserReportChapterSet(setList []*UserReportChapterSet) (err error) {
	err = global.MYSQL["rddp"].Model(UserReportChapterSet{}).CreateInBatches(setList, len(setList)).Error
	return
}

func ModifyReportChapterSet(isClose, userId, typeId uint64) (err error) {
	sql := ` UPDATE user_report_chapter_set SET is_close=? WHERE user_id=? AND type_id=? `
	err = global.MYSQL["rddp"].Exec(sql, isClose, userId, typeId).Error
	return
}
