|  | @@ -155,11 +155,21 @@ public class UserService {
 | 
	
		
			
				|  |  |                  userRoleCities.add(userRoleCity);
 | 
	
		
			
				|  |  |                  roleIds.add(t.getRoleId());
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | +            // 删除旧权限
 | 
	
		
			
				|  |  | +            UpdateWrapper<UserRoleCity> userRoleCityUpdateWrapper = new UpdateWrapper<>();
 | 
	
		
			
				|  |  | +            userRoleCityUpdateWrapper.eq("user_id", userId);
 | 
	
		
			
				|  |  | +            userRoleCityDao.delete(userRoleCityUpdateWrapper);
 | 
	
		
			
				|  |  | +            // 添加新权限
 | 
	
		
			
				|  |  |              userRoleCityDao.insertBatch(userRoleCities);
 | 
	
		
			
				|  |  |              Set<Integer> functionIds = roleDao.getFunctionIdsByRoleIds(roleIds);
 | 
	
		
			
				|  |  |              if (!CollectionUtils.isEmpty(functionIds)) {
 | 
	
		
			
				|  |  |                  List<UserFunction> userFunctions = functionIds.stream().map(t -> new UserFunction(userId, t))
 | 
	
		
			
				|  |  |                          .collect(Collectors.toList());
 | 
	
		
			
				|  |  | +                UpdateWrapper<UserFunction> userFunctionUpdateWrapper = new UpdateWrapper<>();
 | 
	
		
			
				|  |  | +                userFunctionUpdateWrapper.eq("user_id", userId);
 | 
	
		
			
				|  |  | +                // 删除旧权限
 | 
	
		
			
				|  |  | +                userFunctionDao.delete(userFunctionUpdateWrapper);
 | 
	
		
			
				|  |  | +                // 添加新权限
 | 
	
		
			
				|  |  |                  userFunctionDao.insertBatch(userFunctions);
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
	
		
			
				|  | @@ -227,17 +237,21 @@ public class UserService {
 | 
	
		
			
				|  |  |                  userRoleCities.add(userRoleCity);
 | 
	
		
			
				|  |  |                  roleIds.add(t.getRoleId());
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  | +            // 删除旧权限
 | 
	
		
			
				|  |  |              UpdateWrapper<UserRoleCity> userRoleCityUpdateWrapper = new UpdateWrapper<>();
 | 
	
		
			
				|  |  |              userRoleCityUpdateWrapper.eq("user_id", dto.getUserId());
 | 
	
		
			
				|  |  |              userRoleCityDao.delete(userRoleCityUpdateWrapper);
 | 
	
		
			
				|  |  | +            // 添加新权限
 | 
	
		
			
				|  |  |              userRoleCityDao.insertBatch(userRoleCities);
 | 
	
		
			
				|  |  |              Set<Integer> functionIds = roleDao.getFunctionIdsByRoleIds(roleIds);
 | 
	
		
			
				|  |  |              if (!CollectionUtils.isEmpty(functionIds)) {
 | 
	
		
			
				|  |  |                  UpdateWrapper<UserFunction> userFunctionUpdateWrapper = new UpdateWrapper<>();
 | 
	
		
			
				|  |  |                  userFunctionUpdateWrapper.eq("user_id", dto.getUserId());
 | 
	
		
			
				|  |  | +                // 删除旧权限
 | 
	
		
			
				|  |  |                  userFunctionDao.delete(userFunctionUpdateWrapper);
 | 
	
		
			
				|  |  |                  List<UserFunction> userFunctions = functionIds.stream().map(t -> new UserFunction(userId, t))
 | 
	
		
			
				|  |  |                          .collect(Collectors.toList());
 | 
	
		
			
				|  |  | +                // 添加新权限
 | 
	
		
			
				|  |  |                  userFunctionDao.insertBatch(userFunctions);
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 |