| | |
| | | |
| | | import java.util.List; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import com.ruoyi.common.annotation.AddOrgId; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/system/post") |
| | | public class SysPostController extends BaseController |
| | | { |
| | | public class SysPostController extends BaseController { |
| | | @Autowired |
| | | private ISysPostService postService; |
| | | |
| | |
| | | */ |
| | | //@PreAuthorize("@ss.hasPermi('system:post:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(SysPost post) |
| | | { |
| | | public TableDataInfo list(SysPost post) { |
| | | startPage(); |
| | | List<SysPost> list = postService.selectPostList(post); |
| | | return getDataTable(list); |
| | |
| | | @Log(title = "岗位管理", businessType = BusinessType.EXPORT) |
| | | //@PreAuthorize("@ss.hasPermi('system:post:export')") |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, SysPost post) |
| | | { |
| | | public void export(HttpServletResponse response, SysPost post) { |
| | | List<SysPost> list = postService.selectPostList(post); |
| | | ExcelUtil<SysPost> util = new ExcelUtil<SysPost>(SysPost.class); |
| | | util.exportExcel(response, list, "岗位数据"); |
| | |
| | | */ |
| | | //@PreAuthorize("@ss.hasPermi('system:post:query')") |
| | | @GetMapping(value = "/{postId}") |
| | | public AjaxResult getInfo(@PathVariable Long postId) |
| | | { |
| | | public AjaxResult getInfo(@PathVariable Long postId) { |
| | | return success(postService.selectPostById(postId)); |
| | | } |
| | | |
| | |
| | | */ |
| | | //@PreAuthorize("@ss.hasPermi('system:post:add')") |
| | | @Log(title = "岗位管理", businessType = BusinessType.INSERT) |
| | | @AddOrgId(field = "orgid", paramIndex = 0, campusField = "campusid") |
| | | @PostMapping("/add") |
| | | public AjaxResult add(@Validated @RequestBody SysPost post) |
| | | { |
| | | if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post))) |
| | | { |
| | | public AjaxResult add(@Validated @RequestBody SysPost post) { |
| | | if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post))) { |
| | | return error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在"); |
| | | } |
| | | else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post))) |
| | | { |
| | | } else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post))) { |
| | | return error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在"); |
| | | } |
| | | post.setCreateBy(getUsername()); |
| | |
| | | */ |
| | | //@PreAuthorize("@ss.hasPermi('system:post:edit')") |
| | | @Log(title = "岗位管理", businessType = BusinessType.UPDATE) |
| | | @AddOrgId(field = "orgid", paramIndex = 0, campusField = "campusid") |
| | | @PostMapping("/edit") |
| | | public AjaxResult edit(@Validated @RequestBody SysPost post) |
| | | { |
| | | if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post))) |
| | | { |
| | | public AjaxResult edit(@Validated @RequestBody SysPost post) { |
| | | if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post))) { |
| | | return error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在"); |
| | | } |
| | | else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post))) |
| | | { |
| | | } else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post))) { |
| | | return error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在"); |
| | | } |
| | | post.setUpdateBy(getUsername()); |
| | |
| | | //@PreAuthorize("@ss.hasPermi('system:post:remove')") |
| | | @Log(title = "岗位管理", businessType = BusinessType.DELETE) |
| | | @GetMapping("/remove/{postIds}") |
| | | public AjaxResult remove(@PathVariable Long[] postIds) |
| | | { |
| | | public AjaxResult remove(@PathVariable Long[] postIds) { |
| | | return toAjax(postService.deletePostByIds(postIds)); |
| | | } |
| | | |
| | |
| | | * 获取岗位选择框列表 |
| | | */ |
| | | @GetMapping("/optionselect") |
| | | public AjaxResult optionselect() |
| | | { |
| | | public AjaxResult optionselect() { |
| | | List<SysPost> posts = postService.selectPostAll(); |
| | | return success(posts); |
| | | } |