12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- package models
- import (
- "github.com/beego/beego/v2/client/orm"
- "time"
- )
- type ChartSeries struct {
- ChartSeriesId int `orm:"column(chart_series_id);pk"`
- SeriesName string `description:"系列名称"`
- SeriesNameEn string `description:"系列英文名称"`
- ChartInfoId int `description:"图表ID"`
- ChartStyle string `description:"图表类型"`
- ChartColor string `description:"颜色"`
- ChartWidth int `description:"线条大小"`
- IsPoint int `description:"是否用数据点展示(0 否,1是)"`
- IsNumber int `description:"是否用数值展示(0 否,1是)"`
- IsAxis int `description:"1:左轴,0:右轴"`
- MaxData float64 `description:"上限"`
- MinData float64 `description:"下限"`
- IsOrder bool `description:"true:正序,false:逆序"`
- CreateTime time.Time `description:"创建时间"`
- ModifyTime time.Time `description:"修改时间"`
- }
- func (c *ChartSeries) TableName() string {
- return "chart_series"
- }
- func GetChartSeriesByChartInfoId(chartInfoId int) (items []*ChartSeries, err error) {
- o := orm.NewOrm()
- sql := "SELECT * FROM chart_series WHERE chart_info_id = ?"
- _, err = o.Raw(sql, chartInfoId).QueryRows(&items)
- return
- }
- type ChartSectionSeriesValSortAsc []ChartSectionSeriesValSort
- type ChartSectionSeriesValSortDesc []ChartSectionSeriesValSort
- type ChartSectionSeriesValSort struct {
- Index int
- Value float64
- }
- func (s ChartSectionSeriesValSortAsc) Len() int {
- return len(s)
- }
- func (s ChartSectionSeriesValSortAsc) Less(i, j int) bool {
- return s[i].Value < s[j].Value // 升序排序,如果想要降序则改为 s[i].Value > s[j].Value
- }
- func (s ChartSectionSeriesValSortAsc) Swap(i, j int) {
- s[i], s[j] = s[j], s[i]
- }
- func (s ChartSectionSeriesValSortDesc) Len() int {
- return len(s)
- }
- func (s ChartSectionSeriesValSortDesc) Less(i, j int) bool {
- return s[i].Value > s[j].Value // 升序排序,如果想要降序则改为 s[i].Value > s[j].Value
- }
- func (s ChartSectionSeriesValSortDesc) Swap(i, j int) {
- s[i], s[j] = s[j], s[i]
- }
|