Bladeren bron

fix:统计特征添加图表

zqbao 5 maanden geleden
bovenliggende
commit
9ccc45865b
2 gewijzigde bestanden met toevoegingen van 7 en 6 verwijderingen
  1. 4 4
      controllers/data_manage/line_feature/chart_info.go
  2. 3 2
      models/data_manage/edb_info_relation.go

+ 4 - 4
controllers/data_manage/line_feature/chart_info.go

@@ -14,10 +14,11 @@ import (
 	lineFeatureServ "eta_gn/eta_api/services/data/line_feature"
 	"eta_gn/eta_api/utils"
 	"fmt"
-	"github.com/rdlucklib/rdluck_tools/paging"
 	"strconv"
 	"strings"
 	"time"
+
+	"github.com/rdlucklib/rdluck_tools/paging"
 )
 
 // LineFeaturesChartInfoController 统计特征图表管理
@@ -558,10 +559,9 @@ func (this *LineFeaturesChartInfoController) MultipleGraphConfigSaveChart() {
 		return
 	}
 
-	err = nil
 	var isAdd bool
 	var chartInfoId int
-	if multipleGraphConfigChartMapping == nil {
+	if multipleGraphConfigChartMapping == nil || utils.IsErrNoRow(err) {
 		isAdd = true
 	} else {
 		chartInfo, err := data_manage.GetChartInfoById(multipleGraphConfigChartMapping.ChartInfoId)
@@ -571,7 +571,7 @@ func (this *LineFeaturesChartInfoController) MultipleGraphConfigSaveChart() {
 			return
 		}
 		// 说明图还在,没有被删除
-		if chartInfo != nil {
+		if chartInfo != nil && chartInfo.ChartInfoId > 0 {
 			chartInfoId = multipleGraphConfigChartMapping.ChartInfoId
 			req.ChartName = chartInfo.ChartName
 			req.ClassifyId = chartInfo.ChartClassifyId

+ 3 - 2
models/data_manage/edb_info_relation.go

@@ -3,8 +3,9 @@ package data_manage
 import (
 	"eta_gn/eta_api/global"
 	"eta_gn/eta_api/utils"
-	"github.com/rdlucklib/rdluck_tools/paging"
 	"time"
+
+	"github.com/rdlucklib/rdluck_tools/paging"
 )
 
 type EdbInfoRelation struct {
@@ -42,7 +43,7 @@ func GetEdbInfoRelationByRelationIds(ids []int) (items []*EdbInfoRelation, err e
 // GetEdbInfoRelationByReferObjectId 查询直接引用的指标ID
 func GetEdbInfoRelationByReferObjectId(referObjectId int, referObjectType int) (items []*EdbInfoRelation, err error) {
 	o := global.DmSQL["data"]
-	msql := ` SELECT * FROM edb_info_relation WHERE refer_object_id =? and relation_type=0 AND refer_object_type=?  GROUP BY edb_info_id `
+	msql := ` SELECT * FROM edb_info_relation WHERE refer_object_id =? and relation_type=0 AND refer_object_type=?  GROUP BY edb_info_id,edb_info_relation_id, source, edb_name, edb_code, refer_object_id, refer_object_type, refer_object_sub_type,create_time,modify_time,relation_time,relation_type, root_edb_info_id, child_edb_info_id,relation_code,parent_relation_id `
 	err = o.Raw(msql, referObjectId, referObjectType).Find(&items).Error
 
 	return