update 优化 岗位如果绑定了用户则不允许禁用

This commit is contained in:
疯狂的狮子Li
2023-08-07 18:19:57 +08:00
parent c344d72909
commit 6f2c576c2f
3 changed files with 15 additions and 2 deletions

View File

@@ -51,6 +51,16 @@ public interface UserConstants {
*/
String DEPT_DISABLE = "1";
/**
* 岗位正常状态
*/
String POST_NORMAL = "0";
/**
* 岗位停用状态
*/
String POST_DISABLE = "1";
/**
* 字典正常状态
*/

View File

@@ -1,6 +1,7 @@
package com.ruoyi.system.controller;
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.ruoyi.common.core.constant.UserConstants;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.excel.utils.ExcelUtil;
@@ -105,7 +106,9 @@ public class SysPostController extends BaseController {
*/
@GetMapping("/optionselect")
public R<List<SysPost>> optionselect() {
List<SysPost> posts = postService.selectPostAll();
SysPost post = new SysPost();
post.setStatus(UserConstants.POST_NORMAL);
List<SysPost> posts = postService.selectPostList(post);
return R.ok(posts);
}
}

View File

@@ -147,7 +147,7 @@ public class SysPostServiceImpl implements ISysPostService {
for (Long postId : postIds) {
SysPost post = selectPostById(postId);
if (countUserPostById(postId) > 0) {
throw new ServiceException(String.format("%1$s已分配,不能删除", post.getPostName()));
throw new ServiceException(String.format("%1$s已分配不能删除!", post.getPostName()));
}
}
return baseMapper.deleteBatchIds(Arrays.asList(postIds));