From 88d229d880079db1d31af1d4cbed3b8eb12fd47d Mon Sep 17 00:00:00 2001 From: sunty <1172534965@qq.com> Date: 星期五, 28 六月 2019 14:31:08 +0800 Subject: [PATCH] Merge branch 'master' of http://192.168.1.14:10010/r/webserver --- controllers/dictionary.go | 32 +++++++++++++++++++++++++++----- 1 files changed, 27 insertions(+), 5 deletions(-) diff --git a/controllers/dictionary.go b/controllers/dictionary.go index 4c66dd2..a68bc28 100644 --- a/controllers/dictionary.go +++ b/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) } -} \ No newline at end of file +} + +// @Summary 鏍规嵁鐖禝D鏌ユ壘瀛楀吀 +// @Description 鏍规嵁鐖禝D鏌ユ壘瀛楀吀 +// @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, "鏌ヨ澶辫触") + } +} -- Gitblit v1.8.0