|
|
@@ -103,7 +103,8 @@ public class UserService {
|
|
|
return userRepo.save(user);
|
|
|
}
|
|
|
|
|
|
- public Page<User> all(PageQuery pageQuery) {
|
|
|
+ @Cacheable(value = "userList", key = "#pageQuery.hashCode()")
|
|
|
+ public PageWrapper<User> all(PageQuery pageQuery) {
|
|
|
Specification<User> specification = JpaUtils.toSpecification(pageQuery, User.class);
|
|
|
|
|
|
specification = specification.and((Specification<User>) (root, criteriaQuery, criteriaBuilder) -> {
|
|
|
@@ -132,7 +133,8 @@ public class UserService {
|
|
|
}
|
|
|
return criteriaBuilder.and(and.toArray(new Predicate[0]));
|
|
|
});
|
|
|
- return userRepo.findAll(specification, JpaUtils.toPageRequest(pageQuery));
|
|
|
+ Page<User> page = userRepo.findAll(specification, JpaUtils.toPageRequest(pageQuery));
|
|
|
+ return PageWrapper.of(page);
|
|
|
}
|
|
|
|
|
|
public User create(UserRegister userRegister) {
|
|
|
@@ -609,7 +611,7 @@ public class UserService {
|
|
|
}
|
|
|
|
|
|
public Map<String, Object> invite(PageQuery pageQuery) {
|
|
|
- Page<User> all = this.all(pageQuery);
|
|
|
+ Page<User> all = this.all(pageQuery).toPage();
|
|
|
|
|
|
List<Long> userIds = all.map(User::getId).getContent();
|
|
|
List<TokenHistory> page = tokenHistoryRepo.userBuy(userIds);
|