Browse Source

新增获取指标详情接口

tuoling805 1 year ago
parent
commit
9edc16e628
2 changed files with 36 additions and 0 deletions
  1. 35 0
      controllers/edb_info.go
  2. 1 0
      models/edb_info.go

+ 35 - 0
controllers/edb_info.go

@@ -116,3 +116,38 @@ func (this *EdbInfoController) Add() {
 	br.Msg = "新增成功"
 	br.Data = edbInfo
 }
+
+// @Title 获取基础指标详情
+// @Description 获取基础指标详情
+// @Param	request	body models.EdbInfoDetailReq true "type json string"
+// @Success 200 {object} models.EdbInfo
+// @router /detail [post]
+func (this *EdbInfoController) EdbIndexDetail() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	var req models.EdbInfoDetailReq
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
+	if err != nil {
+		br.Msg = "参数解析异常!"
+		br.ErrMsg = "参数解析失败,Err:" + err.Error()
+		return
+	}
+
+	if req.EdbCode == "" {
+		br.Msg = "请输入指标编码!"
+		return
+	}
+	detail, err := models.GetEdbInfoOnlyByEdbCode(req.EdbCode)
+	if err != nil {
+		br.Msg = "获取数据失败!"
+		br.ErrMsg = "获取数据失败,Err:" + err.Error()
+		return
+	}
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "获取成功"
+	br.Data = detail
+}

+ 1 - 0
models/edb_info.go

@@ -942,6 +942,7 @@ func GetEdbInfoItemByCondition(condition string, pars []interface{}) (item *EdbI
 // EdbInfoDetailReq 指标详情请求
 type EdbInfoDetailReq struct {
 	UniqueCode string `description:"指标唯一编码"`
+	EdbCode    string `description:"指标编码"`
 }
 
 // EdbInfoDetailResp 指标详情返回