Merge pull request #154 from wenjianzhang/v1
fix: Invalid job search criteria
This commit is contained in:
3 files changed
+15
-9
No files matched your search
+11
-8
@@ -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, "删除成功")
|
||||
}
|
||||
@@ -34,7 +34,7 @@ func GetSysUserList(c *gin.Context) {
|
||||
pageIndex = tools.StrToInt(err, index)
|
||||
}
|
||||
|
||||
data.Username = c.Request.FormValue("userName")
|
||||
data.Username = c.Request.FormValue("username")
|
||||
data.Status = c.Request.FormValue("status")
|
||||
data.Phone = c.Request.FormValue("phone")
|
||||
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user