Skip to content

Commit 23a87e4

Browse files
colorful3juzi214032
andcommitted
Feat/group ids required (#88)
* refactor(Page): 重构 Page 分页对象 采用继承的方式重构 Page 分页对象,减少无用代码 1.解决重写了过时方法的问题 2.修复“因没有修改 hashNext()方法”而可能导致的 bug * refactor(UserPermissionVO): 为 UserPermissionVO 的 permissions 属性指定泛型 * refactor(Page): 将 Page 分页对象泛型参数列表补充完整 * chore(pom): 为 Maven 指定 file.encoding 参数,解决运行 mvn test 报错问题 因为在 application.properties 中指定了 spring.mandatory-file-encoding=UTF-8,FileEncodingApplicationListener 类检测到当前系统编码与 mandatory-file-encoding 不一致的情况下会报错 * fix(Page): 修复分页问题 Page 分页对象重写 offset() 方法。 修复分页指定为 1 时,却返回第 1 页数据的问题 (因起始页为0,正确的应该返回第 2 页的数据) * feat: 新增更新用户信息接口对于 group_ids 字段的校验 Co-authored-by: 桔子 <[email protected]>
1 parent 507c924 commit 23a87e4

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

src/main/java/io/github/talelin/latticy/dto/admin/UpdateUserInfoDTO.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import lombok.Data;
44

55
import javax.validation.constraints.Min;
6+
import javax.validation.constraints.NotEmpty;
67
import java.util.List;
78

89
/**
@@ -12,5 +13,7 @@
1213
@Data
1314
public class UpdateUserInfoDTO {
1415

16+
@NotEmpty(message = "{group.ids.not-empty}")
1517
private List<@Min(1) Integer> groupIds;
18+
1619
}

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,6 @@ public boolean deleteUser(Integer id) {
9393
@Override
9494
public boolean updateUserInfo(Integer id, UpdateUserInfoDTO validator) {
9595
List<Integer> newGroupIds = validator.getGroupIds();
96-
if (newGroupIds == null || newGroupIds.isEmpty()) {
97-
return false;
98-
}
9996
Integer rootGroupId = groupService.getParticularGroupIdByLevel(GroupLevelEnum.ROOT);
10097
boolean anyMatch = newGroupIds.stream().anyMatch(it -> it.equals(rootGroupId));
10198
if (anyMatch) {

src/main/resources/ValidationMessages.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ page.number.min=\u5206\u9875\u9875\u7801\u5FC5\u987B\u4E3A\u6B63\u6574\u6570
77
group.id.positive=\u5206\u7EC4id\u5FC5\u987B\u4E3A\u6B63\u6574\u6570
88
group.id.not-null=\u5206\u7EC4id\u4E0D\u53EF\u4E3A\u7A7A
99
group.ids.long-list=\u5206\u7EC4id\u6BCF\u4E00\u9879\u5FC5\u987B\u4E3A\u6B63\u6574\u6570
10+
group.ids.not-empty=\u81F3\u5C11\u9009\u62E9\u4E00\u4E2A\u5206\u7EC4
1011
group.name.not-blank=\u8BF7\u8F93\u5165\u5206\u7EC4\u540D\u79F0
1112
group.name.length=\u5206\u7EC4\u540D\u79F0\u4E0D\u53EF\u8D85\u8FC760\u5B57\u7B26
1213
group.info.length=\u5206\u7EC4\u63CF\u8FF0\u4E0D\u53EF\u8D85\u8FC7255\u5B57\u7B26

0 commit comments

Comments
 (0)