diff --git a/apis/system/post.go b/apis/system/post.go index 20350f33..3f3c0a9a 100644 --- a/apis/system/post.go +++ b/apis/system/post.go @@ -7,12 +7,13 @@ import ( "go-admin/tools/app" ) -// @Summary 职位列表数据 +// @Summary 岗位列表数据 // @Description 获取JSON -// @Tags 职位 -// @Param name query string false "name" -// @Param id query string false "id" -// @Param position query string false "position" +// @Tags 岗位 +// @Param postName query string false "postName" +// @Param postCode query string false "postCode" +// @Param postId query string false "postId" +// @Param status query string false "status" // @Success 200 {object} app.Response "{"code": 200, "data": [...]}" // @Router /api/v1/post [get] // @Security @@ -30,7 +31,7 @@ func GetPostList(c *gin.Context) { pageIndex = tools.StrToInt(err, index) } - data.PostName = c.Request.FormValue("postName") + data.PostCode = c.Request.FormValue("postCode") id := c.Request.FormValue("postId") data.PostId, _ = tools.StringToInt(id) @@ -41,9 +42,9 @@ func GetPostList(c *gin.Context) { app.PageOK(c, result, count, pageIndex, pageSize, "") } -// @Summary 获取字典数据 +// @Summary 获取岗位信息 // @Description 获取JSON -// @Tags 字典数据 +// @Tags 岗位 // @Param postId path int true "postId" // @Success 200 {object} app.Response "{"code": 200, "data": [...]}" // @Router /api/v1/post/{postId} [get] @@ -56,9 +57,9 @@ func GetPost(c *gin.Context) { app.OK(c,result,"") } -// @Summary 添加职位 +// @Summary 添加岗位 // @Description 获取JSON -// @Tags 职位 +// @Tags 岗位 // @Accept application/json // @Product application/json // @Param data body models.Post true "data" @@ -76,9 +77,9 @@ func InsertPost(c *gin.Context) { app.OK(c,result,"") } -// @Summary 修改职位 +// @Summary 修改岗位 // @Description 获取JSON -// @Tags 职位 +// @Tags 岗位 // @Accept application/json // @Product application/json // @Param data body models.Dept true "body" @@ -97,9 +98,9 @@ func UpdatePost(c *gin.Context) { app.OK(c,result,"修改成功") } -// @Summary 删除职位 +// @Summary 删除岗位 // @Description 删除数据 -// @Tags 职位 +// @Tags 岗位 // @Param id path int true "id" // @Success 200 {string} string "{"code": 200, "message": "删除成功"}" // @Success 200 {string} string "{"code": -1, "message": "删除失败"}" diff --git a/models/post.go b/models/post.go index c59ad376..426bb78e 100644 --- a/models/post.go +++ b/models/post.go @@ -90,6 +90,9 @@ func (e *Post) GetPage(pageSize int, pageIndex int) ([]Post, int, error) { if e.PostName != "" { table = table.Where("post_name = ?", e.PostName) } + if e.PostCode != "" { + table = table.Where("post_code = ?", e.PostCode) + } if e.Status != "" { table = table.Where("status = ?", e.Status) }