liuxiaolong
2019-08-21 ea5df990ee13cf2ca03b0ee757f2f67c789cb93c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package controllers
 
import (
    "basic.com/dbapi.git"
    "webserver/extend/code"
    "webserver/extend/util"
 
    "github.com/gin-gonic/gin"
)
 
// @Summary 标签列表
// @Description 返回底库标签
// @Accept  json
// @Produce json
// @Tags es
// @Success 200 {string} json "{"code":200, msg:"", success:true}"
// @Failure 500 {string} json "{"code":500, msg:"", success:false}"
// @Router /data/api-v/es/taskList [POST]
func (sc *EsSearchController) PostEsTagList(c *gin.Context) {
 
    var dtApi dbapi.DbTableApi
    var dbpApi dbapi.DbPersonApi
    dts, err := dtApi.FindAllDbTablesByCurServer()
    if err == nil {
        if dts !=nil {
            sources := make([]map[string]interface{}, 0)
            for _, dt := range dts {
                tokenRes := make(map[string]interface{})
                tokenRes["key"] = dt.Id
                tokenRes["title"] = dt.TableName
                tokenRes["value"] = dt.Id
                tokenRes["status"] = dt.IsDelete
                if dt.IsDelete == 1 {
                    personTotal,_ := dbpApi.GetPersonTotal(dt.Id)
                    if personTotal == 0 {
                        continue
                    }
                }
                sources = append(sources, tokenRes)
            }
            util.ResponseFormat(c, code.Success, sources)
            return
        }
    }
    util.ResponseFormat(c,code.ComError,"查询底库标签失败")
}