From 6b3aba3c9000a7bd77f10b3007702347f8c1d401 Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期三, 15 一月 2025 09:29:06 +0800 Subject: [PATCH] 修改bug --- ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserController.java | 21 ++++++++++++--------- 1 files changed, 12 insertions(+), 9 deletions(-) diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserController.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserController.java index 8ffd2ff..daa57b8 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserController.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserController.java @@ -172,15 +172,18 @@ } //添加门店员工关系数据 - UserShop userShop = new UserShop(); - userShop.setUserId(one.getUserId()); - userShop.setShopId(sysUser1.getObjectId()); - userShop.setRoleType(2); - userShop.setRoleId(user.getRoleId()); - userShop.setDeptId(user.getDeptId()); - userShop.setNickName(user.getNickName()); - userShop.setCreateTime(LocalDateTime.now()); - userShopService.save(userShop); + UserShop one1 = userShopService.getOne(new LambdaQueryWrapper<UserShop>().eq(UserShop::getUserId, one.getUserId()).eq(UserShop::getShopId, sysUser1.getObjectId())); + if(null == one1){ + UserShop userShop = new UserShop(); + userShop.setUserId(one.getUserId()); + userShop.setShopId(sysUser1.getObjectId()); + userShop.setRoleType(2); + userShop.setRoleId(user.getRoleId()); + userShop.setDeptId(user.getDeptId()); + userShop.setNickName(user.getNickName()); + userShop.setCreateTime(LocalDateTime.now()); + userShopService.save(userShop); + } }else{ user.setCreateBy(SecurityUtils.getUsername()); user.setPassword(SecurityUtils.encryptPassword("a123456")); -- Gitblit v1.7.1