Skip to content

Commit efb65c2

Browse files
committed
refactor: 为 Mapper 接口增加 Mapper 注解,以消除 IDEA 警告标志(减少小白咨询)
实际它并不影响运行,但为了减少麻烦,加上不报警告,那就加上吧
1 parent 4c14feb commit efb65c2

27 files changed

Lines changed: 70 additions & 20 deletions

File tree

‎continew-plugin/continew-plugin-generator/src/main/java/top/continew/admin/generator/mapper/FieldConfigMapper.java‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package top.continew.admin.generator.mapper;
1818

19+
import org.apache.ibatis.annotations.Mapper;
1920
import org.apache.ibatis.annotations.Param;
2021
import org.apache.ibatis.annotations.Select;
2122
import top.continew.admin.generator.model.entity.FieldConfigDO;
@@ -29,6 +30,7 @@
2930
* @author Charles7c
3031
* @since 2023/4/12 23:56
3132
*/
33+
@Mapper
3234
public interface FieldConfigMapper extends BaseMapper<FieldConfigDO> {
3335

3436
/**

‎continew-plugin/continew-plugin-generator/src/main/java/top/continew/admin/generator/mapper/GenConfigMapper.java‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package top.continew.admin.generator.mapper;
1818

19+
import org.apache.ibatis.annotations.Mapper;
1920
import top.continew.admin.generator.model.entity.GenConfigDO;
2021
import top.continew.starter.data.mp.base.BaseMapper;
2122

@@ -25,5 +26,6 @@
2526
* @author Charles7c
2627
* @since 2023/4/12 23:56
2728
*/
29+
@Mapper
2830
public interface GenConfigMapper extends BaseMapper<GenConfigDO> {
2931
}
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
package ${packageName}.${subPackageName};
22

3-
import top.continew.starter.data.mp.base.BaseMapper;
3+
import org.apache.ibatis.annotations.Mapper;
44
import ${packageName}.model.entity.${classNamePrefix}DO;
5+
import top.continew.starter.data.mp.base.BaseMapper;
56

67
/**
78
* ${businessName} Mapper
89
*
910
* @author ${author}
1011
* @since ${datetime}
1112
*/
13+
@Mapper
1214
public interface ${className} extends BaseMapper<${classNamePrefix}DO> {}

‎continew-plugin/continew-plugin-open/src/main/java/top/continew/admin/open/mapper/AppMapper.java‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package top.continew.admin.open.mapper;
1818

19+
import org.apache.ibatis.annotations.Mapper;
1920
import org.apache.ibatis.annotations.Param;
2021
import org.apache.ibatis.annotations.Select;
2122
import top.continew.admin.open.model.entity.AppDO;
@@ -28,6 +29,7 @@
2829
* @author chengzi
2930
* @since 2024/10/17 16:03
3031
*/
32+
@Mapper
3133
public interface AppMapper extends BaseMapper<AppDO> {
3234

3335
/**

‎continew-system/src/main/java/top/continew/admin/auth/service/impl/OnlineUserServiceImpl.java‎

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -63,25 +63,23 @@ public List<OnlineUserResp> list(OnlineUserQuery query) {
6363
// 查询所有在线 Token
6464
List<String> tokenKeyList = StpUtil.searchTokenValue(StringConstants.EMPTY, 0, -1, false);
6565
Map<Long, List<String>> tokenMap = tokenKeyList.stream()
66-
// 提前映射,避免重复调用
67-
.map(tokenKey -> StrUtil.subAfter(tokenKey, StringConstants.COLON, true))
68-
.map(token -> {
69-
Object loginIdObj = StpUtil.getLoginIdByToken(token);
70-
long tokenTimeout = StpUtil.getStpLogic().getTokenActiveTimeoutByToken(token);
71-
// 将相关信息打包成对象或简单的Entry对,便于后续过滤与归类
72-
return new AbstractMap.SimpleEntry<>(token, new AbstractMap.SimpleEntry<>(loginIdObj, tokenTimeout));
73-
})
74-
// 过滤出未过期且loginId存在的Token
75-
.filter(entry -> {
76-
Object loginIdObj = entry.getValue().getKey();
77-
long tokenTimeout = entry.getValue().getValue();
78-
return loginIdObj != null && tokenTimeout >= SaTokenDao.NEVER_EXPIRE;
79-
})
80-
// 此时数据都有效,进行收集
81-
.collect(Collectors.groupingBy(
82-
entry -> Convert.toLong(entry.getValue().getKey()),
83-
Collectors.mapping(AbstractMap.SimpleEntry::getKey, Collectors.toList()))
84-
);
66+
// 提前映射,避免重复调用
67+
.map(tokenKey -> StrUtil.subAfter(tokenKey, StringConstants.COLON, true))
68+
.map(token -> {
69+
Object loginIdObj = StpUtil.getLoginIdByToken(token);
70+
long tokenTimeout = StpUtil.getStpLogic().getTokenActiveTimeoutByToken(token);
71+
// 将相关信息打包成对象或简单的Entry对,便于后续过滤与归类
72+
return new AbstractMap.SimpleEntry<>(token, new AbstractMap.SimpleEntry<>(loginIdObj, tokenTimeout));
73+
})
74+
// 过滤出未过期且loginId存在的Token
75+
.filter(entry -> {
76+
Object loginIdObj = entry.getValue().getKey();
77+
long tokenTimeout = entry.getValue().getValue();
78+
return loginIdObj != null && tokenTimeout >= SaTokenDao.NEVER_EXPIRE;
79+
})
80+
// 此时数据都有效,进行收集
81+
.collect(Collectors.groupingBy(entry -> Convert.toLong(entry.getValue().getKey()), Collectors
82+
.mapping(AbstractMap.SimpleEntry::getKey, Collectors.toList())));
8583
// 筛选数据
8684
for (Map.Entry<Long, List<String>> entry : tokenMap.entrySet()) {
8785
Long userId = entry.getKey();

‎continew-system/src/main/java/top/continew/admin/system/mapper/ClientMapper.java‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package top.continew.admin.system.mapper;
1818

19+
import org.apache.ibatis.annotations.Mapper;
1920
import top.continew.admin.system.model.entity.ClientDO;
2021
import top.continew.starter.data.mp.base.BaseMapper;
2122

@@ -25,5 +26,6 @@
2526
* @author KAI
2627
* @since 2024/12/03 16:04
2728
*/
29+
@Mapper
2830
public interface ClientMapper extends BaseMapper<ClientDO> {
2931
}

‎continew-system/src/main/java/top/continew/admin/system/mapper/DeptMapper.java‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package top.continew.admin.system.mapper;
1818

19+
import org.apache.ibatis.annotations.Mapper;
1920
import top.continew.admin.system.model.entity.DeptDO;
2021
import top.continew.starter.data.mp.base.BaseMapper;
2122

@@ -25,5 +26,6 @@
2526
* @author Charles7c
2627
* @since 2023/1/22 17:56
2728
*/
29+
@Mapper
2830
public interface DeptMapper extends BaseMapper<DeptDO> {
2931
}

‎continew-system/src/main/java/top/continew/admin/system/mapper/DictItemMapper.java‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package top.continew.admin.system.mapper;
1818

1919
import com.alicp.jetcache.anno.Cached;
20+
import org.apache.ibatis.annotations.Mapper;
2021
import org.apache.ibatis.annotations.Param;
2122
import top.continew.admin.common.constant.CacheConstants;
2223
import top.continew.admin.system.model.entity.DictItemDO;
@@ -31,6 +32,7 @@
3132
* @author Charles7c
3233
* @since 2023/9/11 21:29
3334
*/
35+
@Mapper
3436
public interface DictItemMapper extends BaseMapper<DictItemDO> {
3537

3638
/**

‎continew-system/src/main/java/top/continew/admin/system/mapper/DictMapper.java‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package top.continew.admin.system.mapper;
1818

19+
import org.apache.ibatis.annotations.Mapper;
1920
import top.continew.admin.system.model.entity.DictDO;
2021
import top.continew.starter.data.mp.base.BaseMapper;
2122

@@ -25,5 +26,6 @@
2526
* @author Charles7c
2627
* @since 2023/9/11 21:29
2728
*/
29+
@Mapper
2830
public interface DictMapper extends BaseMapper<DictDO> {
2931
}

‎continew-system/src/main/java/top/continew/admin/system/mapper/FileMapper.java‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package top.continew.admin.system.mapper;
1818

19+
import org.apache.ibatis.annotations.Mapper;
1920
import org.apache.ibatis.annotations.Select;
2021
import top.continew.admin.system.model.entity.FileDO;
2122
import top.continew.admin.system.model.resp.file.FileStatisticsResp;
@@ -29,6 +30,7 @@
2930
* @author Charles7c
3031
* @since 2023/12/23 10:38
3132
*/
33+
@Mapper
3234
public interface FileMapper extends BaseMapper<FileDO> {
3335

3436
/**

0 commit comments

Comments
 (0)