package models

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

// MeetingProbabilities 加息表格详情表
type MeetingProbabilities struct {
	MeetingInfoId int    `orm:"column(meeting_info_id);pk"`
	DateTime      string // 数据日期
	Content       string // 表格内容
	ExcelImage    string // 表格图片
	IsDelete      int    // 是否删除，0：未删除，1：已删除
	CreateTime    time.Time
	ModifyTime    time.Time
}

// GetMeetingInfoById 根据id 获取加息概率表格详情
func GetMeetingInfoById(dateTime string) (item *MeetingProbabilities, err error) {
	o := orm.NewOrmUsingDB("data")
	sql := ``
	if dateTime == "" {
		sql = ` SELECT * FROM meeting_probabilities WHERE is_delete=0 ORDER BY create_time DESC LIMIT 1 `
		err = o.Raw(sql).QueryRow(&item)
		return
	} else {
		sql = ` SELECT * FROM meeting_probabilities WHERE date_time=? AND is_delete=0 `
		err = o.Raw(sql, dateTime).QueryRow(&item)
		return
	}
}

