123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- package models
- import (
- "time"
- "github.com/beego/beego/v2/client/orm"
- )
- type ChartInfoView struct {
- ChartInfoId int `orm:"column(chart_info_id);pk"`
- ChartName string `description:"来源名称"`
- ChartNameEn string `description:"英文图表名称"`
- Unit string `description:"中文单位名称"`
- UnitEn string `description:"英文单位名称"`
- ChartClassifyId int `description:"图表分类id"`
- ChartClassifyName string `description:"图表名称"`
- SysUserId int
- SysUserRealName string
- UniqueCode string `description:"图表唯一编码"`
- CreateTime time.Time
- ModifyTime time.Time
- DateType int `description:"日期类型:1:00年至今,2:10年至今,3:15年至今,4:年初至今,5:自定义时间"`
- StartDate string `description:"自定义开始日期"`
- EndDate string `description:"自定义结束日期"`
- IsSetName int `description:"设置名称"`
- EdbInfoIds string `description:"指标id"`
- ChartType int `description:"生成样式:1:曲线图,2:季节性图"`
- Calendar string `description:"公历/农历"`
- SeasonStartDate string `description:"季节性图开始日期"`
- SeasonEndDate string `description:"季节性图开始日期"`
- ChartImage string `description:"图表图片"`
- Sort int `description:"排序字段,数字越小越排前面"`
- IsAdd bool `description:"true:已加入我的图库,false:未加入我的图库"`
- MyChartId int
- MyChartClassifyId string `description:"我的图表分类,多个用逗号隔开"`
- ChartClassify []*ChartClassifyView
- EdbEndDate string `description:"指标最新更新日期"`
- XMin string `description:"图表X轴最小值"`
- XMax string `description:"图表X轴最大值"`
- LeftMin string `description:"图表左侧最小值"`
- LeftMax string `description:"图表左侧最大值"`
- RightMin string `description:"图表右侧最小值"`
- RightMax string `description:"图表右侧最大值"`
- Right2Min string `description:"图表右侧最小值"`
- Right2Max string `description:"图表右侧最大值"`
- MinMaxSave int `description:"是否手动保存过上下限:0-否;1-是"`
- IsEdit bool `description:"是否有编辑权限"`
- IsEnChart bool `description:"是否展示英文标识"`
- WarnMsg string `description:"错误信息"`
- Disabled int `description:"是否禁用,0:启用,1:禁用,默认:0"`
- BarConfig string `description:"柱方图的配置,json数据" json:"-"`
- Source int `description:"1:ETA图库;2:商品价格曲线;3:相关性图表"`
- //CorrelationLeadUnit string `description:"相关性图表-领先单位"`
- ExtraConfig string `description:"图表额外配置,json数据"`
- ChartSource string `description:"图表来源str"`
- ChartSourceEn string `description:"图表来源(英文)"`
- Button ChartViewButton `description:"操作按钮"`
- SeasonExtraConfig string `description:"季节性图表中的配置,json数据"`
- StartYear int `description:"当选择的日期类型为最近N年类型时,即date_type=20, 用start_year表示N"`
- ChartThemeId int `description:"图表应用主题ID"`
- ChartThemeStyle string `description:"图表应用主题样式"`
- SourcesFrom string `description:"图表来源"`
- Instructions string `description:"图表说明"`
- MarkersLines string `description:"标识线"`
- MarkersAreas string `description:"标识区"`
- IsJoinPermission int `description:"是否加入权限管控,0:不加入;1:加入;默认:0"`
- HaveOperaAuth bool `description:"是否有数据权限,默认:false"`
- ForumChartInfoId int `description:"社区的图表ID"`
- }
- type ChartClassifyView struct {
- ChartClassifyId int `orm:"column(chart_classify_id);pk"`
- ChartClassifyName string `description:"分类名称"`
- ParentId int `description:"父级id"`
- }
- type ChartViewButton struct {
- IsEdit bool `description:"是否有编辑权限"`
- IsEnChart bool `description:"是否展示英文标识"`
- IsAdd bool `description:"true:已加入我的图库,false:未加入我的图库"`
- IsCopy bool `description:"是否有另存为按钮"`
- IsSetName int `description:"设置名称"`
- }
- func GetChartCount() (count int, err error) {
- o := orm.NewOrmUsingDB("data")
- sql := ` SELECT COUNT(*) AS count FROM chart_info WHERE 1=1 `
- err = o.Raw(sql).QueryRow(&count)
- return
- }
- func GetChartList(startSize, pageSize int) (item []*ChartInfoView, err error) {
- o := orm.NewOrmUsingDB("data")
- sql := ` SELECT * FROM chart_info WHERE 1=1 ORDER BY create_time DESC LIMIT ?,? `
- _, err = o.Raw(sql, startSize, pageSize).QueryRows(&item)
- return
- }
- func GetChartById(chartInfoId int) (item *ChartInfoView, err error) {
- o := orm.NewOrmUsingDB("data")
- sql := ` SELECT * FROM chart_info WHERE chart_info_id=?`
- err = o.Raw(sql, chartInfoId).QueryRow(&item)
- return
- }
- func GetChartByUniqueCode(uniqueCode string) (item *ChartInfoView, err error) {
- o := orm.NewOrmUsingDB("data")
- sql := ` SELECT * FROM chart_info WHERE unique_code=?`
- err = o.Raw(sql, uniqueCode).QueryRow(&item)
- return
- }
|