model.go 780 B

123456789101112131415161718192021222324252627
  1. package voice_broadcast_img
  2. import "hongze/hongze_yb/global"
  3. // GetVoiceImgListByVoiceIds 通过语音播报IDs获取图片列表
  4. func GetVoiceImgListByVoiceIds(idArr []int) (list []*YbVoiceBroadcastImg, err error) {
  5. if len(idArr) == 0 {
  6. return
  7. }
  8. err = global.DEFAULT_MYSQL.
  9. Model(YbVoiceBroadcastImg{}).
  10. Select("broadcast_id, img_url").
  11. Where("broadcast_id IN ?", idArr).
  12. Order("broadcast_id ASC, create_time ASC").
  13. Scan(&list).Error
  14. return
  15. }
  16. // GetVoiceImgListByVoiceId 通过语音播报ID获取图片列表
  17. func GetVoiceImgListByVoiceId(voiceId int) (list []*YbVoiceBroadcastImg, err error) {
  18. err = global.DEFAULT_MYSQL.
  19. Model(YbVoiceBroadcastImg{}).
  20. Select("broadcast_id, img_url").
  21. Where("broadcast_id = ?", voiceId).
  22. Scan(&list).Error
  23. return
  24. }