Roc il y a 1 an
Parent
commit
c6d95cbf68

+ 1 - 1
models/db.go

@@ -55,7 +55,6 @@ func init() {
 		new(EdbDataInsertConfig),
 		new(EdbAdjustConf), // 数据调整的配置
 		new(BaseFromMysteelChemicalClassify),
-		new(ExcelEdbMapping), //excel与指标的关系表
 	)
 
 	// 注册期货数据 数据表
@@ -111,5 +110,6 @@ func initExcel() {
 	orm.RegisterModel(
 		new(excel.ExcelInfo),
 		new(excel.ExcelClassify),
+		new(excel.ExcelEdbMapping), //excel与指标的关系表
 	)
 }

+ 3 - 2
models/edb_data_calculate_zdyfx.go

@@ -3,6 +3,7 @@ package models
 import (
 	"encoding/json"
 	"errors"
+	"eta/eta_index_lib/models/excel"
 	"eta/eta_index_lib/utils"
 	"fmt"
 	"github.com/beego/beego/v2/client/orm"
@@ -78,7 +79,7 @@ func (obj CustomAnalysis) Add(params AddCalculateBatchParams) (edbInfo *EdbInfo,
 
 	//关联关系
 	{
-		excelEdbMappingItem := new(ExcelEdbMapping)
+		excelEdbMappingItem := new(excel.ExcelEdbMapping)
 		excelEdbMappingItem.CreateTime = time.Now()
 		excelEdbMappingItem.ModifyTime = time.Now()
 		excelEdbMappingItem.ExcelInfoId = customAnalysisData.ExcelInfoId
@@ -142,7 +143,7 @@ func (obj CustomAnalysis) Edit(params EditCalculateBatchParams) (err error, errM
 	// 只有excel的id有传递,同时有数据的情况下,才去做处理
 	if customAnalysisData.ExcelInfoId > 0 && len(customAnalysisData.DateList) > 0 && len(customAnalysisData.DataList) > 0 {
 		//判断计算指标是否被更换
-		excelEdbMapping, tmpErr := GetExcelEdbMappingByEdbInfoId(edbInfo.EdbInfoId)
+		excelEdbMapping, tmpErr := excel.GetExcelEdbMappingByEdbInfoId(edbInfo.EdbInfoId)
 		if tmpErr != nil {
 			err = errors.New("获取excel与指标的关系失败,Err:" + tmpErr.Error())
 			return

+ 9 - 0
models/excel/excel_edb_mapping.go

@@ -46,3 +46,12 @@ type CalculateFormula struct {
 	DateSequenceStr string `json:"DateSequenceStr"`
 	DataSequenceStr string `json:"DataSequenceStr"`
 }
+
+// GetExcelEdbMappingByEdbInfoId 根据指标id获取配置关系
+func GetExcelEdbMappingByEdbInfoId(edbInfoId int) (item *ExcelEdbMapping, err error) {
+	o := orm.NewOrm()
+	sql := ` SELECT *  FROM excel_edb_mapping WHERE 1=1 AND edb_info_id = ? `
+
+	err = o.Raw(sql, edbInfoId).QueryRow(&item)
+	return
+}

+ 0 - 39
models/excel_edb_mapping.go

@@ -1,39 +0,0 @@
-package models
-
-import (
-	"github.com/beego/beego/v2/client/orm"
-	"time"
-)
-
-// ExcelEdbMapping excel与指标的关系表
-type ExcelEdbMapping struct {
-	ExcelEdbMappingId int       `orm:"column(excel_edb_mapping_id);pk"`
-	ExcelInfoId       int       `description:"excel的id"`
-	Source            int       `description:"表格来源,1:excel插件的表格,2:自定义表格,3:混合表格,4:自定义分析,默认:1"`
-	EdbInfoId         int       `description:"计算指标id"`
-	CreateTime        time.Time `description:"创建时间"`
-	ModifyTime        time.Time `description:"修改时间"`
-}
-
-// AddExcelEdbMappingMulti 批量添加excel与指标的关系
-func AddExcelEdbMappingMulti(items []*ExcelEdbMapping) (err error) {
-	o := orm.NewOrm()
-	_, err = o.InsertMulti(len(items), items)
-	return
-}
-
-// Add 添加excel与指标的关系
-func (e *ExcelEdbMapping) Add() (err error) {
-	o := orm.NewOrm()
-	_, err = o.Insert(e)
-	return
-}
-
-// GetExcelEdbMappingByEdbInfoId 根据指标id获取配置关系
-func GetExcelEdbMappingByEdbInfoId(edbInfoId int) (item *ExcelEdbMapping, err error) {
-	o := orm.NewOrm()
-	sql := ` SELECT *  FROM excel_edb_mapping WHERE 1=1 AND edb_info_id = ? `
-
-	err = o.Raw(sql, edbInfoId).QueryRow(&item)
-	return
-}