package smart_report_resource

import (
	"hongze/hongze_yb/global"
)

// GetResourceItemById
// @Description: 根据资源id获取信息
// @author: Roc
// @datetime 2024-06-21 16:59:23
// @param resourceId int
// @return item *SmartReportResource
// @return err error
func GetResourceItemById(resourceId int) (item *SmartReportResource, err error) {
	err = global.MYSQL["rddp"].Model(SmartReportResource{}).
		Select("*").
		Where("resource_id = ? ", resourceId).First(&item).Error
	return
}

// GetResourceItemListByIdList
// @Description: 根据资源id列表获取信息列表
// @author: Roc
// @datetime 2024-06-21 17:00:31
// @param resourceIdList []int
// @return items []*SmartReportResource
// @return err error
func GetResourceItemListByIdList(resourceIdList []int) (items []*SmartReportResource, err error) {
	err = global.MYSQL["rddp"].Model(SmartReportResource{}).
		Select("*").
		Where("resource_id in (?) ", resourceIdList).Find(&items).Error
	return
}