diff --git a/src/main/java/com/xkrs/controller/SysUserController.java b/src/main/java/com/xkrs/controller/SysUserController.java index a58e580..399d131 100644 --- a/src/main/java/com/xkrs/controller/SysUserController.java +++ b/src/main/java/com/xkrs/controller/SysUserController.java @@ -24,6 +24,7 @@ import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; import java.io.IOException; import java.util.HashMap; +import java.util.List; import java.util.Locale; import java.util.Map; import java.util.concurrent.TimeUnit; @@ -298,4 +299,19 @@ public class SysUserController { } } + /** + * 管理员查看全部的用户信息 + * @return + */ + @GetMapping("/selectAllUser") + @PreAuthorize("hasAnyAuthority('auth_administor')") + public String selectAllUser(@RequestHeader(value="Authorization") String token){ + Locale locale = LocaleContextHolder.getLocale(); + List> maps = sysUserDao.selectAllUser(); + if(maps == null || maps.size() == 0){ + return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"暂时没有任何用户数据!",locale); + } + return outputEncapsulationObject(PromptMessageEnum.SUCCESS,maps,locale); + } + } diff --git a/src/main/java/com/xkrs/dao/SysUserDao.java b/src/main/java/com/xkrs/dao/SysUserDao.java index 994b916..aea5e06 100644 --- a/src/main/java/com/xkrs/dao/SysUserDao.java +++ b/src/main/java/com/xkrs/dao/SysUserDao.java @@ -7,6 +7,9 @@ import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; +import java.util.List; +import java.util.Map; + /** * SysUserDao * @author tajochen @@ -141,4 +144,13 @@ public interface SysUserDao extends JpaRepository { @Modifying(clearAutomatically=true) void updateDisable(Integer userId); + /** + * 管理员查看所有的用户信息 + * @return + */ + @Query(value = "select nick_name nickname,avatar,telephone,province,city,county," + + "identifier,identity,active_flag activeflag,last_entry_ip lastentryip," + + "last_entry_time lastentrytime,add_time addtime from sys_user",nativeQuery = true) + List> selectAllUser(); + } diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 8b3ed0a..76c0094 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -50,7 +50,8 @@ spring.cache.type = redis spring.redis.database = 8 spring.redis.host = localhost spring.redis.port = 6379 -spring.redis.password=lybABC123 +#spring.redis.password=lybABC123 +spring.redis.password=sdust2020 spring.redis.timeout = 10000 spring.redis.lettuce.pool.max-active = 100 spring.redis.lettuce.pool.max-wait = 10000