| | |
| | | import com.ruoyi.common.constant.UserConstants; |
| | | import com.ruoyi.common.core.controller.BaseController; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.PageQuery; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | |
| | | import com.ruoyi.system.service.ISysPostService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | |
| | | @ApiOperation("获取岗位列表") |
| | | @PreAuthorize("@ss.hasPermi('system:post:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo<SysPost> list(SysPost post) { |
| | | return postService.selectPagePostList(post); |
| | | public TableDataInfo<SysPost> list(SysPost post, PageQuery pageQuery) { |
| | | return postService.selectPagePostList(post, pageQuery); |
| | | } |
| | | |
| | | @ApiOperation("导出岗位列表") |
| | | @Log(title = "岗位管理", businessType = BusinessType.EXPORT) |
| | | @PreAuthorize("@ss.hasPermi('system:post:export')") |
| | | @GetMapping("/export") |
| | | @PostMapping("/export") |
| | | public void export(SysPost post, HttpServletResponse response) { |
| | | List<SysPost> list = postService.selectPostList(post); |
| | | ExcelUtil.exportExcel(list, "岗位数据", SysPost.class, response); |
| | |
| | | @ApiOperation("根据岗位编号获取详细信息") |
| | | @PreAuthorize("@ss.hasPermi('system:post:query')") |
| | | @GetMapping(value = "/{postId}") |
| | | public AjaxResult<SysPost> getInfo(@PathVariable Long postId) { |
| | | public AjaxResult<SysPost> getInfo(@ApiParam("岗位ID") @PathVariable Long postId) { |
| | | return AjaxResult.success(postService.selectPostById(postId)); |
| | | } |
| | | |
| | |
| | | } else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post))) { |
| | | return AjaxResult.error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在"); |
| | | } |
| | | post.setCreateBy(getUsername()); |
| | | return toAjax(postService.insertPost(post)); |
| | | } |
| | | |
| | |
| | | } else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post))) { |
| | | return AjaxResult.error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在"); |
| | | } |
| | | post.setUpdateBy(getUsername()); |
| | | return toAjax(postService.updatePost(post)); |
| | | } |
| | | |
| | |
| | | @PreAuthorize("@ss.hasPermi('system:post:remove')") |
| | | @Log(title = "岗位管理", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{postIds}") |
| | | public AjaxResult<Void> remove(@PathVariable Long[] postIds) { |
| | | public AjaxResult<Void> remove(@ApiParam("岗位ID串") @PathVariable Long[] postIds) { |
| | | return toAjax(postService.deletePostByIds(postIds)); |
| | | } |
| | | |