mirror of
https://gitee.com/XM-GO/PandaX.git
synced 2026-04-23 10:58:35 +08:00
【更新】更新restful
This commit is contained in:
@@ -17,17 +17,7 @@ type PostApi struct {
|
||||
RoleApp services.SysRoleModel
|
||||
}
|
||||
|
||||
// @Summary 职位列表数据
|
||||
// @Description 获取JSON
|
||||
// @Tags 职位
|
||||
// @Param postName query string false "postName"
|
||||
// @Param postCode query string false "postCode"
|
||||
// @Param status query string false "status"
|
||||
// @Param pageSize query int false "页条数"
|
||||
// @Param pageNum query int false "页码"
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /system/post [get]
|
||||
// @Security
|
||||
// GetPostList 职位列表数据
|
||||
func (p *PostApi) GetPostList(rc *restfulx.ReqCtx) {
|
||||
|
||||
pageNum := restfulx.QueryInt(rc, "pageNum", 1)
|
||||
@@ -51,28 +41,13 @@ func (p *PostApi) GetPostList(rc *restfulx.ReqCtx) {
|
||||
}
|
||||
}
|
||||
|
||||
// @Summary 获取职位
|
||||
// @Description 获取JSON
|
||||
// @Tags 职位
|
||||
// @Param postId path int true "postId"
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Router /system/post/{postId} [get]
|
||||
// @Security
|
||||
// GetPost 获取职位
|
||||
func (p *PostApi) GetPost(rc *restfulx.ReqCtx) {
|
||||
postId := restfulx.PathParamInt(rc, "postId")
|
||||
p.PostApp.FindOne(int64(postId))
|
||||
}
|
||||
|
||||
// @Summary 添加职位
|
||||
// @Description 获取JSON
|
||||
// @Tags 职位
|
||||
// @Accept application/json
|
||||
// @Product application/json
|
||||
// @Param data body entity.SysPost true "data"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "添加失败"}"
|
||||
// @Router /system/post [post]
|
||||
// @Security X-TOKEN
|
||||
// InsertPost 添加职位
|
||||
func (p *PostApi) InsertPost(rc *restfulx.ReqCtx) {
|
||||
var post entity.SysPost
|
||||
restfulx.BindQuery(rc, &post)
|
||||
@@ -81,16 +56,7 @@ func (p *PostApi) InsertPost(rc *restfulx.ReqCtx) {
|
||||
p.PostApp.Insert(post)
|
||||
}
|
||||
|
||||
// @Summary 修改职位
|
||||
// @Description 获取JSON
|
||||
// @Tags 职位
|
||||
// @Accept application/json
|
||||
// @Product application/json
|
||||
// @Param data body entity.SysPost true "body"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "添加失败"}"
|
||||
// @Router /system/post [put]
|
||||
// @Security X-TOKEN
|
||||
// UpdatePost 修改职位
|
||||
func (p *PostApi) UpdatePost(rc *restfulx.ReqCtx) {
|
||||
var post entity.SysPost
|
||||
restfulx.BindQuery(rc, &post)
|
||||
@@ -99,13 +65,7 @@ func (p *PostApi) UpdatePost(rc *restfulx.ReqCtx) {
|
||||
p.PostApp.Update(post)
|
||||
}
|
||||
|
||||
// @Summary 删除职位
|
||||
// @Description 删除数据
|
||||
// @Tags 职位
|
||||
// @Param postId path string true "postId "
|
||||
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
|
||||
// @Success 200 {string} string "{"code": 400, "message": "删除失败"}"
|
||||
// @Router /system/post/{postId} [delete]
|
||||
// DeletePost 删除职位
|
||||
func (p *PostApi) DeletePost(rc *restfulx.ReqCtx) {
|
||||
postId := restfulx.PathParam(rc, "postId")
|
||||
postIds := utils.IdsStrToIdsIntGroup(postId)
|
||||
|
||||
Reference in New Issue
Block a user