|
|
@@ -18,6 +18,7 @@ import cn.hutool.core.collection.CollectionUtil;
|
|
18
|
18
|
import cn.hutool.core.util.ObjUtil;
|
|
19
|
19
|
import cn.hutool.core.util.StrUtil;
|
|
20
|
20
|
import com.sundot.airport.common.core.domain.BaseLargeScreenQueryParamDto;
|
|
|
21
|
+import com.sundot.airport.common.core.domain.ResetUserRoleDto;
|
|
21
|
22
|
import com.sundot.airport.common.core.domain.entity.SysDept;
|
|
22
|
23
|
import com.sundot.airport.common.core.domain.entity.SysDictData;
|
|
23
|
24
|
import com.sundot.airport.common.dto.UserInfo;
|
|
|
@@ -603,6 +604,36 @@ public class SysUserServiceImpl implements ISysUserService {
|
|
603
|
604
|
}
|
|
604
|
605
|
|
|
605
|
606
|
/**
|
|
|
607
|
+ * 重置指定人员的指定角色
|
|
|
608
|
+ *
|
|
|
609
|
+ * @return 结果
|
|
|
610
|
+ */
|
|
|
611
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
612
|
+ @Override
|
|
|
613
|
+ public int resetUserRole(ResetUserRoleDto resetUserRoleDto) {
|
|
|
614
|
+ List<SysUserRole> list = new ArrayList<>();
|
|
|
615
|
+ List<SysRole> sysRoleList = roleMapper.selectRoleList(new SysRole());
|
|
|
616
|
+ List<Long> roleIdList = sysRoleList.stream().filter(sysRole -> resetUserRoleDto.getRoleKeyList().contains(sysRole.getRoleKey())).map(SysRole::getRoleId).distinct().collect(Collectors.toList());
|
|
|
617
|
+ resetUserRoleDto.getUserNameList().forEach(x -> {
|
|
|
618
|
+ SysUser sysUser = userMapper.selectUserByUserName(x);
|
|
|
619
|
+ if (sysUser == null) {
|
|
|
620
|
+ throw new ServiceException("根据【" + x + "】未查询到用户信息");
|
|
|
621
|
+ }
|
|
|
622
|
+ userRoleMapper.deleteUserRoleByUserId(sysUser.getUserId());
|
|
|
623
|
+ roleIdList.forEach(y -> {
|
|
|
624
|
+ SysUserRole sysUserRole = new SysUserRole();
|
|
|
625
|
+ sysUserRole.setUserId(sysUser.getUserId());
|
|
|
626
|
+ sysUserRole.setRoleId(y);
|
|
|
627
|
+ list.add(sysUserRole);
|
|
|
628
|
+ });
|
|
|
629
|
+ });
|
|
|
630
|
+ if (CollUtil.isNotEmpty(list)) {
|
|
|
631
|
+ userRoleMapper.batchUserRole(list);
|
|
|
632
|
+ }
|
|
|
633
|
+ return 1;
|
|
|
634
|
+ }
|
|
|
635
|
+
|
|
|
636
|
+ /**
|
|
606
|
637
|
* 根据角色标识查询用户列表
|
|
607
|
638
|
*
|
|
608
|
639
|
* @param roleKeyList 角色标识
|