| | |
| | | package com.ruoyi.system.service.impl; |
| | | |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.constant.UserConstants; |
| | |
| | | */ |
| | | @Override |
| | | public String checkPostNameUnique(SysPost post) { |
| | | Long postId = StringUtils.isNull(post.getPostId()) ? -1L : post.getPostId(); |
| | | boolean count = baseMapper.exists(new LambdaQueryWrapper<SysPost>() |
| | | boolean exist = baseMapper.exists(new LambdaQueryWrapper<SysPost>() |
| | | .eq(SysPost::getPostName, post.getPostName()) |
| | | .ne(SysPost::getPostId, postId)); |
| | | if (count) { |
| | | .ne(ObjectUtil.isNotNull(post.getPostId()), SysPost::getPostId, post.getPostId())); |
| | | if (exist) { |
| | | return UserConstants.NOT_UNIQUE; |
| | | } |
| | | return UserConstants.UNIQUE; |
| | |
| | | */ |
| | | @Override |
| | | public String checkPostCodeUnique(SysPost post) { |
| | | Long postId = StringUtils.isNull(post.getPostId()) ? -1L : post.getPostId(); |
| | | boolean count = baseMapper.exists(new LambdaQueryWrapper<SysPost>() |
| | | boolean exist = baseMapper.exists(new LambdaQueryWrapper<SysPost>() |
| | | .eq(SysPost::getPostCode, post.getPostCode()) |
| | | .ne(SysPost::getPostId, postId)); |
| | | if (count) { |
| | | .ne(ObjectUtil.isNotNull(post.getPostId()), SysPost::getPostId, post.getPostId())); |
| | | if (exist) { |
| | | return UserConstants.NOT_UNIQUE; |
| | | } |
| | | return UserConstants.UNIQUE; |
| | |
| | | * |
| | | * @param postIds 需要删除的岗位ID |
| | | * @return 结果 |
| | | * @throws Exception 异常 |
| | | */ |
| | | @Override |
| | | public int deletePostByIds(Long[] postIds) { |