Browse Source

指标引用

xyxie 8 months ago
parent
commit
cf3cdb53cd

+ 3 - 5
controllers/data_manage/edb_info_refresh.go

@@ -668,14 +668,12 @@ func (c *EdbInfoController) SaveRelationEdbRefreshStatus() {
 		br.IsSendEmail = false
 		return
 	}
+	edbType := 1 //基础指标
 	switch req.Source {
 	case utils.DATA_SOURCE_MYSTEEL_CHEMICAL, utils.DATA_SOURCE_WIND: // wind
 	case -1:
 		req.Source = 0
-		req.EdbInfoType = 1
-	case -2:
-		req.Source = 0
-		req.EdbInfoType = 2
+		edbType = 2
 	default:
 		br.Msg = "暂不支持设置其他来源的指标"
 		return
@@ -686,7 +684,7 @@ func (c *EdbInfoController) SaveRelationEdbRefreshStatus() {
 	// 指标id列表
 	if req.IsSelectAll {
 		// 如果是列表全选
-		_, edbList, err := data.GetEdbRelationList(req.Source, req.EdbInfoType, req.ClassifyId, req.SysUserId, req.Frequency, req.Keyword, req.Status, 0, 100000, "", "")
+		_, edbList, err := data.GetEdbRelationList(req.Source, edbType, req.ClassifyId, req.SysUserId, req.Frequency, req.Keyword, req.Status, 0, 100000, "", "")
 		if err != nil && err.Error() != utils.ErrNoRow() {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取数据失败,Err:" + err.Error()

+ 4 - 8
controllers/data_manage/edb_info_relation.go

@@ -39,7 +39,6 @@ func (c *EdbInfoRelationController) RelationEdbList() {
 	}()
 
 	source, _ := c.GetInt("Source")
-	edbInfoType, _ := c.GetInt("EdbInfoType")
 	classifyId := c.GetString("ClassifyId")
 	sysUserId := c.GetString("SysUserId")
 	frequency := c.GetString("Frequency")
@@ -73,17 +72,14 @@ func (c *EdbInfoRelationController) RelationEdbList() {
 	if currentIndex <= 0 {
 		currentIndex = 1
 	}
-	if source == -1 {
-		edbInfoType = 1
-		source = 0
-	}
-	if source == -2 {
-		edbInfoType = 2
+	edbType := 1      //基础指标
+	if source == -1 { //计算指标
+		edbType = 2
 		source = 0
 	}
 	startSize = utils.StartIndex(currentIndex, pageSize)
 
-	total, list, err := data.GetEdbRelationList(source, edbInfoType, classifyId, sysUserId, frequency, keyword, status, startSize, pageSize, sortParam, sortType)
+	total, list, err := data.GetEdbRelationList(source, edbType, classifyId, sysUserId, frequency, keyword, status, startSize, pageSize, sortParam, sortType)
 	if err != nil && err.Error() != utils.ErrNoRow() {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()

+ 4 - 7
services/data/edb_info_relation.go

@@ -339,7 +339,7 @@ func SaveCalendarEdbInfoRelation(chartPermissionId int, matterDate string, editM
 }
 
 // GetEdbRelationList 获取指标引用列表
-func GetEdbRelationList(source, edbInfoType int, classifyId, sysUserId, frequency, keyword, status string, startSize, pageSize int, sortParam, sortType string) (total int, list []*data_manage.BaseRelationEdbInfo, err error) {
+func GetEdbRelationList(source, edbType int, classifyId, sysUserId, frequency, keyword, status string, startSize, pageSize int, sortParam, sortType string) (total int, list []*data_manage.BaseRelationEdbInfo, err error) {
 	var pars []interface{}
 	var condition string
 
@@ -358,12 +358,9 @@ func GetEdbRelationList(source, edbInfoType int, classifyId, sysUserId, frequenc
 		pars = append(pars, source)
 	}
 
-	if edbInfoType == 1 { //预测指标
-		condition += ` AND e.edb_info_type = ? `
-		pars = append(pars, edbInfoType)
-	} else if edbInfoType == 2 { //计算指标
-		condition += ` AND e.edb_type = ? `
-		pars = append(pars, edbInfoType)
+	if edbType == 2 { //计算指标
+		condition += ` AND e.edb_type = ? AND e.edb_info_type = 0`
+		pars = append(pars, edbType)
 	}
 
 	if isStop >= 0 {