xiziwen 1 日 前
コミット
981365d36c
3 ファイル変更52 行追加10 行削除
  1. 12 0
      controllers/excel_info.go
  2. 29 0
      models/referenced_excel_config.go
  3. 11 10
      models/response/excel_info.go

+ 12 - 0
controllers/excel_info.go

@@ -43,6 +43,9 @@ func (this *ExcelInfoController) GetTableDetail() {
 		return
 	}
 	fromScene, _ := this.GetInt("FromScene", 0)
+	referencedId, _ := this.GetInt("ReferencedId", 0)
+	uuid := this.GetString("Uuid")
+
 	key := utils.HZ_CHART_LIB_EXCEL_TABLE_DETAIL + ":" + uniqueCode
 	resp := new(response.ExcelTableDetailResp)
 	switch fromScene {
@@ -257,6 +260,14 @@ func (this *ExcelInfoController) GetTableDetail() {
 		}
 	}
 
+	// 获取表格引用
+	reference, err := models.GetReferencedExcelConfig(referencedId, fromScene, uniqueCode, uuid)
+	if err != nil && err.Error() != utils.ErrNoRow() {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取表格引用失败,Err:" + err.Error()
+		return
+	}
+
 	resp.TableInfo = tableData
 	resp.Source = excelInfo.Source
 	resp.ExcelType = excelInfo.ExcelType
@@ -265,6 +276,7 @@ func (this *ExcelInfoController) GetTableDetail() {
 	resp.UniqueCode = excelInfo.UniqueCode
 	resp.Config = config
 	resp.SourcesFrom = excelInfo.SourcesFrom
+	resp.ReferencedExcelConfig = reference
 
 	if utils.Re == nil {
 		data, _ := json.Marshal(resp)

+ 29 - 0
models/referenced_excel_config.go

@@ -0,0 +1,29 @@
+package models
+
+import (
+	"github.com/beego/beego/v2/client/orm"
+	"time"
+)
+
+type ReferencedExcelConfig struct {
+	ReferencedExcelConfigId int       `orm:"column(referenced_excel_config_id);pk;auto" ` // excel表格配置id
+	UniqueCode              string    // 表格唯一编码
+	ReferencedId            int       // 被引用的id,报告就是报告id,pptId
+	FromScene               int       // 引用类型 1智能研报 2研报列表 3英文研报 4PPT 5英文ppt
+	Uuid                    string    // 引用唯一标识
+	WidthList               string    // 宽度数组
+	HeightList              string    // 高度数组
+	OpUserId                int       // 当前编辑操作的用户id
+	OpUserName              string    // 当前编辑的用户名称(冗余字段,避免查表)
+	CreateTime              time.Time // 创建时间
+	Content                 string    // 内容
+	ModifyTime              time.Time // 修改时间
+}
+
+// getByCode
+func GetReferencedExcelConfig(referencedId, fromScene int, uniqueCode, uuid string) (item ReferencedExcelConfig, err error) {
+	o := orm.NewOrm()
+	sql := ` SELECT * FROM referenced_excel_config WHERE referenced_id = ? AND from_scene = ? AND uuid = ? AND unique_code = ? `
+	err = o.Raw(sql, referencedId, fromScene, uniqueCode, uuid).QueryRow(&item)
+	return
+}

+ 11 - 10
models/response/excel_info.go

@@ -10,16 +10,17 @@ import (
 // ExcelTableDetailResp  excel表格详情
 type ExcelTableDetailResp struct {
 	//ChartInfo   *ChartInfo
-	UniqueCode    string `description:"表格唯一code"`
-	Source        int    `description:"表格来源,1:excel插件的表格,2:自定义表格,默认:1"`
-	ExcelType     int    `description:"表格类型,1:指标列,2:日期列,默认:1"`
-	ExcelImage    string `description:"表格截图"`
-	ExcelName     string `description:"表格名称"`
-	SourcesFrom   string `description:"图表来源"`
-	ExcelSource   string `description:"表格来源str"`
-	ExcelSourceEn string `description:"表格来源(英文)"`
-	TableInfo     excel.TableData
-	Config        ExcelTableDetailConfigResp
+	UniqueCode            string `description:"表格唯一code"`
+	Source                int    `description:"表格来源,1:excel插件的表格,2:自定义表格,默认:1"`
+	ExcelType             int    `description:"表格类型,1:指标列,2:日期列,默认:1"`
+	ExcelImage            string `description:"表格截图"`
+	ExcelName             string `description:"表格名称"`
+	SourcesFrom           string `description:"图表来源"`
+	ExcelSource           string `description:"表格来源str"`
+	ExcelSourceEn         string `description:"表格来源(英文)"`
+	TableInfo             excel.TableData
+	Config                ExcelTableDetailConfigResp
+	ReferencedExcelConfig models.ReferencedExcelConfig `description:"表格引用信息"`
 }
 
 // ExcelTableDetailConfigResp