query.go 581 B

123456789101112131415
  1. package yb_activity_voice
  2. import "hongze/hongze_yb/global"
  3. // GetVoicesByActivityId 根据活动ID获取录音
  4. func GetVoicesByActivityId(activityId int) (voices []*YbActivityVoice, err error) {
  5. err = global.DEFAULT_MYSQL.Table("yb_activity_voice").Where("activity_id", activityId).Scan(&voices).Error
  6. return
  7. }
  8. // GetVoicesByActivityIds 根据活动IDs获取录音
  9. func GetVoicesByActivityIds(activityIds []int) (voices []*YbActivityVoice, err error) {
  10. err = global.DEFAULT_MYSQL.Model(YbActivityVoice{}).Where("activity_id IN (?)", activityIds).Scan(&voices).Error
  11. return
  12. }