| | |
| | | package org.dromara.system.controller.system; |
| | | |
| | | import cn.dev33.satoken.annotation.SaCheckPermission; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.dromara.common.core.constant.UserConstants; |
| | | import org.dromara.common.core.constant.SystemConstants; |
| | | import org.dromara.common.core.domain.R; |
| | | import org.dromara.common.excel.utils.ExcelUtil; |
| | | import org.dromara.common.log.annotation.Log; |
| | |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | return R.fail("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在"); |
| | | } else if (!postService.checkPostCodeUnique(post)) { |
| | | return R.fail("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在"); |
| | | } else if (UserConstants.POST_DISABLE.equals(post.getStatus()) |
| | | } else if (SystemConstants.DISABLE.equals(post.getStatus()) |
| | | && postService.countUserPostById(post.getPostId()) > 0) { |
| | | return R.fail("该岗位下存在已分配用户,不能禁用!"); |
| | | } |
| | |
| | | * 获取岗位选择框列表 |
| | | * |
| | | * @param postIds 岗位ID串 |
| | | * @param deptId 部门id |
| | | */ |
| | | @SaCheckPermission("system:post:query") |
| | | @GetMapping("/optionselect") |
| | | public R<List<SysPostVo>> optionselect(@RequestParam(required = false) Long[] postIds) { |
| | | return R.ok(postService.selectPostByIds(postIds == null ? null : List.of(postIds))); |
| | | public R<List<SysPostVo>> optionselect(@RequestParam(required = false) Long[] postIds, @RequestParam(required = false) Long deptId) { |
| | | List<SysPostVo> list = new ArrayList<>(); |
| | | if (ObjectUtil.isNotNull(deptId)) { |
| | | SysPostBo post = new SysPostBo(); |
| | | post.setDeptId(deptId); |
| | | list = postService.selectPostList(post); |
| | | } else if (postIds != null) { |
| | | list = postService.selectPostByIds(List.of(postIds)); |
| | | } |
| | | return R.ok(list); |
| | | } |
| | | |
| | | } |