Browse Source

Merge branch 'feature/eta1.4.3_yongyi_edb' into debug

# Conflicts:
#	eta_mobile.exe
xyxie 1 year ago
parent
commit
6358c05c5a

+ 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
-}
+}

+ 2 - 2
controllers/sandbox/sandbox.go

@@ -54,7 +54,7 @@ func (this *SandboxController) ListByQuote() {
 	}
 
 	if keyword != "" {
-		condition += ` AND  ( a.name LIKE '%` + keyword + `%'  OR  b.name LIKE '%` + keyword + `%' OR  a.chart_permission_name LIKE '%` + keyword + `%' )`
+		condition += ` AND  ( a.name LIKE '%` + keyword + `%' OR  a.chart_permission_name LIKE '%` + keyword + `%' )`
 	}
 
 	//获取指标信息
@@ -67,7 +67,7 @@ func (this *SandboxController) ListByQuote() {
 	}
 
 	if list == nil || (err != nil && err.Error() == utils.ErrNoRow()) {
-		list = make([]*sandbox.SandboxListItem, 0)
+		list = make([]*sandbox.Sandbox, 0)
 	}
 
 	page := paging.GetPaging(currentIndex, pageSize, total)

+ 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

@@ -116,6 +116,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 获取指标来源

+ 1 - 1
models/sandbox/response/sandbox.go

@@ -8,5 +8,5 @@ import (
 // SandboxListResp 沙盘列表返回数据
 type SandboxListResp struct {
 	Paging *paging.PagingItem
-	List   []*sandbox.SandboxListItem
+	List   []*sandbox.Sandbox
 }

+ 31 - 15
models/sandbox/sandbox.go

@@ -6,20 +6,36 @@ import (
 )
 
 // Sandbox 沙盘推演主表
+//type Sandbox struct {
+//	SandboxId           int       `orm:"column(sandbox_id);pk" description:"沙盘id"`
+//	Name                string    `description:"沙盘名称"`
+//	ChartPermissionId   int       `description:"品种id"`
+//	ChartPermissionName string    `description:"品种名称"`
+//	CurrVersion         int       `description:"当前版本"`
+//	Code                string    `description:"沙盘code"`
+//	Content             string    `description:"沙盘数据"`
+//	PicUrl              string    `description:"沙盘图片地址"`
+//	OpUserId            int       `description:"最近一次编辑操作的用户id"`
+//	OpUserName          string    `description:"最近一次编辑的用户名称(冗余字段,避免查表)"`
+//	IsDelete            int8      `description:"是否删除,0:未删除,1:已删除"`
+//	ModifyTime          time.Time `description:"修改时间"`
+//	CreateTime          time.Time `description:"创建时间"`
+//}
+
 type Sandbox struct {
-	SandboxId           int       `orm:"column(sandbox_id);pk" description:"沙盘id"`
-	Name                string    `description:"沙盘名称"`
-	ChartPermissionId   int       `description:"品种id"`
-	ChartPermissionName string    `description:"品种名称"`
-	CurrVersion         int       `description:"当前版本"`
-	Code                string    `description:"沙盘code"`
-	Content             string    `description:"沙盘数据"`
-	PicUrl              string    `description:"沙盘图片地址"`
-	OpUserId            int       `description:"最近一次编辑操作的用户id"`
-	OpUserName          string    `description:"最近一次编辑的用户名称(冗余字段,避免查表)"`
-	IsDelete            int8      `description:"是否删除,0:未删除,1:已删除"`
-	ModifyTime          time.Time `description:"修改时间"`
-	CreateTime          time.Time `description:"创建时间"`
+	SandboxId         int       `orm:"column(sandbox_id);pk" description:"沙盘id"`
+	Name              string    `description:"沙盘名称"`
+	Code              string    `description:"沙盘code"`
+	Content           string    `description:"沙盘数据"`
+	MindmapData       string    `description:"思维导图数据"`
+	PicUrl            string    `description:"沙盘图片地址"`
+	SysUserId         int       `description:"作者id"`
+	SysUserName       string    `description:"作者名称"`
+	IsDelete          int8      `description:"是否删除,0:未删除,1:已删除"`
+	ModifyTime        time.Time `description:"修改时间"`
+	CreateTime        time.Time `description:"创建时间"`
+	SandboxClassifyId int       `description:"分类id"`
+	Sort              int       `description:"排序"`
 }
 
 // Update 沙盘字段变更
@@ -51,9 +67,9 @@ type SandboxListItem struct {
 }
 
 // GetList 获取沙盘列表页
-func GetList(condition string, pars []interface{}, startSize, pageSize int) (total int, list []*SandboxListItem, err error) {
+func GetList(condition string, pars []interface{}, startSize, pageSize int) (total int, list []*Sandbox, err error) {
 	o := orm.NewOrmUsingDB("data")
-	sql := "select a.sandbox_id,a.name,a.chart_permission_id,a.chart_permission_name,a.curr_version,a.code,a.pic_url,a.op_user_id,a.op_user_name,a.modify_time,a.create_time,b.version_code from sandbox as a join sandbox_version b on a.sandbox_id=b.sandbox_id and a.curr_version=b.curr_version where 1=1 AND a.is_delete = 0 "
+	sql := "select a.sandbox_id,a.name,a.code,a.pic_url,a.sys_user_id,a.sys_user_name,a.modify_time,a.create_time from sandbox as a where 1=1 AND a.is_delete = 0 "
 	sql += condition
 	sql += ` order by a.modify_time desc,a.sandbox_id desc`