| | |
| | | |
| | | import ( |
| | | "basic.com/dbapi.git" |
| | | "github.com/gin-gonic/gin" |
| | | "webserver/extend/code" |
| | | "webserver/extend/util" |
| | | "github.com/gin-gonic/gin" |
| | | ) |
| | | |
| | | type DictionaryController struct { |
| | | |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 根据类型查找字典 |
| | | // @Description 根据类型查找字典 |
| | | // @Produce json |
| | |
| | | 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) |
| | | } |
| | | } |
| | | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 根据父ID查找字典 |
| | | // @Description 根据父ID查找字典 |
| | | // @Accept x-www-form-urlencoded |
| | | // @Produce json |
| | | // @Tags 字典 |
| | | // @Param parentId query string false "parentId" |
| | |
| | | func (controller DictionaryController) FindByParentId(c *gin.Context) { |
| | | parentId := c.Query("parentId") |
| | | if parentId == "" { |
| | | util.ResponseFormat(c,code.RequestParamError,"参数有误") |
| | | util.ResponseFormat(c, code.RequestParamError, "参数有误") |
| | | return |
| | | } |
| | | var api dbapi.DicApi |
| | | flag, data := api.FindByParentId(parentId) |
| | | if flag { |
| | | util.ResponseFormat(c,code.Success,data) |
| | | util.ResponseFormat(c, code.Success, data) |
| | | } else { |
| | | util.ResponseFormat(c,code.ComError,"查询失败") |
| | | util.ResponseFormat(c, code.ComError, "查询失败") |
| | | } |
| | | } |
| | | } |