Skip to content

Commit

Permalink
1.7 优化
Browse files Browse the repository at this point in the history
  • Loading branch information
zhengjie committed Apr 16, 2019
1 parent 5a88fee commit 4486384
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package me.zhengjie.modules.security.service;

import me.zhengjie.modules.system.domain.Permission;
import me.zhengjie.modules.system.domain.Role;
import me.zhengjie.modules.system.domain.User;
import me.zhengjie.modules.system.domain.*;
import me.zhengjie.exception.EntityNotFoundException;
import me.zhengjie.modules.system.repository.PermissionRepository;
import me.zhengjie.modules.system.repository.RoleRepository;
Expand All @@ -19,6 +17,7 @@
import org.springframework.transaction.annotation.Transactional;
import java.util.HashSet;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;

Expand Down Expand Up @@ -55,8 +54,8 @@ public UserDetails createJwtUser(User user) {
user.getAvatar(),
user.getEmail(),
user.getPhone(),
user.getDept().getName(),
user.getJob().getName(),
Optional.ofNullable(user.getDept()).map(Dept::getName).orElse(null),
Optional.ofNullable(user.getJob()).map(Job::getName).orElse(null),
permissionService.mapToGrantedAuthorities(user),
user.getEnabled(),
user.getCreateTime(),
Expand Down

0 comments on commit 4486384

Please sign in to comment.