fix:Invalid post search criteria

This commit is contained in:
zhangwenjian
2020-07-11 06:29:07 +08:00
parent 4f7e22a6f2
commit 2195c7a944
2 changed files with 14 additions and 8 deletions
+11 -8
View File
@@ -10,9 +10,10 @@ import (
// @Summary 职位列表数据
// @Description 获取JSON
// @Tags 职位
// @Param name query string false "name"
// @Param id query string false "id"
// @Param position query string false "position"
// @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,11 +31,13 @@ func GetPostList(c *gin.Context) {
pageIndex = tools.StrToInt(err, index)
}
data.PostName = c.Request.FormValue("postName")
id := c.Request.FormValue("postId")
data.PostId, _ = tools.StringToInt(id)
data.PostCode = c.Request.FormValue("postCode")
data.PostName = c.Request.FormValue("postName")
data.Status = c.Request.FormValue("status")
data.DataScope = tools.GetUserIdStr(c)
result, count, err := data.GetPage(pageSize, pageIndex)
tools.HasError(err, "", -1)
@@ -53,7 +56,7 @@ func GetPost(c *gin.Context) {
Post.PostId, _ = tools.StringToInt(c.Param("postId"))
result, err := Post.Get()
tools.HasError(err, "抱歉未找到相关信息", -1)
app.OK(c,result,"")
app.OK(c, result, "")
}
// @Summary 添加职位
@@ -73,7 +76,7 @@ func InsertPost(c *gin.Context) {
tools.HasError(err, "", 500)
result, err := data.Create()
tools.HasError(err, "", -1)
app.OK(c,result,"")
app.OK(c, result, "")
}
// @Summary 修改职位
@@ -94,7 +97,7 @@ func UpdatePost(c *gin.Context) {
tools.HasError(err, "", -1)
result, err := data.Update(data.PostId)
tools.HasError(err, "", -1)
app.OK(c,result,"修改成功")
app.OK(c, result, "修改成功")
}
// @Summary 删除职位
@@ -110,5 +113,5 @@ func DeletePost(c *gin.Context) {
IDS := tools.IdsStrToIdsIntGroup("postId", c)
result, err := data.BatchDelete(IDS)
tools.HasError(err, "删除失败", 500)
app.OK(c,result,"删除成功")
app.OK(c, result, "删除成功")
}