Skip to content

Commit 3075e50

Browse files
juzi214032colorful3
authored andcommitted
refactor(DataType): 重构所有 id 数据类型
将所有 Long 类型 id,修改为 Integer 类型
1 parent a44bada commit 3075e50

6 files changed

Lines changed: 14 additions & 10 deletions

File tree

src/main/java/io/github/talelin/latticy/common/util/PageUtil.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,14 @@
1111
public class PageUtil {
1212

1313
public static <T> PageResponseVO<T> build(IPage<T> iPage) {
14-
return new PageResponseVO<>(iPage.getTotal(), iPage.getRecords(), iPage.getCurrent(), iPage.getSize());
14+
return new PageResponseVO<T>(Math.toIntExact(iPage.getTotal()), iPage.getRecords(),
15+
Math.toIntExact(iPage.getCurrent()), Math.toIntExact(iPage.getSize()));
1516
}
1617

1718
public static <K, T> PageResponseVO<K> build(IPage<T> iPage, List<K> records) {
18-
return new PageResponseVO<>(iPage.getTotal(), records, iPage.getCurrent(), iPage.getSize());
19+
return new PageResponseVO<K>(Math.toIntExact(iPage.getTotal()), records,
20+
Math.toIntExact(iPage.getCurrent()),
21+
Math.toIntExact(iPage.getSize()));
1922
}
2023

2124
}

src/main/java/io/github/talelin/latticy/service/UserIdentityService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,5 +80,5 @@ UserIdentityDO createUsernamePasswordIdentity(Integer userId,
8080
* @param password 新密码
8181
* @return 是否成功
8282
*/
83-
boolean changeUsernamePassword(Long userId, String username, String password);
83+
boolean changeUsernamePassword(Integer userId, String username, String password);
8484
}

src/main/java/io/github/talelin/latticy/service/impl/UserIdentityServiceImpl.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,9 @@ public boolean changeUsername(Integer userId, String username) {
6868
}
6969

7070
@Override
71-
public boolean changeUsernamePassword(Long userId, String username, String password) {
72-
UserIdentityDO userIdentity = UserIdentityDO.builder().identifier(username).credential(password).build();
71+
public boolean changeUsernamePassword(Integer userId, String username, String password) {
72+
UserIdentityDO userIdentity =
73+
UserIdentityDO.builder().identifier(username).credential(password).build();
7374
QueryWrapper<UserIdentityDO> wrapper = new QueryWrapper<>();
7475
wrapper.lambda().eq(UserIdentityDO::getUserId, userId);
7576
return this.baseMapper.update(userIdentity, wrapper) > 0;

src/main/java/io/github/talelin/latticy/vo/PageResponseVO.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818
@Builder
1919
public class PageResponseVO<T> {
2020

21-
private long total;
21+
private Integer total;
2222

2323
private List<T> items;
2424

25-
private long page;
25+
private Integer page;
2626

27-
private long count;
27+
private Integer count;
2828
}

src/main/java/io/github/talelin/latticy/vo/UserInfoVO.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
@NoArgsConstructor
2121
public class UserInfoVO {
2222

23-
private Long id;
23+
private Integer id;
2424

2525
/**
2626
* 用户名,唯一

src/main/java/io/github/talelin/latticy/vo/UserPermissionVO.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
@Data
1717
public class UserPermissionVO {
1818

19-
private Long id;
19+
private Integer id;
2020

2121
private String nickname;
2222

0 commit comments

Comments
 (0)