Quellcode durchsuchen

用户导入修改

anderx vor 2 Jahren
Ursprung
Commit
885ee43506

+ 2 - 4
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java

@@ -551,7 +551,7 @@ public class SysUserServiceImpl implements ISysUserService
                     if (user.getDeptName()!=null){
                         SysDept sysDept = deptService.selectByDepName(user.getDeptName(), company);
                         if (sysDept !=null){
-                            user.setDeptId(sysDept.getDeptId());
+                            throw  new ServiceException("部门数据异常,找不到部门");
                         }
                     }
                     userMapper.insertUser(user);
@@ -580,11 +580,10 @@ public class SysUserServiceImpl implements ISysUserService
                             user.setSuperiorId(sysUser.getUserId());
                         }
                     }
-
                     if (user.getDeptName()!=null&&!user.getDeptName().equals(u.getDeptName())){
                         SysDept sysDept = deptService.selectByDepName(user.getDeptName(), company);
                         if (sysDept !=null){
-                            user.setDeptId(sysDept.getDeptId());
+                            throw  new ServiceException("部门数据异常,找不到部门");
                         }
                     }
                     if (user.getRoleName()!=null&&!user.getRoleName().equals(u.getRoleName())){
@@ -600,7 +599,6 @@ public class SysUserServiceImpl implements ISysUserService
                             userRoleMapper.batchUserRole(list);
                         }
                     }
-
                     userMapper.updateUser(user);
                     successNum++;
                     successMsg.append("<br/>" + successNum + "、账号 " + user.getUserName() + " 更新成功");

+ 1 - 1
ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml

@@ -315,7 +315,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	<select id="selectName" resultType="com.ruoyi.common.core.domain.entity.SysUser">
 		select a.user_id userId, a.user_name userName,a.nick_name nickName
 		from sys_user a
-		where 1=1
+		where del_flag=0
 		and a.nick_name like concat('%',#{name},'%')
 		<if test="roleId ==null">
 			and  a.user_id >1