浏览代码

Merge branch 'feature/eta1.1.0_edb_classify' into debug

# Conflicts:
#	models/data_manage/response/predit_edb_info.go
xyxie 1 年之前
父节点
当前提交
fa30727bc8

+ 4 - 6
controllers/data_manage/predict_edb_info.go

@@ -1349,19 +1349,17 @@ func (this *PredictEdbInfoController) DataList() {
 		br.ErrMsg = "获取失败,Err:" + err.Error()
 		return
 	}
-	fullEdb := new(data_manage.EdbInfoFullClassify)
 	classifyList, err, errMsg := data.GetFullClassifyByClassifyId(edbInfo.ClassifyId)
 	if err != nil {
 		br.Msg = err.Error()
 		br.ErrMsg = errMsg
 		return
 	}
-	fullEdb.EdbInfo = edbInfo
-	fullEdb.ClassifyList = classifyList
 	resp := response.PredictEdbInfoDataResp{
-		EdbInfo:  fullEdb,
-		DataList: resultDataList,
-		Button:   button,
+		EdbInfo:      edbInfo,
+		DataList:     resultDataList,
+		Button:       button,
+		ClassifyList: classifyList,
 	}
 	br.Ret = 200
 	br.Success = true

+ 4 - 3
models/data_manage/response/predit_edb_info.go

@@ -19,9 +19,10 @@ type PredictEdbInfoListResp struct {
 
 // PredictEdbInfoDataResp 预测指标数据返回
 type PredictEdbInfoDataResp struct {
-	EdbInfo  *data_manage.EdbInfoFullClassify
-	Button   data_manage.EdbClassifyItemsButton
-	DataList interface{}
+	EdbInfo      *data_manage.EdbInfo
+	Button       data_manage.EdbClassifyItemsButton
+	DataList     interface{}
+	ClassifyList []*data_manage.EdbClassifyIdItems `description:"父级分类列表"`
 }
 
 // PredictEdbInfo 预测指标详情

+ 13 - 9
services/data/edb_classify.go

@@ -215,16 +215,20 @@ func AddEdbClassify(classifyName string, parentId, level int, classifyType uint8
 		return
 	}
 	//查询顶级rootId
-	parentClassify, err := data_manage.GetEdbClassifyById(parentId)
-	if err != nil {
-		if err.Error() == utils.ErrNoRow() {
-			errMsg = "父级分类不存在"
-			err = errors.New(errMsg)
+	rootId := 0
+	if parentId > 0 {
+		parentClassify, err := data_manage.GetEdbClassifyById(parentId)
+		if err != nil {
+			if err.Error() == utils.ErrNoRow() {
+				errMsg = "父级分类不存在"
+				err = errors.New(errMsg)
+				return
+			}
+			errMsg = "获取失败"
+			err = errors.New("获取分类信息失败,Err:" + err.Error())
 			return
 		}
-		errMsg = "获取失败"
-		err = errors.New("获取分类信息失败,Err:" + err.Error())
-		return
+		rootId = parentClassify.RootId
 	}
 
 	timestamp := strconv.FormatInt(time.Now().UnixNano(), 10)
@@ -233,7 +237,7 @@ func AddEdbClassify(classifyName string, parentId, level int, classifyType uint8
 		ClassifyType:    classifyType,
 		ClassifyName:    classifyName,
 		ParentId:        parentId,
-		RootId:          parentClassify.RootId,
+		RootId:          rootId,
 		HasData:         0,
 		CreateTime:      time.Now(),
 		ModifyTime:      time.Now(),