package ficc_report

import (
	"github.com/beego/beego/v2/client/orm"
	"time"
)

// SmartReportResource 智能研报-资源表
type SmartReportResource struct {
	ResourceID int       `gorm:"primaryKey;column:resource_id" json:"-"`
	ImgURL     string    `gorm:"column:img_url" json:"imgUrl"`         // 图片链接
	ImgName    string    `gorm:"column:img_name" json:"imgName"`       // 图片名称
	Type       int       `gorm:"column:type" json:"type"`              // 类型 1-版头 2-版尾
	CreateTime time.Time `gorm:"column:create_time" json:"createTime"` // 创建时间
	Style      string    `gorm:"column:style" json:"style"`            // 版图样式
}

// 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) {
	o := orm.NewOrmUsingDB("rddp")
	sql := `SELECT * FROM smart_report_resource WHERE resource_id = ?  `
	err = o.Raw(sql, resourceId).QueryRow(&item)
	return
}