package excel import ( "fmt" "github.com/beego/beego/v2/client/orm" "strings" "time" ) // ExcelInfo excel表格详情表 type ExcelInfo struct { ExcelInfoId int `orm:"column(excel_info_id);pk"` Source int `description:"表格来源,1:excel插件的表格,2:自定义表格,3:混合表格,4:自定义分析,默认:1"` ExcelType int `description:"表格类型,1:指标列,2:日期列,默认:1"` ExcelName string `description:"表格名称"` UniqueCode string `description:"表格唯一编码"` ExcelClassifyId int `description:"表格分类id"` SysUserId int `description:"操作人id"` SysUserRealName string `description:"操作人真实姓名"` Content string `description:"表格内容"` ExcelImage string `description:"表格图片"` FileUrl string `description:"表格下载地址"` Sort int `description:"排序字段,数字越小越排前面"` IsDelete int `description:"是否删除,0:未删除,1:已删除"` ModifyTime time.Time `description:"最近修改日期"` CreateTime time.Time `description:"创建日期"` IsJoinPermission int `description:"是否加入权限管控,0:不加入;1:加入;默认:0"` ParentId int `description:"表格的父级id"` BalanceType int `description:"平衡表类型:0 动态表,1静态表"` UpdateUserId int `description:"更新人id"` UpdateUserRealName string `description:"更新人真实姓名"` RelExcelInfoId int `description:"平衡表里静态表关联的动态表excel id"` VersionName string `description:"静态表版本名称"` SourcesFrom string `description:"图表来源"` ExtraConfig string `description:"额外配置:如多空分析、相关性表格参数"` } func (m *ExcelInfo) TableName() string { return "excel_info" } func (m *ExcelInfo) GetItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*ExcelInfo, err error) { o := orm.NewOrmUsingDB("data") fields := strings.Join(fieldArr, ",") if len(fieldArr) == 0 { fields = `*` } order := `ORDER BY create_time DESC` if orderRule != "" { order = ` ORDER BY ` + orderRule } sql := fmt.Sprintf(`SELECT %s FROM %s WHERE 1=1 %s %s`, fields, m.TableName(), condition, order) _, err = o.Raw(sql, pars).QueryRows(&items) return }