From a693c9667c9972f491295b4e2c79d57e68c9d10f Mon Sep 17 00:00:00 2001 From: ls9527 <364173778@qq.com> Date: Wed, 2 Jun 2021 16:05:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=8B=E5=8A=A1=E5=A4=B1?= =?UTF-8?q?=E6=95=88=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mall/system/power/service/impl/PowerServiceImpl.java | 2 ++ .../mall/system/user/service/impl/UserServiceImpl.java | 3 ++- .../zero2oneit/mall/system/common/shiro/realm/UserRealm.java | 5 ++++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/mall-platform/mall-platform-core/src/main/java/com/zero2oneit/mall/system/power/service/impl/PowerServiceImpl.java b/mall-platform/mall-platform-core/src/main/java/com/zero2oneit/mall/system/power/service/impl/PowerServiceImpl.java index 6f4b7bc..aaffba4 100644 --- a/mall-platform/mall-platform-core/src/main/java/com/zero2oneit/mall/system/power/service/impl/PowerServiceImpl.java +++ b/mall-platform/mall-platform-core/src/main/java/com/zero2oneit/mall/system/power/service/impl/PowerServiceImpl.java @@ -11,6 +11,7 @@ import com.zero2oneit.mall.system.power.service.PowerService; import com.zero2oneit.mall.system.power.vo.PowerVO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import javax.servlet.http.HttpSession; import java.util.Arrays; @@ -66,6 +67,7 @@ public class PowerServiceImpl implements PowerService { return TreeUtils.assembleTree(menuList); } + @Transactional(rollbackFor=Exception.class) @Override public void saveUserOrRoleData(PowerVO vo) { if(vo.getType() == 1){ diff --git a/mall-platform/mall-platform-core/src/main/java/com/zero2oneit/mall/system/user/service/impl/UserServiceImpl.java b/mall-platform/mall-platform-core/src/main/java/com/zero2oneit/mall/system/user/service/impl/UserServiceImpl.java index 7113de7..31ee679 100644 --- a/mall-platform/mall-platform-core/src/main/java/com/zero2oneit/mall/system/user/service/impl/UserServiceImpl.java +++ b/mall-platform/mall-platform-core/src/main/java/com/zero2oneit/mall/system/user/service/impl/UserServiceImpl.java @@ -68,7 +68,6 @@ public class UserServiceImpl implements UserService { //用户修改密码 @Override - @Transactional(rollbackFor=Exception.class) public void editPassword(String newPwd, String account, String password) { //1.先校验判断是否为空 Assert.notNull(newPwd, LoginStatusCode.NEWPASSWORD_NULL.getErrorMessage()); @@ -121,6 +120,7 @@ public class UserServiceImpl implements UserService { } @Override + @Transactional(rollbackFor=Exception.class) public void addUser(UserVO userVO) { //校验 Assert.notNull(userVO.getAccount().trim(), LoginStatusCode.ACCOUNT_NULL.getErrorMessage()); @@ -160,6 +160,7 @@ public class UserServiceImpl implements UserService { } @Override + @Transactional(rollbackFor=Exception.class) public void updateUser(UserVO userVO) { //校验 Assert.notNull(userVO.getAccount().trim(), LoginStatusCode.ACCOUNT_NULL.getErrorMessage()); diff --git a/mall-platform/mall-platform-web/src/main/java/com/zero2oneit/mall/system/common/shiro/realm/UserRealm.java b/mall-platform/mall-platform-web/src/main/java/com/zero2oneit/mall/system/common/shiro/realm/UserRealm.java index ea28e2d..0addf3e 100644 --- a/mall-platform/mall-platform-web/src/main/java/com/zero2oneit/mall/system/common/shiro/realm/UserRealm.java +++ b/mall-platform/mall-platform-web/src/main/java/com/zero2oneit/mall/system/common/shiro/realm/UserRealm.java @@ -15,8 +15,8 @@ import org.apache.shiro.authz.SimpleAuthorizationInfo; import org.apache.shiro.crypto.hash.Md5Hash; import org.apache.shiro.realm.AuthorizingRealm; import org.apache.shiro.subject.PrincipalCollection; -import org.apache.shiro.util.ByteSource; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; import java.util.HashSet; import java.util.Set; @@ -27,10 +27,13 @@ import java.util.Set; @Slf4j public class UserRealm extends AuthorizingRealm { + @Lazy @Autowired private UserService userService; + @Lazy @Autowired private RoleService roleService; + @Lazy @Autowired private PowerService powerService; -- Gitee