package voice_broadcast_img

import "hongze/hongze_yb/global"

// GetVoiceImgListByVoiceIds 通过语音播报IDs获取图片列表
func GetVoiceImgListByVoiceIds(idArr []int) (list []*YbVoiceBroadcastImg, err error) {
	if len(idArr) == 0 {
		return
	}
	err = global.DEFAULT_MYSQL.
		Model(YbVoiceBroadcastImg{}).
		Select("broadcast_id, img_url").
		Where("broadcast_id IN ?", idArr).
		Order("broadcast_id ASC, create_time ASC").
		Scan(&list).Error
	return
}

// GetVoiceImgListByVoiceId 通过语音播报ID获取图片列表
func GetVoiceImgListByVoiceId(voiceId int) (list []*YbVoiceBroadcastImg, err error) {
	err = global.DEFAULT_MYSQL.
		Model(YbVoiceBroadcastImg{}).
		Select("broadcast_id, img_url").
		Where("broadcast_id = ?", voiceId).
		Scan(&list).Error
	return
}
