sunty
2019-06-28 88d229d880079db1d31af1d4cbed3b8eb12fd47d
controllers/dictionary.go
@@ -2,13 +2,12 @@
import (
   "basic.com/dbapi.git"
   "github.com/gin-gonic/gin"
   "webserver/extend/code"
   "webserver/extend/util"
   "github.com/gin-gonic/gin"
)
type DictionaryController struct {
}
// @Summary 根据类型查找字典
@@ -23,8 +22,31 @@
   var api dbapi.DicApi
   flag, data := api.FindByType("")
   if flag {
      util.ResponseFormat(c,code.Success,data)
      util.ResponseFormat(c, code.Success, data)
   } else {
      util.ResponseFormat(c,code.ComError,data)
      util.ResponseFormat(c, code.ComError, data)
   }
}
}
// @Summary 根据父ID查找字典
// @Description  根据父ID查找字典
// @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, "查询失败")
   }
}