123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- package excel
- import (
- "github.com/beego/beego/v2/client/orm"
- "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:"创建日期"`
- }
- // GetNoContentExcelInfoAll 获取不含content的表格列表 用于分类展示
- func GetNoContentExcelInfoAll(source, userId int) (items []*ExcelClassifyItems, err error) {
- o := orm.NewOrm()
- sql := ` SELECT excel_info_id,excel_classify_id,excel_name AS excel_classify_name,
- unique_code,sys_user_id,sys_user_real_name
- FROM excel_info where is_delete=0 AND source = ? `
- pars := []interface{}{source}
- if userId > 0 {
- sql += ` AND sys_user_id = ? `
- pars = append(pars, userId)
- }
- sql += ` ORDER BY sort asc,create_time desc `
- _, err = o.Raw(sql, pars...).QueryRows(&items)
- return
- }
- // UpdateExcelInfoClassifyId 更改表格分类
- func UpdateExcelInfoClassifyId(classifyId, excelInfoId int) (err error) {
- o := orm.NewOrm()
- sql := ` update excel_info set excel_classify_id = ? WHERE excel_info_id=? `
- _, err = o.Raw(sql, classifyId, excelInfoId).Exec()
- return
- }
- // GetAllExcelInfoBySource 根据来源获取包含content的表格列表
- func GetAllExcelInfoBySource(source int) (items []*ExcelInfo, err error) {
- o := orm.NewOrm()
- sql := ` SELECT * FROM excel_info where is_delete=0 AND source = ? ORDER BY sort asc,create_time desc `
- _, err = o.Raw(sql, source).QueryRows(&items)
- return
- }
- // TableDataReq 自定义表格请求参数
- type TableDataReq struct {
- EdbInfoIdList []int `description:"指标id列表,从左至右,从上到下的顺序"`
- Sort int `description:"日期排序,1:倒序,2:正序"`
- Data []EdbInfoData `description:"数据列表"`
- TextRowData [][]ManualDataReq `description:"文本列表"`
- }
- // EdbInfoData 自定义表格的数据
- type EdbInfoData struct {
- EdbInfoId int `description:"指标ID"`
- Tag string `description:"标签"`
- EdbName string `description:"指标名称"`
- EdbAliasName string `description:"指标别名"`
- Frequency string `description:"频度"`
- Unit string `description:"单位"`
- Data []ManualDataReq `description:"单元格数据列表"`
- }
- // ManualDataReq 自定义表格的单元格数据
- type ManualDataReq struct {
- DataType int `description:"数据类型,1:普通的,2:插值法,3:手动输入,4:公式计算,5:预测值"`
- DataTime string `description:"所属日期"`
- DataTimeType int `description:"日期类型,1:实际日期;2:未来日期"`
- ShowValue string `description:"展示值"`
- Value string `description:"实际值(计算公式)"`
- RelationEdbInfoList []RelationEdbInfo `description:"关联指标(计算公式中关联的指标,用于计算的时候去匹配)"`
- }
- // RelationEdbInfo 自定义表格中单元格的关联指标
- type RelationEdbInfo struct {
- Tag string `description:"指标标签"`
- Row string `description:"第几行"`
- }
- // MixedTableReq 混合表格保存请求参数
- type MixedTableReq struct {
- CellRelation string `description:"单元格关系"`
- Data [][]MixedTableCellDataReq `description:"混合表格单元格参数"`
- }
- // MixedTableCellDataReq 混合表格单元格参数
- type MixedTableCellDataReq struct {
- Uid string `description:"单元格唯一标识"`
- DataType int `description:"数据类型,1:日期,2:指标,3:自定义文本,4:插值"`
- DataTime string `description:"所属日期"`
- DataTimeType int `description:"日期类型:0:手动输入日期;1:导入系统日期;;3:导入指标日期(指标库的最新日期);"`
- EdbInfoId int `description:"指标id"`
- ShowValue string `description:"展示值"`
- Value string `description:"实际值"`
- }
|