mirror of
				https://github.com/continew-org/continew-admin.git
				synced 2025-10-31 22:57:17 +08:00 
			
		
		
		
	| @@ -16,6 +16,7 @@ | ||||
|  | ||||
| package top.continew.admin.system.service.impl; | ||||
|  | ||||
| import cn.hutool.core.collection.CollUtil; | ||||
| import cn.hutool.core.util.ClassUtil; | ||||
| import cn.hutool.core.util.StrUtil; | ||||
| import com.alicp.jetcache.anno.Cached; | ||||
| @@ -77,6 +78,9 @@ public class DictItemServiceImpl extends BaseServiceImpl<DictItemMapper, DictIte | ||||
|  | ||||
|     @Override | ||||
|     public void deleteByDictIds(List<Long> dictIds) { | ||||
|         if (CollUtil.isEmpty(dictIds)) { | ||||
|             return; | ||||
|         } | ||||
|         baseMapper.lambdaUpdate().in(DictItemDO::getDictId, dictIds).remove(); | ||||
|         RedisUtils.deleteByPattern(CacheConstants.DICT_KEY_PREFIX + StringConstants.ASTERISK); | ||||
|     } | ||||
|   | ||||
| @@ -125,6 +125,9 @@ public class FileServiceImpl extends BaseServiceImpl<FileMapper, FileDO, FileRes | ||||
|  | ||||
|     @Override | ||||
|     public Long countByStorageIds(List<Long> storageIds) { | ||||
|         if (CollUtil.isEmpty(storageIds)) { | ||||
|             return 0L; | ||||
|         } | ||||
|         return baseMapper.lambdaQuery().in(FileDO::getStorageId, storageIds).count(); | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -80,6 +80,9 @@ public class MessageUserServiceImpl implements MessageUserService { | ||||
|  | ||||
|     @Override | ||||
|     public void readMessage(List<Long> ids) { | ||||
|         if (CollUtil.isEmpty(ids)) { | ||||
|             return; | ||||
|         } | ||||
|         baseMapper.lambdaUpdate() | ||||
|             .set(MessageUserDO::getIsRead, true) | ||||
|             .set(MessageUserDO::getReadTime, LocalDateTime.now()) | ||||
| @@ -90,6 +93,9 @@ public class MessageUserServiceImpl implements MessageUserService { | ||||
|  | ||||
|     @Override | ||||
|     public void deleteByMessageIds(List<Long> messageIds) { | ||||
|         if (CollUtil.isEmpty(messageIds)) { | ||||
|             return; | ||||
|         } | ||||
|         baseMapper.lambdaUpdate().in(MessageUserDO::getMessageId, messageIds).remove(); | ||||
|     } | ||||
| } | ||||
| @@ -62,12 +62,18 @@ public class RoleDeptServiceImpl implements RoleDeptService { | ||||
|     @Override | ||||
|     @Transactional(rollbackFor = Exception.class) | ||||
|     public void deleteByRoleIds(List<Long> roleIds) { | ||||
|         if (CollUtil.isEmpty(roleIds)) { | ||||
|             return; | ||||
|         } | ||||
|         baseMapper.lambdaUpdate().in(RoleDeptDO::getRoleId, roleIds).remove(); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     @Transactional(rollbackFor = Exception.class) | ||||
|     public void deleteByDeptIds(List<Long> deptIds) { | ||||
|         if (CollUtil.isEmpty(deptIds)) { | ||||
|             return; | ||||
|         } | ||||
|         baseMapper.lambdaUpdate().in(RoleDeptDO::getDeptId, deptIds).remove(); | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -64,6 +64,9 @@ public class RoleMenuServiceImpl implements RoleMenuService { | ||||
|     @Override | ||||
|     @Transactional(rollbackFor = Exception.class) | ||||
|     public void deleteByRoleIds(List<Long> roleIds) { | ||||
|         if (CollUtil.isEmpty(roleIds)) { | ||||
|             return; | ||||
|         } | ||||
|         baseMapper.lambdaUpdate().in(RoleMenuDO::getRoleId, roleIds).remove(); | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -158,6 +158,9 @@ public class RoleServiceImpl extends BaseServiceImpl<RoleMapper, RoleDO, RoleRes | ||||
|     @Override | ||||
|     @ContainerMethod(namespace = ContainerConstants.USER_ROLE_NAME_LIST, type = MappingType.ORDER_OF_KEYS) | ||||
|     public List<String> listNameByIds(List<Long> ids) { | ||||
|         if (CollUtil.isEmpty(ids)) { | ||||
|             return Collections.emptyList(); | ||||
|         } | ||||
|         List<RoleDO> roleList = baseMapper.lambdaQuery().select(RoleDO::getName).in(RoleDO::getId, ids).list(); | ||||
|         return roleList.stream().map(RoleDO::getName).toList(); | ||||
|     } | ||||
| @@ -165,6 +168,9 @@ public class RoleServiceImpl extends BaseServiceImpl<RoleMapper, RoleDO, RoleRes | ||||
|     @Override | ||||
|     public Set<String> listCodeByUserId(Long userId) { | ||||
|         List<Long> roleIdList = userRoleService.listRoleIdByUserId(userId); | ||||
|         if (CollUtil.isEmpty(roleIdList)) { | ||||
|             return Collections.emptySet(); | ||||
|         } | ||||
|         List<RoleDO> roleList = baseMapper.lambdaQuery().select(RoleDO::getCode).in(RoleDO::getId, roleIdList).list(); | ||||
|         return roleList.stream().map(RoleDO::getCode).collect(Collectors.toSet()); | ||||
|     } | ||||
| @@ -172,6 +178,9 @@ public class RoleServiceImpl extends BaseServiceImpl<RoleMapper, RoleDO, RoleRes | ||||
|     @Override | ||||
|     public Set<RoleContext> listByUserId(Long userId) { | ||||
|         List<Long> roleIdList = userRoleService.listRoleIdByUserId(userId); | ||||
|         if (CollUtil.isEmpty(roleIdList)) { | ||||
|             return Collections.emptySet(); | ||||
|         } | ||||
|         List<RoleDO> roleList = baseMapper.lambdaQuery().in(RoleDO::getId, roleIdList).list(); | ||||
|         return new HashSet<>(BeanUtil.copyToList(roleList, RoleContext.class)); | ||||
|     } | ||||
|   | ||||
| @@ -54,6 +54,9 @@ public class UserPasswordHistoryServiceImpl implements UserPasswordHistoryServic | ||||
|  | ||||
|     @Override | ||||
|     public void deleteByUserIds(List<Long> userIds) { | ||||
|         if (CollUtil.isEmpty(userIds)) { | ||||
|             return; | ||||
|         } | ||||
|         baseMapper.lambdaUpdate().in(UserPasswordHistoryDO::getUserId, userIds).remove(); | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -91,6 +91,9 @@ public class UserRoleServiceImpl implements UserRoleService { | ||||
|  | ||||
|     @Override | ||||
|     public void deleteByUserIds(List<Long> userIds) { | ||||
|         if (CollUtil.isEmpty(userIds)) { | ||||
|             return; | ||||
|         } | ||||
|         baseMapper.lambdaUpdate().in(UserRoleDO::getUserId, userIds).remove(); | ||||
|     } | ||||
|  | ||||
| @@ -124,6 +127,9 @@ public class UserRoleServiceImpl implements UserRoleService { | ||||
|  | ||||
|     @Override | ||||
|     public boolean isRoleIdExists(List<Long> roleIds) { | ||||
|         if (CollUtil.isEmpty(roleIds)) { | ||||
|             return false; | ||||
|         } | ||||
|         return baseMapper.lambdaQuery().in(UserRoleDO::getRoleId, roleIds).exists(); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -463,6 +463,9 @@ public class UserServiceImpl extends BaseServiceImpl<UserMapper, UserDO, UserRes | ||||
|  | ||||
|     @Override | ||||
|     public Long countByDeptIds(List<Long> deptIds) { | ||||
|         if (CollUtil.isEmpty(deptIds)) { | ||||
|             return 0L; | ||||
|         } | ||||
|         return baseMapper.lambdaQuery().in(UserDO::getDeptId, deptIds).count(); | ||||
|     } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user