liuxiaolong
2020-06-04 0d858e8610a79b15cb337daf134c4a00962dd477
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
47
48
49
50
51
52
53
54
55
package controllers
 
import (
    "basic.com/dbapi.git"
    "github.com/gin-gonic/gin"
    "webserver/extend/code"
    "webserver/extend/util"
)
 
type DictionaryController struct {
}
 
// @Security ApiKeyAuth
// @Summary 根据类型查找字典
// @Description  根据类型查找字典
// @Produce json
// @Tags 字典
// @Param type query string false "字典类型"
// @Success 200 {string} json "{"code":200, success:true, msg:"请求处理成功", data:"成功信息"}"
// @Failure 500 {string} json "{"code":500, success:false, msg:"",data:"错误信息内容"}"
// @Router /data/api-v/dictionary/findByType [get]
func (controller DictionaryController) FindByType(c *gin.Context) {
    var api dbapi.DicApi
    flag, data := api.FindByType("")
    if flag {
        util.ResponseFormat(c, code.Success, data)
    } else {
        util.ResponseFormat(c, code.ComError, data)
    }
}
 
// @Security ApiKeyAuth
// @Summary 根据父ID查找字典
// @Description  根据父ID查找字典
// @Accept x-www-form-urlencoded
// @Produce json
// @Tags 字典
// @Param parentId query string false "parentId"
// @Success 200 {string} json "{"code":200, success:true, msg:"请求处理成功", data:"成功信息"}"
// @Failure 500 {string} json "{"code":500, success:false, msg:"",data:"错误信息内容"}"
// @Router /data/api-v/dictionary/findByParentId [get]
func (controller DictionaryController) FindByParentId(c *gin.Context) {
    parentId := c.Query("parentId")
    if parentId == "" {
        util.ResponseFormat(c, code.RequestParamError, "参数有误")
        return
    }
    var api dbapi.DicApi
    flag, data := api.FindByParentId(parentId)
    if flag {
        util.ResponseFormat(c, code.Success, data)
    } else {
        util.ResponseFormat(c, code.ComError, "查询失败")
    }
}