Browse Source

Merge branch 'feature/eta1.4.3_yongyi_edb' of eta_server/eta_mobile into master

xyxie 1 year ago
parent
commit
8004421b4d

+ 8 - 2
controllers/data_manage/edb_info.go

@@ -1637,7 +1637,13 @@ func (this *EdbInfoController) EdbInfoSearch() {
 				}
 				isAdd = true
 			}
-
+			// 查询基本信息
+			baseIndexInfo, tErr := data_manage.GetBaseIndexInfoByEdbCode(edbCode, source)
+			if tErr == nil {
+				searchItem.EdbName = baseIndexInfo.IndexName
+				searchItem.Frequency = baseIndexInfo.Frequency
+				searchItem.Unit = baseIndexInfo.Unit
+			}
 			// 指标来源于桥接服务: 桥接服务获取指标取频度信息等
 			if sourceItem.BridgeFlag != "" {
 				bridgeOb := data.InitBridgeOB(sourceItem.BridgeFlag)
@@ -5147,4 +5153,4 @@ func (this *EdbInfoController) EdbInfoExistCheck() {
 	br.Success = true
 	br.Msg = "获取成功"
 	br.Data = resp
-}
+}

+ 24 - 0
models/data_manage/edb_data_base.go

@@ -250,3 +250,27 @@ func GetEdbDataTableNameAndSubSource(source, subSource int) (tableName string) {
 	}
 	return
 }
+
+func GetBaseIndexTableName(source int) (tableName string) {
+	edbSource := EdbSourceIdMap[source]
+	if edbSource != nil {
+		tableName = edbSource.IndexTableName
+	}
+	return
+}
+func GetBaseIndexInfoByEdbCode(edbCode string, source int) (item *BaseIndexInfo, err error) {
+	var pars []interface{}
+	pars = append(pars, edbCode)
+	o := orm.NewOrmUsingDB("data")
+
+	tableName := GetBaseIndexTableName(source)
+	if tableName == "" {
+		err = fmt.Errorf("未找到对应的表")
+		return
+	}
+	sql := ` SELECT * FROM %s WHERE index_code=? `
+
+	sql = fmt.Sprintf(sql, tableName)
+	err = o.Raw(sql, pars).QueryRow(&item)
+	return
+}

+ 6 - 0
models/data_manage/edb_info.go

@@ -114,6 +114,12 @@ type EdbInfoSearch struct {
 	StockList []*StockInfo `description:"时序数据"`
 }
 
+type BaseIndexInfo struct {
+	IndexName string `description:"数据日期"`
+	Unit      string `description:"单位"`
+	Frequency string `description:"频率"`
+}
+
 type EdbInfoSearchData struct {
 	DataTime string  `description:"数据日期"`
 	Value    float64 `description:"数据"`

+ 1 - 0
models/data_manage/edb_source.go

@@ -24,6 +24,7 @@ type EdbSource struct {
 	BridgeFlag       string `description:"桥接服务对象标识"`
 	SourceExtend     string `description:"扩展字段做查询用"`
 	EdbCodeRequired  int    `description:"指标编码是否必填: 0-否; 1-是"`
+	IndexTableName   string `description:"数据源指标表名"`
 }
 
 // GetEdbSourceItemsByCondition 获取指标来源