package models

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

type CygxChartAll struct {
	Id            int       `orm:"column(id);pk"`
	ChartId       int       `description:"图表id"`
	PtagId        int       `description:"图表父类分类id"`
	CtagId        int       `description:"图表子类分类id"`
	PtagIdTwo     int       `description:"图表父类分类id"`
	CtagIdTwo     int       `description:"图表子类分类id"`
	Title         string    `description:"标题"`
	TitleEn       string    `description:"英文标题 "`
	CreateDate    string    `description:"本地创建时间"`
	CreateDateApi time.Time `description:"图表创建时间"`
	PublishStatus int       `description:"发布状态"`
	PtagName      string    `description:"父类名称"`
	CtagName      string    `description:"子类名称"`
	Cover         string    `description:"图表图片"`
	Iframe        string    `description:"图表详情跳转地址"`
	PtagNameTwo   string    `description:"父类名称"`
	CtagNameTwo   string    `description:"子类名称"`
}

//获取所有同步过来的图表
func GetChartAllListAll() (items []*HomeChartListResp, err error) {
	o := orm.NewOrm()
	sql := ` SELECT chart_id FROM cygx_chart_all  `
	_, err = o.Raw(sql).QueryRows(&items)
	return
}

//新增图表
func AddCygxChartAll(item *CygxChartAll) (lastId int64, err error) {
	o := orm.NewOrm()
	lastId, err = o.Insert(item)
	return
}
