| | |
| | | @Override |
| | | public String checkPostNameUnique(SysPost post) { |
| | | Long postId = StringUtils.isNull(post.getPostId()) ? -1L : post.getPostId(); |
| | | SysPost info = getOne(new LambdaQueryWrapper<SysPost>() |
| | | .eq(SysPost::getPostName, post.getPostName()).last("limit 1")); |
| | | if (StringUtils.isNotNull(info) && info.getPostId().longValue() != postId.longValue()) { |
| | | long count = count(new LambdaQueryWrapper<SysPost>() |
| | | .eq(SysPost::getPostName, post.getPostName()) |
| | | .ne(SysPost::getPostId, postId)); |
| | | if (count > 0) { |
| | | return UserConstants.NOT_UNIQUE; |
| | | } |
| | | return UserConstants.UNIQUE; |
| | |
| | | @Override |
| | | public String checkPostCodeUnique(SysPost post) { |
| | | Long postId = StringUtils.isNull(post.getPostId()) ? -1L : post.getPostId(); |
| | | SysPost info = getOne(new LambdaQueryWrapper<SysPost>() |
| | | .eq(SysPost::getPostCode, post.getPostCode()).last("limit 1")); |
| | | if (StringUtils.isNotNull(info) && info.getPostId().longValue() != postId.longValue()) { |
| | | long count = count(new LambdaQueryWrapper<SysPost>() |
| | | .eq(SysPost::getPostCode, post.getPostCode()) |
| | | .ne(SysPost::getPostId, postId)); |
| | | if (count > 0) { |
| | | return UserConstants.NOT_UNIQUE; |
| | | } |
| | | return UserConstants.UNIQUE; |