package ficc_report

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

type ReportChapterType struct {
	ReportChapterTypeId    uint64    `gorm:"primaryKey;column:report_chapter_type_id;type:bigint(20) unsigned;not null" json:"-"` //研究报告章节id
	ReportChapterTypeKey   string    `gorm:"column:report_chapter_type_key;type:varchar(32)" json:"report_chapter_type_key"`      //章节key
	ReportChapterTypeThumb string    `gorm:"column:report_chapter_type_thumb;type:varchar(512)" json:"report_chapter_type_thumb"` //H5展示的图片
	BannerUrl              string    `gorm:"column:banner_url;type:varchar(512)" json:"banner_url"`                               //banner显示图片
	ReportChapterTypeName  string    `gorm:"column:report_chapter_type_name;type:varchar(32)" json:"report_chapter_type_name"`    //报告章节类型名称
	Sort                   int       `gorm:"column:sort;type:int(10);not null;default:0" json:"sort"`                             //排序字段
	Enabled                int       `gorm:"column:enabled;type:tinyint(1)" json:"enabled"`                                       //报告类型状态
	CreatedTime            time.Time `gorm:"column:created_time;type:datetime" json:"created_time"`                               //创建时间
	LastUpdatedTime        time.Time `gorm:"column:last_updated_time;type:datetime" json:"last_updated_time"`                     //更新时间
	ResearchType           string    `gorm:"column:research_type;type:varchar(30)" json:"research_type"`                          //研报类型
	SelectedImage          string    `gorm:"column:selected_image;type:varchar(512)" json:"selected_image"`                       //选中时的图片
	PcSelectedImage        string    `gorm:"column:pc_selected_image;type:varchar(512)" json:"pc_selected_image"`                 //pc选中时的图片
	UnselectedImage        string    `gorm:"column:unselected_image;type:varchar(512)" json:"unselected_image"`                   //没选中时的图片
	PcUnselectedImage      string    `gorm:"column:pc_unselected_image;type:varchar(512)" json:"pc_unselected_image"`             //pc没选中时的图片
	EditImgUrl             string    `gorm:"column:edit_img_url;type:varchar(512)" json:"edit_img_url"`                           //管理后台编辑时选用的图
	TickerTitle            string    `gorm:"column:ticker_title;type:varchar(128)" json:"ticker_title"`                           //指标列的标题
	IsShow                 int       `gorm:"column:is_show;type:tinyint(1);default:1" json:"is_show"`                             //是否显示
	PauseStartTime         time.Time `gorm:"column:pause_start_time;type:datetime" json:"pause_start_time"`                       //暂停开始日期
	PauseEndTime           time.Time `gorm:"column:pause_end_time;type:datetime" json:"pause_end_time"`                           //暂停结束日期
	IsSet                  int       `gorm:"column:is_set;type:tinyint(4);default:0" json:"is_set"`
	YbIconUrl              string    `gorm:"column:yb_icon_url;type:varchar(255) json:"yb_icon_url"`       //研报小程序3.0图标
	YbBottomIcon           string    `gorm:"column:yb_bottom_icon;type:varchar(255) json:"yb_bottom_icon"` //研报小程序3.0底部菜单图标
}

func GetEffectTypes() (items []*ReportChapterType, err error) {
	o := orm.NewOrmUsingDB("rddp")
	sql := `SELECT *  FROM  report_chapter_type	WHERE is_show=1 AND enabled = 1  `
	_, err = o.Raw(sql).QueryRows(&items)
	return
}
