From 931ea9dcdf62ea348f1811b9faf95d07ab1c1ac8 Mon Sep 17 00:00:00 2001 From: 罗元桥 <2376770955@qq.com> Date: 星期日, 26 九月 2021 14:22:22 +0800 Subject: [PATCH] Merge branch 'test' into 'test_bak' --- springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/impl/RoleServiceImpl.java | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-) diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/impl/RoleServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/impl/RoleServiceImpl.java index 16d91ac..1ad4384 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/impl/RoleServiceImpl.java +++ b/springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/impl/RoleServiceImpl.java @@ -30,6 +30,7 @@ import com.panzhihua.service_user.service.RoleService; import lombok.extern.slf4j.Slf4j; +import org.springframework.util.StringUtils; /** * @program: springcloud_k8s_panzhihuazhihuishequ @@ -137,9 +138,7 @@ } catch (Exception e) { e.printStackTrace(); log.error("新增角色失败,失败原因【{}】", e.getMessage()); - if (e.getMessage().contains("unique_role_name_community_id")) { return R.fail("角色已经存在"); - } } if (insert > 0) { SysRoleDO roleDO = roleDAO.selectOne(new QueryWrapper<SysRoleDO>().lambda() @@ -226,6 +225,12 @@ public R putMenuRole(MenuRoleVO menuRoleVO) { List<Long> menuIds = new ArrayList<>(); Long roleId = menuRoleVO.getRoleId(); + if(!StringUtils.isEmpty(menuRoleVO.getRoleName())){ + SysRoleDO sysRoleDO=new SysRoleDO(); + sysRoleDO.setRoleId(roleId); + sysRoleDO.setRoleName(menuRoleVO.getRoleName()); + this.roleDAO.updateById(sysRoleDO); + } // 删除旧的 sysRoleMenuDAO.delete(new QueryWrapper<SysRoleMenuDO>().lambda().eq(SysRoleMenuDO::getRoleId, roleId)); // 创建新的 @@ -233,7 +238,7 @@ if (isAll.intValue() == 1) { menuIds = sysMenuDAO .selectList( - new QueryWrapper<SysMenuDO>().lambda().eq(SysMenuDO::getCommunityId, menuRoleVO.getCommunityId())) + new QueryWrapper<SysMenuDO>().lambda().eq(SysMenuDO::getCommunityId, 2)) .stream().map(sysMenuDO -> sysMenuDO.getMenuId()).collect(Collectors.toList()); } else { menuIds = menuRoleVO.getMenuIds(); -- Gitblit v1.7.1