From 4500db395fdad42c7689e17ef6e3965a6caebdcc Mon Sep 17 00:00:00 2001 From: 疯狂的狮子li <15040126243@163.com> Date: 星期一, 12 四月 2021 17:02:55 +0800 Subject: [PATCH] update ruoyi原生改为 MP lombok 格式 update SysConfig 模块代码 --- ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysPostServiceImpl.java | 73 ++++++++++++++---------------------- 1 files changed, 29 insertions(+), 44 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 6697f31..71035b9 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 @@ -1,6 +1,7 @@ package com.ruoyi.system.service.impl; import cn.hutool.core.lang.Validator; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.exception.CustomException; import com.ruoyi.system.domain.SysPost; @@ -14,12 +15,11 @@ /** * 宀椾綅淇℃伅 鏈嶅姟灞傚鐞� - * + * * @author ruoyi */ @Service -public class SysPostServiceImpl implements ISysPostService -{ +public class SysPostServiceImpl extends ServiceImpl<SysPostMapper, SysPost> implements ISysPostService { @Autowired private SysPostMapper postMapper; @@ -28,64 +28,58 @@ /** * 鏌ヨ宀椾綅淇℃伅闆嗗悎 - * + * * @param post 宀椾綅淇℃伅 * @return 宀椾綅淇℃伅闆嗗悎 */ @Override - public List<SysPost> selectPostList(SysPost post) - { + public List<SysPost> selectPostList(SysPost post) { return postMapper.selectPostList(post); } /** * 鏌ヨ鎵�鏈夊矖浣� - * + * * @return 宀椾綅鍒楄〃 */ @Override - public List<SysPost> selectPostAll() - { + public List<SysPost> selectPostAll() { return postMapper.selectPostAll(); } /** * 閫氳繃宀椾綅ID鏌ヨ宀椾綅淇℃伅 - * + * * @param postId 宀椾綅ID * @return 瑙掕壊瀵硅薄淇℃伅 */ @Override - public SysPost selectPostById(Long postId) - { + public SysPost selectPostById(Long postId) { return postMapper.selectPostById(postId); } /** * 鏍规嵁鐢ㄦ埛ID鑾峰彇宀椾綅閫夋嫨妗嗗垪琛� - * + * * @param userId 鐢ㄦ埛ID * @return 閫変腑宀椾綅ID鍒楄〃 */ @Override - public List<Integer> selectPostListByUserId(Long userId) - { + public List<Integer> selectPostListByUserId(Long userId) { return postMapper.selectPostListByUserId(userId); } /** * 鏍¢獙宀椾綅鍚嶇О鏄惁鍞竴 - * + * * @param post 宀椾綅淇℃伅 * @return 缁撴灉 */ @Override - public String checkPostNameUnique(SysPost post) - { + public String checkPostNameUnique(SysPost post) { Long postId = Validator.isNull(post.getPostId()) ? -1L : post.getPostId(); SysPost info = postMapper.checkPostNameUnique(post.getPostName()); - if (Validator.isNotNull(info) && info.getPostId().longValue() != postId.longValue()) - { + if (Validator.isNotNull(info) && info.getPostId().longValue() != postId.longValue()) { return UserConstants.NOT_UNIQUE; } return UserConstants.UNIQUE; @@ -93,17 +87,15 @@ /** * 鏍¢獙宀椾綅缂栫爜鏄惁鍞竴 - * + * * @param post 宀椾綅淇℃伅 * @return 缁撴灉 */ @Override - public String checkPostCodeUnique(SysPost post) - { + public String checkPostCodeUnique(SysPost post) { Long postId = Validator.isNull(post.getPostId()) ? -1L : post.getPostId(); SysPost info = postMapper.checkPostCodeUnique(post.getPostCode()); - if (Validator.isNotNull(info) && info.getPostId().longValue() != postId.longValue()) - { + if (Validator.isNotNull(info) && info.getPostId().longValue() != postId.longValue()) { return UserConstants.NOT_UNIQUE; } return UserConstants.UNIQUE; @@ -111,43 +103,38 @@ /** * 閫氳繃宀椾綅ID鏌ヨ宀椾綅浣跨敤鏁伴噺 - * + * * @param postId 宀椾綅ID * @return 缁撴灉 */ @Override - public int countUserPostById(Long postId) - { + public int countUserPostById(Long postId) { return userPostMapper.countUserPostById(postId); } /** * 鍒犻櫎宀椾綅淇℃伅 - * + * * @param postId 宀椾綅ID * @return 缁撴灉 */ @Override - public int deletePostById(Long postId) - { + public int deletePostById(Long postId) { return postMapper.deletePostById(postId); } /** * 鎵归噺鍒犻櫎宀椾綅淇℃伅 - * + * * @param postIds 闇�瑕佸垹闄ょ殑宀椾綅ID * @return 缁撴灉 * @throws Exception 寮傚父 */ @Override - public int deletePostByIds(Long[] postIds) - { - for (Long postId : postIds) - { + public int deletePostByIds(Long[] postIds) { + for (Long postId : postIds) { SysPost post = selectPostById(postId); - if (countUserPostById(postId) > 0) - { + if (countUserPostById(postId) > 0) { throw new CustomException(String.format("%1$s宸插垎閰�,涓嶈兘鍒犻櫎", post.getPostName())); } } @@ -156,25 +143,23 @@ /** * 鏂板淇濆瓨宀椾綅淇℃伅 - * + * * @param post 宀椾綅淇℃伅 * @return 缁撴灉 */ @Override - public int insertPost(SysPost post) - { + public int insertPost(SysPost post) { return postMapper.insertPost(post); } /** * 淇敼淇濆瓨宀椾綅淇℃伅 - * + * * @param post 宀椾綅淇℃伅 * @return 缁撴灉 */ @Override - public int updatePost(SysPost post) - { + public int updatePost(SysPost post) { return postMapper.updatePost(post); } } -- Gitblit v1.9.3