mirror of
https://github.com/go-admin-team/go-admin.git
synced 2026-09-21 18:20:50 +00:00
fix:Invalid post search criteria
This commit is contained in:
+15
-14
@@ -7,12 +7,13 @@ import (
|
|||||||
"go-admin/tools/app"
|
"go-admin/tools/app"
|
||||||
)
|
)
|
||||||
|
|
||||||
// @Summary 职位列表数据
|
// @Summary 岗位列表数据
|
||||||
// @Description 获取JSON
|
// @Description 获取JSON
|
||||||
// @Tags 职位
|
// @Tags 岗位
|
||||||
// @Param name query string false "name"
|
// @Param postName query string false "postName"
|
||||||
// @Param id query string false "id"
|
// @Param postCode query string false "postCode"
|
||||||
// @Param position query string false "position"
|
// @Param postId query string false "postId"
|
||||||
|
// @Param status query string false "status"
|
||||||
// @Success 200 {object} app.Response "{"code": 200, "data": [...]}"
|
// @Success 200 {object} app.Response "{"code": 200, "data": [...]}"
|
||||||
// @Router /api/v1/post [get]
|
// @Router /api/v1/post [get]
|
||||||
// @Security
|
// @Security
|
||||||
@@ -30,7 +31,7 @@ func GetPostList(c *gin.Context) {
|
|||||||
pageIndex = tools.StrToInt(err, index)
|
pageIndex = tools.StrToInt(err, index)
|
||||||
}
|
}
|
||||||
|
|
||||||
data.PostName = c.Request.FormValue("postName")
|
data.PostCode = c.Request.FormValue("postCode")
|
||||||
id := c.Request.FormValue("postId")
|
id := c.Request.FormValue("postId")
|
||||||
data.PostId, _ = tools.StringToInt(id)
|
data.PostId, _ = tools.StringToInt(id)
|
||||||
|
|
||||||
@@ -41,9 +42,9 @@ func GetPostList(c *gin.Context) {
|
|||||||
app.PageOK(c, result, count, pageIndex, pageSize, "")
|
app.PageOK(c, result, count, pageIndex, pageSize, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Summary 获取字典数据
|
// @Summary 获取岗位信息
|
||||||
// @Description 获取JSON
|
// @Description 获取JSON
|
||||||
// @Tags 字典数据
|
// @Tags 岗位
|
||||||
// @Param postId path int true "postId"
|
// @Param postId path int true "postId"
|
||||||
// @Success 200 {object} app.Response "{"code": 200, "data": [...]}"
|
// @Success 200 {object} app.Response "{"code": 200, "data": [...]}"
|
||||||
// @Router /api/v1/post/{postId} [get]
|
// @Router /api/v1/post/{postId} [get]
|
||||||
@@ -56,9 +57,9 @@ func GetPost(c *gin.Context) {
|
|||||||
app.OK(c,result,"")
|
app.OK(c,result,"")
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Summary 添加职位
|
// @Summary 添加岗位
|
||||||
// @Description 获取JSON
|
// @Description 获取JSON
|
||||||
// @Tags 职位
|
// @Tags 岗位
|
||||||
// @Accept application/json
|
// @Accept application/json
|
||||||
// @Product application/json
|
// @Product application/json
|
||||||
// @Param data body models.Post true "data"
|
// @Param data body models.Post true "data"
|
||||||
@@ -76,9 +77,9 @@ func InsertPost(c *gin.Context) {
|
|||||||
app.OK(c,result,"")
|
app.OK(c,result,"")
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Summary 修改职位
|
// @Summary 修改岗位
|
||||||
// @Description 获取JSON
|
// @Description 获取JSON
|
||||||
// @Tags 职位
|
// @Tags 岗位
|
||||||
// @Accept application/json
|
// @Accept application/json
|
||||||
// @Product application/json
|
// @Product application/json
|
||||||
// @Param data body models.Dept true "body"
|
// @Param data body models.Dept true "body"
|
||||||
@@ -97,9 +98,9 @@ func UpdatePost(c *gin.Context) {
|
|||||||
app.OK(c,result,"修改成功")
|
app.OK(c,result,"修改成功")
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Summary 删除职位
|
// @Summary 删除岗位
|
||||||
// @Description 删除数据
|
// @Description 删除数据
|
||||||
// @Tags 职位
|
// @Tags 岗位
|
||||||
// @Param id path int true "id"
|
// @Param id path int true "id"
|
||||||
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
|
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
|
||||||
// @Success 200 {string} string "{"code": -1, "message": "删除失败"}"
|
// @Success 200 {string} string "{"code": -1, "message": "删除失败"}"
|
||||||
|
|||||||
@@ -90,6 +90,9 @@ func (e *Post) GetPage(pageSize int, pageIndex int) ([]Post, int, error) {
|
|||||||
if e.PostName != "" {
|
if e.PostName != "" {
|
||||||
table = table.Where("post_name = ?", e.PostName)
|
table = table.Where("post_name = ?", e.PostName)
|
||||||
}
|
}
|
||||||
|
if e.PostCode != "" {
|
||||||
|
table = table.Where("post_code = ?", e.PostCode)
|
||||||
|
}
|
||||||
if e.Status != "" {
|
if e.Status != "" {
|
||||||
table = table.Where("status = ?", e.Status)
|
table = table.Where("status = ?", e.Status)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user