Skip to content

Commit

Permalink
Feat/group ids required (#88)
Browse files Browse the repository at this point in the history
* 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: 桔子 <juzi214032@qq.com>
  • Loading branch information
colorful3 and juzi214032 committed Jul 17, 2020
1 parent 507c924 commit 23a87e4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import lombok.Data;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotEmpty;
import java.util.List;

/**
Expand All @@ -12,5 +13,7 @@
@Data
public class UpdateUserInfoDTO {

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

}
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,6 @@ public boolean deleteUser(Integer id) {
@Override
public boolean updateUserInfo(Integer id, UpdateUserInfoDTO validator) {
List<Integer> newGroupIds = validator.getGroupIds();
if (newGroupIds == null || newGroupIds.isEmpty()) {
return false;
}
Integer rootGroupId = groupService.getParticularGroupIdByLevel(GroupLevelEnum.ROOT);
boolean anyMatch = newGroupIds.stream().anyMatch(it -> it.equals(rootGroupId));
if (anyMatch) {
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/ValidationMessages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ page.number.min=\u5206\u9875\u9875\u7801\u5FC5\u987B\u4E3A\u6B63\u6574\u6570
group.id.positive=\u5206\u7EC4id\u5FC5\u987B\u4E3A\u6B63\u6574\u6570
group.id.not-null=\u5206\u7EC4id\u4E0D\u53EF\u4E3A\u7A7A
group.ids.long-list=\u5206\u7EC4id\u6BCF\u4E00\u9879\u5FC5\u987B\u4E3A\u6B63\u6574\u6570
group.ids.not-empty=\u81F3\u5C11\u9009\u62E9\u4E00\u4E2A\u5206\u7EC4
group.name.not-blank=\u8BF7\u8F93\u5165\u5206\u7EC4\u540D\u79F0
group.name.length=\u5206\u7EC4\u540D\u79F0\u4E0D\u53EF\u8D85\u8FC760\u5B57\u7B26
group.info.length=\u5206\u7EC4\u63CF\u8FF0\u4E0D\u53EF\u8D85\u8FC7255\u5B57\u7B26
Expand Down

0 comments on commit 23a87e4

Please sign in to comment.