refactor: 为 Mapper 接口增加 Mapper 注解,以消除 IDEA 警告标志(减少小白咨询)

实际它并不影响运行,但为了减少麻烦,加上不报警告,那就加上吧
This commit is contained in:
2025-07-04 20:58:51 +08:00
parent 4c14feb15f
commit efb65c21a1
27 changed files with 70 additions and 20 deletions

View File

@@ -63,25 +63,23 @@ public class OnlineUserServiceImpl implements OnlineUserService {
// 查询所有在线 Token
List<String> tokenKeyList = StpUtil.searchTokenValue(StringConstants.EMPTY, 0, -1, false);
Map<Long, List<String>> tokenMap = tokenKeyList.stream()
// 提前映射,避免重复调用
.map(tokenKey -> StrUtil.subAfter(tokenKey, StringConstants.COLON, true))
.map(token -> {
Object loginIdObj = StpUtil.getLoginIdByToken(token);
long tokenTimeout = StpUtil.getStpLogic().getTokenActiveTimeoutByToken(token);
// 将相关信息打包成对象或简单的Entry对便于后续过滤与归类
return new AbstractMap.SimpleEntry<>(token, new AbstractMap.SimpleEntry<>(loginIdObj, tokenTimeout));
})
// 过滤出未过期且loginId存在的Token
.filter(entry -> {
Object loginIdObj = entry.getValue().getKey();
long tokenTimeout = entry.getValue().getValue();
return loginIdObj != null && tokenTimeout >= SaTokenDao.NEVER_EXPIRE;
})
// 此时数据都有效,进行收集
.collect(Collectors.groupingBy(
entry -> Convert.toLong(entry.getValue().getKey()),
Collectors.mapping(AbstractMap.SimpleEntry::getKey, Collectors.toList()))
);
// 提前映射,避免重复调用
.map(tokenKey -> StrUtil.subAfter(tokenKey, StringConstants.COLON, true))
.map(token -> {
Object loginIdObj = StpUtil.getLoginIdByToken(token);
long tokenTimeout = StpUtil.getStpLogic().getTokenActiveTimeoutByToken(token);
// 将相关信息打包成对象或简单的Entry对便于后续过滤与归类
return new AbstractMap.SimpleEntry<>(token, new AbstractMap.SimpleEntry<>(loginIdObj, tokenTimeout));
})
// 过滤出未过期且loginId存在的Token
.filter(entry -> {
Object loginIdObj = entry.getValue().getKey();
long tokenTimeout = entry.getValue().getValue();
return loginIdObj != null && tokenTimeout >= SaTokenDao.NEVER_EXPIRE;
})
// 此时数据都有效,进行收集
.collect(Collectors.groupingBy(entry -> Convert.toLong(entry.getValue().getKey()), Collectors
.mapping(AbstractMap.SimpleEntry::getKey, Collectors.toList())));
// 筛选数据
for (Map.Entry<Long, List<String>> entry : tokenMap.entrySet()) {
Long userId = entry.getKey();

View File

@@ -16,6 +16,7 @@
package top.continew.admin.system.mapper;
import org.apache.ibatis.annotations.Mapper;
import top.continew.admin.system.model.entity.ClientDO;
import top.continew.starter.data.mp.base.BaseMapper;
@@ -25,5 +26,6 @@ import top.continew.starter.data.mp.base.BaseMapper;
* @author KAI
* @since 2024/12/03 16:04
*/
@Mapper
public interface ClientMapper extends BaseMapper<ClientDO> {
}

View File

@@ -16,6 +16,7 @@
package top.continew.admin.system.mapper;
import org.apache.ibatis.annotations.Mapper;
import top.continew.admin.system.model.entity.DeptDO;
import top.continew.starter.data.mp.base.BaseMapper;
@@ -25,5 +26,6 @@ import top.continew.starter.data.mp.base.BaseMapper;
* @author Charles7c
* @since 2023/1/22 17:56
*/
@Mapper
public interface DeptMapper extends BaseMapper<DeptDO> {
}

View File

@@ -17,6 +17,7 @@
package top.continew.admin.system.mapper;
import com.alicp.jetcache.anno.Cached;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import top.continew.admin.common.constant.CacheConstants;
import top.continew.admin.system.model.entity.DictItemDO;
@@ -31,6 +32,7 @@ import java.util.List;
* @author Charles7c
* @since 2023/9/11 21:29
*/
@Mapper
public interface DictItemMapper extends BaseMapper<DictItemDO> {
/**

View File

@@ -16,6 +16,7 @@
package top.continew.admin.system.mapper;
import org.apache.ibatis.annotations.Mapper;
import top.continew.admin.system.model.entity.DictDO;
import top.continew.starter.data.mp.base.BaseMapper;
@@ -25,5 +26,6 @@ import top.continew.starter.data.mp.base.BaseMapper;
* @author Charles7c
* @since 2023/9/11 21:29
*/
@Mapper
public interface DictMapper extends BaseMapper<DictDO> {
}

View File

@@ -16,6 +16,7 @@
package top.continew.admin.system.mapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import top.continew.admin.system.model.entity.FileDO;
import top.continew.admin.system.model.resp.file.FileStatisticsResp;
@@ -29,6 +30,7 @@ import java.util.List;
* @author Charles7c
* @since 2023/12/23 10:38
*/
@Mapper
public interface FileMapper extends BaseMapper<FileDO> {
/**

View File

@@ -20,6 +20,7 @@ import com.alicp.jetcache.anno.Cached;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import top.continew.admin.common.constant.CacheConstants;
@@ -39,6 +40,7 @@ import java.util.List;
* @author Charles7c
* @since 2022/12/22 21:47
*/
@Mapper
public interface LogMapper extends BaseMapper<LogDO> {
/**

View File

@@ -16,6 +16,7 @@
package top.continew.admin.system.mapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import top.continew.admin.system.model.entity.MenuDO;
import top.continew.starter.data.mp.base.BaseMapper;
@@ -29,6 +30,7 @@ import java.util.Set;
* @author Charles7c
* @since 2023/2/15 20:30
*/
@Mapper
public interface MenuMapper extends BaseMapper<MenuDO> {
/**

View File

@@ -16,6 +16,7 @@
package top.continew.admin.system.mapper;
import org.apache.ibatis.annotations.Mapper;
import top.continew.admin.system.model.entity.MessageLogDO;
import top.continew.starter.data.mp.base.BaseMapper;
@@ -26,5 +27,6 @@ import top.continew.starter.data.mp.base.BaseMapper;
* @author Charles7c
* @since 2023/10/15 20:25
*/
@Mapper
public interface MessageLogMapper extends BaseMapper<MessageLogDO> {
}

View File

@@ -18,6 +18,7 @@ package top.continew.admin.system.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import top.continew.admin.system.model.entity.MessageDO;
import top.continew.admin.system.model.query.MessageQuery;
@@ -33,6 +34,7 @@ import java.util.List;
* @author Bull-BCLS
* @since 2023/10/15 19:05
*/
@Mapper
public interface MessageMapper extends BaseMapper<MessageDO> {
/**

View File

@@ -16,6 +16,7 @@
package top.continew.admin.system.mapper;
import org.apache.ibatis.annotations.Mapper;
import top.continew.admin.system.model.entity.NoticeLogDO;
import top.continew.starter.data.mp.base.BaseMapper;
@@ -25,5 +26,6 @@ import top.continew.starter.data.mp.base.BaseMapper;
* @author Charles7c
* @since 2025/5/18 19:17
*/
@Mapper
public interface NoticeLogMapper extends BaseMapper<NoticeLogDO> {
}

View File

@@ -18,6 +18,7 @@ package top.continew.admin.system.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import top.continew.admin.system.model.entity.NoticeDO;
import top.continew.admin.system.model.query.NoticeQuery;
@@ -33,6 +34,7 @@ import java.util.List;
* @author Charles7c
* @since 2023/8/20 10:55
*/
@Mapper
public interface NoticeMapper extends BaseMapper<NoticeDO> {
/**

View File

@@ -16,6 +16,7 @@
package top.continew.admin.system.mapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import top.continew.admin.system.model.entity.OptionDO;
@@ -29,6 +30,7 @@ import java.util.List;
* @author Bull-BCLS
* @since 2023/8/26 19:38
*/
@Mapper
public interface OptionMapper extends BaseMapper<OptionDO> {
/**

View File

@@ -16,6 +16,7 @@
package top.continew.admin.system.mapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import top.continew.admin.system.model.entity.RoleDeptDO;
@@ -29,6 +30,7 @@ import java.util.List;
* @author Charles7c
* @since 2023/2/18 21:57
*/
@Mapper
public interface RoleDeptMapper extends BaseMapper<RoleDeptDO> {
/**

View File

@@ -16,6 +16,7 @@
package top.continew.admin.system.mapper;
import org.apache.ibatis.annotations.Mapper;
import top.continew.admin.system.model.entity.RoleDO;
import top.continew.starter.data.mp.base.BaseMapper;
@@ -25,5 +26,6 @@ import top.continew.starter.data.mp.base.BaseMapper;
* @author Charles7c
* @since 2023/2/8 23:17
*/
@Mapper
public interface RoleMapper extends BaseMapper<RoleDO> {
}

View File

@@ -16,6 +16,7 @@
package top.continew.admin.system.mapper;
import org.apache.ibatis.annotations.Mapper;
import top.continew.admin.system.model.entity.RoleMenuDO;
import top.continew.starter.data.mp.base.BaseMapper;
@@ -27,6 +28,7 @@ import java.util.List;
* @author Charles7c
* @since 2023/2/15 20:30
*/
@Mapper
public interface RoleMenuMapper extends BaseMapper<RoleMenuDO> {
/**

View File

@@ -16,6 +16,7 @@
package top.continew.admin.system.mapper;
import org.apache.ibatis.annotations.Mapper;
import top.continew.starter.data.mp.base.BaseMapper;
import top.continew.admin.system.model.entity.SmsConfigDO;
@@ -25,4 +26,5 @@ import top.continew.admin.system.model.entity.SmsConfigDO;
* @author luoqiz
* @since 2025/03/15 18:41
*/
@Mapper
public interface SmsConfigMapper extends BaseMapper<SmsConfigDO> {}

View File

@@ -16,6 +16,7 @@
package top.continew.admin.system.mapper;
import org.apache.ibatis.annotations.Mapper;
import top.continew.starter.data.mp.base.BaseMapper;
import top.continew.admin.system.model.entity.SmsLogDO;
@@ -25,4 +26,5 @@ import top.continew.admin.system.model.entity.SmsLogDO;
* @author luoqiz
* @since 2025/03/15 22:15
*/
@Mapper
public interface SmsLogMapper extends BaseMapper<SmsLogDO> {}

View File

@@ -16,6 +16,7 @@
package top.continew.admin.system.mapper;
import org.apache.ibatis.annotations.Mapper;
import top.continew.admin.system.model.entity.StorageDO;
import top.continew.starter.data.mp.base.BaseMapper;
@@ -25,5 +26,6 @@ import top.continew.starter.data.mp.base.BaseMapper;
* @author Charles7c
* @since 2023/12/26 22:09
*/
@Mapper
public interface StorageMapper extends BaseMapper<StorageDO> {
}

View File

@@ -19,6 +19,7 @@ package top.continew.admin.system.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import top.continew.admin.system.model.entity.UserRoleDO;
import top.continew.admin.system.model.resp.role.RoleUserResp;
@@ -30,6 +31,7 @@ import top.continew.starter.data.mp.base.BaseMapper;
* @author Charles7c
* @since 2023/2/13 23:13
*/
@Mapper
public interface UserRoleMapper extends BaseMapper<UserRoleDO> {
/**

View File

@@ -19,6 +19,7 @@ package top.continew.admin.system.mapper.user;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import top.continew.admin.common.config.mybatis.DataPermissionMapper;
@@ -35,6 +36,7 @@ import java.util.List;
* @author Charles7c
* @since 2022/12/22 21:47
*/
@Mapper
public interface UserMapper extends DataPermissionMapper<UserDO> {
/**

View File

@@ -16,6 +16,7 @@
package top.continew.admin.system.mapper.user;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import top.continew.admin.system.model.entity.user.UserPasswordHistoryDO;
import top.continew.starter.data.mp.base.BaseMapper;
@@ -26,6 +27,7 @@ import top.continew.starter.data.mp.base.BaseMapper;
* @author Charles7c
* @since 2024/5/16 21:58
*/
@Mapper
public interface UserPasswordHistoryMapper extends BaseMapper<UserPasswordHistoryDO> {
/**

View File

@@ -16,6 +16,7 @@
package top.continew.admin.system.mapper.user;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import top.continew.admin.system.model.entity.user.UserSocialDO;
import top.continew.starter.data.mp.base.BaseMapper;
@@ -26,6 +27,7 @@ import top.continew.starter.data.mp.base.BaseMapper;
* @author Charles7c
* @since 2023/10/11 22:10
*/
@Mapper
public interface UserSocialMapper extends BaseMapper<UserSocialDO> {
/**