From 6fd46263a21f0a4fa536d383dc4483d67cd393ef Mon Sep 17 00:00:00 2001 From: lidongdong <1459917685@qq.com> Date: 星期三, 05 七月 2023 09:47:56 +0800 Subject: [PATCH] 修改新增社区 不同区域同名字社区添加报错 --- springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/impl/UserServiceImpl.java | 16 +++++++++------- 1 files changed, 9 insertions(+), 7 deletions(-) diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/impl/UserServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/impl/UserServiceImpl.java index 4cfedb9..1a3fbe8 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/impl/UserServiceImpl.java +++ b/springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/impl/UserServiceImpl.java @@ -1258,12 +1258,12 @@ public R addUserBackstage(AdministratorsUserVO administratorsUserVO) { List<SysUserDO> list=userDao.selectList(new QueryWrapper<SysUserDO>().lambda(). + eq(SysUserDO::getAppId,administratorsUserVO.getAppid()). eq(SysUserDO::getAccount,administratorsUserVO.getAccount())); - if(list!=null || list.size()>0) + if(list!=null && list.size()>0) { return R.fail("账户已存在!"); } - ComActVO comActVO = userDao.selectCommunity(administratorsUserVO.getCommunityId()); if (nonNull(comActVO)) { @@ -1297,10 +1297,11 @@ } sysRoleDO.setRoleSort(0); sysRoleDO.setCreateBy(administratorsUserVO.getUserId()); + sysRoleDO.setRoleId(Snowflake.getId()); int insert = roleDAO.insert(sysRoleDO); if (insert > 0) { SysRoleDO sysRoleDO1 = roleDAO.selectOne( - new QueryWrapper<SysRoleDO>().lambda().eq(SysRoleDO::getRoleKey, sysRoleDO.getRoleKey())); + new QueryWrapper<SysRoleDO>().lambda().eq(SysRoleDO::getRoleId, sysRoleDO.getRoleId())); roleId = sysRoleDO1.getRoleId(); // 新角色设置所有权限 MenuRoleVO menuRoleVO = new MenuRoleVO(); @@ -1316,10 +1317,11 @@ sysRoleDO.setRoleKey(Constants.STREET_ROLE_KEY + administratorsUserVO.getStreetId()); sysRoleDO.setRoleSort(0); sysRoleDO.setCreateBy(administratorsUserVO.getUserId()); + sysRoleDO.setRoleId(Snowflake.getId()); int insert = roleDAO.insert(sysRoleDO); if (insert > 0) { SysRoleDO sysRoleDO1 = roleDAO.selectOne( - new QueryWrapper<SysRoleDO>().lambda().eq(SysRoleDO::getRoleKey, sysRoleDO.getRoleKey())); + new QueryWrapper<SysRoleDO>().lambda().eq(SysRoleDO::getRoleId, sysRoleDO.getRoleId())); roleId = sysRoleDO1.getRoleId(); // 新街道管理员角色设置固定三社权限 MenuRoleVO menuRoleVO = new MenuRoleVO(); @@ -1414,10 +1416,10 @@ } sysRoleDO.setRoleSort(0); sysRoleDO.setCreateBy(administratorsUserVO.getUserId()); - SysRoleDO sysRoleDO1 = roleDAO.selectOne( + List<SysRoleDO> sysRoleDO1 = roleDAO.selectList( new QueryWrapper<SysRoleDO>().lambda().eq(SysRoleDO::getRoleKey, sysRoleDO.getRoleKey())); - if (sysRoleDO1 != null) { - sysRoleDO = sysRoleDO1; + if (sysRoleDO1 != null && sysRoleDO1.size()>0 ) { + sysRoleDO = sysRoleDO1.get(0); roleId = sysRoleDO.getRoleId(); } else { roleDAO.insert(sysRoleDO); -- Gitblit v1.7.1