From 209654fdff7206c2638d9fbe26eb0fb17a68adb4 Mon Sep 17 00:00:00 2001 From: zendwang <wangzhenxian@idadt.com> Date: 星期四, 02 十二月 2021 20:13:47 +0800 Subject: [PATCH] fix selectPostListByUserId方法出参调整为Long --- ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysPostServiceImpl.java | 24 +++++++++++++----------- 1 files changed, 13 insertions(+), 11 deletions(-) diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysPostServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysPostServiceImpl.java index 30d4075..f136de6 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysPostServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysPostServiceImpl.java @@ -21,7 +21,7 @@ /** * 宀椾綅淇℃伅 鏈嶅姟灞傚鐞� * - * @author ruoyi + * @author Lion Li */ @Service public class SysPostServiceImpl extends ServicePlusImpl<SysPostMapper, SysPost, SysPost> implements ISysPostService { @@ -35,7 +35,7 @@ .like(StringUtils.isNotBlank(post.getPostCode()), SysPost::getPostCode, post.getPostCode()) .eq(StringUtils.isNotBlank(post.getStatus()), SysPost::getStatus, post.getStatus()) .like(StringUtils.isNotBlank(post.getPostName()), SysPost::getPostName, post.getPostName()); - return PageUtils.buildDataInfo(page(PageUtils.buildPage(),lqw)); + return PageUtils.buildDataInfo(page(PageUtils.buildPage(), lqw)); } /** @@ -80,7 +80,7 @@ * @return 閫変腑宀椾綅ID鍒楄〃 */ @Override - public List<Integer> selectPostListByUserId(Long userId) { + public List<Long> selectPostListByUserId(Long userId) { return baseMapper.selectPostListByUserId(userId); } @@ -93,9 +93,10 @@ @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; @@ -110,9 +111,10 @@ @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; @@ -125,8 +127,8 @@ * @return 缁撴灉 */ @Override - public int countUserPostById(Long postId) { - return userPostMapper.selectCount(new LambdaQueryWrapper<SysUserPost>().eq(SysUserPost::getPostId,postId)); + public long countUserPostById(Long postId) { + return userPostMapper.selectCount(new LambdaQueryWrapper<SysUserPost>().eq(SysUserPost::getPostId, postId)); } /** -- Gitblit v1.9.3