baihe 1 жил өмнө
parent
commit
5988403407
100 өөрчлөгдсөн 587 нэмэгдсэн , 638 устгасан
  1. 1 1
      assembly/component.xml
  2. 1 0
      assembly/package-lib.xml
  3. 20 7
      component-common/pom.xml
  4. 0 0
      component-common/src/main/java/com/gihon/component/config/BaseMybatisConfiguration.java
  5. 0 0
      component-common/src/main/java/com/gihon/component/config/MyMetaObjectHandler.java
  6. 8 1
      component-common/src/main/java/com/gihon/component/config/ScheduleConfig.java
  7. 6 2
      component-common/src/main/java/com/gihon/component/config/ThreadPoolConfig.java
  8. 0 0
      component-common/src/main/java/com/gihon/component/entity/BaseEntity.java
  9. 0 0
      component-common/src/main/java/com/gihon/component/entity/CompanyBaseEntity.java
  10. 0 0
      component-common/src/main/java/com/gihon/component/response/PageBean.java
  11. 0 0
      component-common/src/main/java/com/gihon/component/response/Response.java
  12. 0 0
      component-common/src/main/java/com/gihon/component/response/ResponseStatus.java
  13. 0 0
      component-common/src/main/java/com/gihon/component/response/SelectVal.java
  14. 0 0
      component-common/src/main/java/com/gihon/component/vo/BaseReq.java
  15. 0 0
      component-common/src/main/java/com/gihon/component/vo/PageReq.java
  16. 0 0
      component-common/src/main/java/com/gihon/component/web/aspect/LogAspect.java
  17. 0 0
      component-common/src/main/java/com/gihon/component/web/auth/AuthService.java
  18. 0 2
      component-common/src/main/java/com/gihon/component/web/auth/AuthTokenInterceptor.java
  19. 2 0
      component-common/src/main/java/com/gihon/component/web/auth/AuthUtils.java
  20. 9 9
      component-common/src/main/java/com/gihon/component/web/auth/AuthenticationInterceptor.java
  21. 122 0
      component-common/src/main/java/com/gihon/component/web/auth/impl/AuthServiceImpl.java
  22. 0 0
      component-common/src/main/java/com/gihon/component/web/config/AuthWebMvcConfig.java
  23. 0 0
      component-common/src/main/java/com/gihon/component/web/config/CommonExceptionController.java
  24. 1 0
      component-common/src/main/java/com/gihon/component/web/config/CommonWebConfig.java
  25. 18 21
      component-common/src/main/java/com/gihon/component/web/config/DemoKnife4jConfig.java
  26. 0 0
      component-common/src/main/java/com/gihon/component/web/config/HttpErrorController.java
  27. 1 1
      component-common/src/main/java/com/gihon/component/web/config/ValidationInterceptor.java
  28. 8 8
      component-common/src/main/java/com/gihon/component/web/config/WebMvcConfig.java
  29. 0 0
      component-common/src/main/java/com/gihon/component/web/redis/RedisKeyExpirationListener.java
  30. 0 0
      component-common/src/main/java/com/gihon/component/web/redis/RedisListenerConfig.java
  31. 0 0
      component-common/src/main/java/com/gihon/component/web/redis/package-info.java
  32. 0 6
      component-common/src/main/java/com/gihon/component/web/service/TokenService.java
  33. 2 22
      component-common/src/main/java/com/gihon/component/web/service/impl/TokenServiceImpl.java
  34. 23 0
      component-common/src/main/java/com/gihon/component/web/service/impl/UserInfoService.java
  35. 0 0
      component-common/src/main/java/com/gihon/component/web/vo/LoginUser.java
  36. 0 0
      component-common/src/main/java/com/gihon/component/web/vo/MenuVO.java
  37. 0 0
      component-common/src/main/java/com/gihon/component/web/vo/PermissionVO.java
  38. 0 0
      component-common/src/main/java/com/gihon/component/web/vo/RefreshTokenVal.java
  39. 0 0
      component-common/src/main/java/com/gihon/component/web/vo/SsoToken.java
  40. 0 0
      component-common/src/main/java/com/gihon/component/web/vo/TokenVal.java
  41. 0 10
      component-common/src/main/java/com/gihon/component/web/vo/UserInfo.java
  42. 0 0
      component-common/src/main/java/com/gihon/component/web/xss/XssConfig.java
  43. 0 0
      component-common/src/main/java/com/gihon/component/web/xss/XssFilter.java
  44. 0 0
      component-common/src/main/java/com/gihon/component/web/xss/XssHttpServletRequestWrapper.java
  45. 70 2
      component-common/src/main/resources/application-common.yml
  46. 0 46
      component-database/pom.xml
  47. 0 66
      component-database/src/main/resources/application-database.yml
  48. 0 271
      component-database/src/main/sql/gihon.sql
  49. 0 32
      component-entity/pom.xml
  50. 16 9
      component-springboot/pom.xml
  51. 1 1
      component-springboot/src/main/java/com/gihon/component/GihonRbacApplication.java
  52. 4 4
      component-springboot/src/main/java/com/gihon/component/rbac/controller/CompanyController.java
  53. 8 8
      component-springboot/src/main/java/com/gihon/component/rbac/controller/ModuleController.java
  54. 1 1
      component-springboot/src/main/java/com/gihon/component/rbac/controller/PermissionContoller.java
  55. 6 6
      component-springboot/src/main/java/com/gihon/component/rbac/controller/RoleController.java
  56. 4 4
      component-springboot/src/main/java/com/gihon/component/rbac/controller/UserController.java
  57. 1 1
      component-springboot/src/main/java/com/gihon/component/rbac/entity/GihonButton.java
  58. 1 1
      component-springboot/src/main/java/com/gihon/component/rbac/entity/GihonCompany.java
  59. 1 1
      component-springboot/src/main/java/com/gihon/component/rbac/entity/GihonMenu.java
  60. 1 1
      component-springboot/src/main/java/com/gihon/component/rbac/entity/GihonModule.java
  61. 1 1
      component-springboot/src/main/java/com/gihon/component/rbac/entity/GihonRole.java
  62. 1 1
      component-springboot/src/main/java/com/gihon/component/rbac/entity/GihonRoleButton.java
  63. 14 1
      component-springboot/src/main/java/com/gihon/component/rbac/entity/GihonUser.java
  64. 1 1
      component-springboot/src/main/java/com/gihon/component/rbac/entity/GihonUserRole.java
  65. 2 2
      component-springboot/src/main/java/com/gihon/component/rbac/mapper/GihonButtonMapper.java
  66. 2 2
      component-springboot/src/main/java/com/gihon/component/rbac/mapper/GihonCompanyMapper.java
  67. 2 2
      component-springboot/src/main/java/com/gihon/component/rbac/mapper/GihonMenuMapper.java
  68. 2 2
      component-springboot/src/main/java/com/gihon/component/rbac/mapper/GihonModuleMapper.java
  69. 2 2
      component-springboot/src/main/java/com/gihon/component/rbac/mapper/GihonRoleButtonMapper.java
  70. 2 2
      component-springboot/src/main/java/com/gihon/component/rbac/mapper/GihonRoleMapper.java
  71. 2 2
      component-springboot/src/main/java/com/gihon/component/rbac/mapper/GihonUserMapper.java
  72. 2 2
      component-springboot/src/main/java/com/gihon/component/rbac/mapper/GihonUserRoleMapper.java
  73. 1 1
      component-springboot/src/main/java/com/gihon/component/rbac/mapper/package-info.java
  74. 2 2
      component-springboot/src/main/java/com/gihon/component/rbac/service/GihonButtonService.java
  75. 3 3
      component-springboot/src/main/java/com/gihon/component/rbac/service/GihonCompanyService.java
  76. 2 2
      component-springboot/src/main/java/com/gihon/component/rbac/service/GihonMenuService.java
  77. 3 3
      component-springboot/src/main/java/com/gihon/component/rbac/service/GihonModuleService.java
  78. 2 2
      component-springboot/src/main/java/com/gihon/component/rbac/service/GihonRoleButtonService.java
  79. 5 5
      component-springboot/src/main/java/com/gihon/component/rbac/service/GihonRoleService.java
  80. 2 2
      component-springboot/src/main/java/com/gihon/component/rbac/service/GihonUserRoleService.java
  81. 3 3
      component-springboot/src/main/java/com/gihon/component/rbac/service/GihonUserService.java
  82. 5 5
      component-springboot/src/main/java/com/gihon/component/rbac/service/impl/GihonButtonServiceImpl.java
  83. 5 5
      component-springboot/src/main/java/com/gihon/component/rbac/service/impl/GihonCompanyServiceImpl.java
  84. 4 4
      component-springboot/src/main/java/com/gihon/component/rbac/service/impl/GihonMenuServiceImpl.java
  85. 5 5
      component-springboot/src/main/java/com/gihon/component/rbac/service/impl/GihonModuleServiceImpl.java
  86. 4 4
      component-springboot/src/main/java/com/gihon/component/rbac/service/impl/GihonRoleButtonServiceImpl.java
  87. 7 7
      component-springboot/src/main/java/com/gihon/component/rbac/service/impl/GihonRoleServiceImpl.java
  88. 4 4
      component-springboot/src/main/java/com/gihon/component/rbac/service/impl/GihonUserRoleServiceImpl.java
  89. 7 7
      component-springboot/src/main/java/com/gihon/component/rbac/service/impl/GihonUserServiceImpl.java
  90. 101 0
      component-springboot/src/main/java/com/gihon/component/rbac/service/impl/PermissionServiceImpl.java
  91. 1 1
      component-springboot/src/main/java/com/gihon/component/rbac/vo/CompanyListReq.java
  92. 1 1
      component-springboot/src/main/java/com/gihon/component/rbac/vo/ModuleListReq.java
  93. 1 1
      component-springboot/src/main/java/com/gihon/component/rbac/vo/RoleButtonReq.java
  94. 1 1
      component-springboot/src/main/java/com/gihon/component/rbac/vo/RoleListReq.java
  95. 1 1
      component-springboot/src/main/java/com/gihon/component/rbac/vo/UserListReq.java
  96. 0 0
      component-springboot/src/main/java/com/gihon/component/sso/controller/LoginController.java
  97. 0 0
      component-springboot/src/main/java/com/gihon/component/sso/service/LoginUserService.java
  98. 6 4
      component-springboot/src/main/java/com/gihon/component/sso/service/impl/LoginUserServiceImpl.java
  99. 40 0
      component-springboot/src/main/java/com/gihon/component/sso/service/impl/UserInfoServiceImpl.java
  100. 2 1
      component-springboot/src/main/resources/application-dev.yml

+ 1 - 1
assembly/component.xml

@@ -7,7 +7,7 @@
 			<unpack>false</unpack>
 			<!-- groupId:artifactId:type:classifier/groupId:artifactId -->
 			<includes>
-				<include>gihon.component:component-springboot</include>
+				<include>gihon.component</include>
 			</includes>
 		</dependencySet>
 	</dependencySets>

+ 1 - 0
assembly/package-lib.xml

@@ -11,6 +11,7 @@
 			<outputDirectory>lib</outputDirectory>
 			<unpack>false</unpack>
 			<!-- default scope runtime -->
+			<useProjectArtifact>false</useProjectArtifact>
 			<excludes>
 				<exclude>org.springframework.boot:spring-boot-devtools</exclude>
 				<exclude>org.springframework.boot:spring-boot-starter-test</exclude>

+ 20 - 7
component-common/pom.xml

@@ -6,7 +6,7 @@
 	<parent>
 		<groupId>gihon.component</groupId>
 		<artifactId>component-parent</artifactId>
-		<version>0.2.0-SNAPSHOT</version>
+		<version>0.3.0-SNAPSHOT</version>
 		<relativePath>../</relativePath>
 	</parent>
 	<artifactId>component-common</artifactId>
@@ -15,14 +15,27 @@
 	<description>通用工具类</description>
 
 	<dependencies>
-		<dependency>
-			<groupId>gihon.component</groupId>
-			<artifactId>component-entity</artifactId>
-		</dependency>
 		<dependency>
 			<groupId>org.jsoup</groupId>
 			<artifactId>jsoup</artifactId>
 		</dependency>
+		<dependency>
+			<groupId>com.github.xiaoymin</groupId>
+			<artifactId>knife4j-spring-boot-starter</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>com.baomidou</groupId>
+			<artifactId>mybatis-plus-boot-starter</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>com.alibaba</groupId>
+			<artifactId>druid-spring-boot-starter</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>mysql</groupId>
+			<artifactId>mysql-connector-java</artifactId>
+			<scope>runtime</scope>
+		</dependency>
 		<!-- Valid 校验 -->
 		<dependency>
 			<groupId>org.springframework.boot</groupId>
@@ -40,9 +53,9 @@
 			<groupId>org.springframework.boot</groupId>
 			<artifactId>spring-boot-configuration-processor</artifactId>
 			<optional>true</optional>
-            <scope>compile</scope>
+			<scope>compile</scope>
 		</dependency>
-		
+
 		<dependency>
 			<groupId>org.apache.httpcomponents</groupId>
 			<artifactId>httpclient</artifactId>

+ 0 - 0
component-database/src/main/java/com/gihon/component/config/BaseMybatisConfiguration.java → component-common/src/main/java/com/gihon/component/config/BaseMybatisConfiguration.java


+ 0 - 0
component-database/src/main/java/com/gihon/component/config/MyMetaObjectHandler.java → component-common/src/main/java/com/gihon/component/config/MyMetaObjectHandler.java


+ 8 - 1
component-common/src/main/java/com/gihon/component/config/ScheduleConfig.java

@@ -20,9 +20,16 @@ import org.springframework.scheduling.config.ScheduledTaskRegistrar;
 @ConditionalOnProperty(prefix = "gihon.common",havingValue = "true",matchIfMissing = false,name = "async")
 @Configuration
 public class ScheduleConfig implements SchedulingConfigurer {
+    /**
+     * I/O密集
+     */
+    private static final int BATCH_SIZE = Runtime.getRuntime().availableProcessors() * 2 + 1;
+    /**
+     * 容易造成线程爆满,最好定制实现一个ScheduledExecutorService
+     */
     @Override
     public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
-    	ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(100,new NameableThreadFactory("scheduled"));
+    	ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(BATCH_SIZE,new NameableThreadFactory("scheduled"));
         taskRegistrar.setScheduler(scheduler);
     }
     static class NameableThreadFactory implements ThreadFactory{

+ 6 - 2
component-common/src/main/java/com/gihon/component/config/ThreadPoolConfig.java

@@ -17,7 +17,11 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
 @ConditionalOnProperty(prefix = "gihon.common",havingValue = "true",matchIfMissing = false,name = "executor")
 @Configuration
 public class ThreadPoolConfig {
-
+    /**
+     * I/O密集
+     */
+    private static final int BATCH_SIZE = Runtime.getRuntime().availableProcessors() * 2 + 1;
+    
     @Bean
 	@ConditionalOnMissingBean(ThreadPoolTaskExecutor.class)
     public TaskExecutor taskExecutor() {
@@ -31,7 +35,7 @@ public class ThreadPoolConfig {
         // 设置线程活跃时间(秒)
         executor.setKeepAliveSeconds(60);
         // 设置默认线程名称
-        executor.setThreadNamePrefix("SpringBootDefault-");
+        executor.setThreadNamePrefix("Schedule-");
         // 设置拒绝策略
         executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
         // 等待所有任务结束后再关闭线程池

+ 0 - 0
component-entity/src/main/java/com/gihon/component/entity/BaseEntity.java → component-common/src/main/java/com/gihon/component/entity/BaseEntity.java


+ 0 - 0
component-entity/src/main/java/com/gihon/component/entity/CompanyBaseEntity.java → component-common/src/main/java/com/gihon/component/entity/CompanyBaseEntity.java


+ 0 - 0
component-entity/src/main/java/com/gihon/component/response/PageBean.java → component-common/src/main/java/com/gihon/component/response/PageBean.java


+ 0 - 0
component-entity/src/main/java/com/gihon/component/response/Response.java → component-common/src/main/java/com/gihon/component/response/Response.java


+ 0 - 0
component-entity/src/main/java/com/gihon/component/response/ResponseStatus.java → component-common/src/main/java/com/gihon/component/response/ResponseStatus.java


+ 0 - 0
component-entity/src/main/java/com/gihon/component/response/SelectVal.java → component-common/src/main/java/com/gihon/component/response/SelectVal.java


+ 0 - 0
component-entity/src/main/java/com/gihon/component/vo/BaseReq.java → component-common/src/main/java/com/gihon/component/vo/BaseReq.java


+ 0 - 0
component-entity/src/main/java/com/gihon/component/vo/PageReq.java → component-common/src/main/java/com/gihon/component/vo/PageReq.java


+ 0 - 0
component-websecurity/src/main/java/com/gihon/component/web/aspect/LogAspect.java → component-common/src/main/java/com/gihon/component/web/aspect/LogAspect.java


+ 0 - 0
component-websecurity/src/main/java/com/gihon/component/web/auth/AuthService.java → component-common/src/main/java/com/gihon/component/web/auth/AuthService.java


+ 0 - 2
component-websecurity/src/main/java/com/gihon/component/web/auth/AuthTokenInterceptor.java → component-common/src/main/java/com/gihon/component/web/auth/AuthTokenInterceptor.java

@@ -5,13 +5,11 @@ import javax.servlet.http.HttpServletResponse;
 
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingClass;
 import org.springframework.core.annotation.Order;
 import org.springframework.http.HttpMethod;
 import org.springframework.stereotype.Component;
 import org.springframework.web.servlet.HandlerInterceptor;
 
-import com.gihon.component.web.auth.AuthUtils;
 import com.gihon.component.web.service.TokenService;
 import com.gihon.component.web.vo.UserInfo;
 

+ 2 - 0
component-common/src/main/java/com/gihon/component/web/auth/AuthUtils.java

@@ -32,6 +32,8 @@ public class AuthUtils {
 
     public static final Long TOKEN_EXPIRE_TIME = 7200L;// 3个小时
 
+    private AuthUtils() {}
+    
     public static ServletRequestAttributes getRequestAttributes() {
         RequestAttributes r = RequestContextHolder.currentRequestAttributes();
         return (ServletRequestAttributes)r;

+ 9 - 9
component-websecurity/src/main/java/com/gihon/component/web/auth/AuthenticationInterceptor.java → component-common/src/main/java/com/gihon/component/web/auth/AuthenticationInterceptor.java

@@ -5,7 +5,6 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
 import org.apache.commons.lang3.StringUtils;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingClass;
 import org.springframework.core.annotation.Order;
 import org.springframework.http.HttpMethod;
 import org.springframework.stereotype.Component;
@@ -21,8 +20,7 @@ import com.gihon.component.web.service.TokenService;
 import lombok.extern.slf4j.Slf4j;
 
 /**
- * @description 认证拦截器
- * 非Security
+ * @description 认证拦截器 非Security
  * @author baihe
  *
  */
@@ -45,7 +43,7 @@ public class AuthenticationInterceptor implements HandlerInterceptor {
             return true;
         }
 
-        String token = (String) request.getAttribute(AuthUtils.REQ_TOKEN);
+        String token = (String)request.getAttribute(AuthUtils.REQ_TOKEN);
         if (StringUtils.isBlank(token)) {
             // 未登录
             throw new LoginException(ResponseStatus.UNAUTHORIATION);
@@ -58,25 +56,27 @@ public class AuthenticationInterceptor implements HandlerInterceptor {
         }
         // 认证token是否合法
         // 超级管理员只要是web平台不校验权限
-        if (AuthConstans.SUPER_ADMIN.equals(user.getUsername()) && gihonCommonProperties.getModuleType() == ModuleType.WEB.getCode()) {
+        if (AuthConstans.SUPER_ADMIN.equals(user.getUsername())
+            && gihonCommonProperties.getModuleType() == ModuleType.WEB.getCode()) {
             return true;
         } else if (AuthConstans.SUPER_ADMIN.equals(user.getUsername())) {
             return false;
         }
+        String url = request.getMethod() + RedisConstants.SEP + getUri(request);
+        log.debug("url={},moudle={},token={},user={}", url, gihonCommonProperties.getModuleType(), token, user);
         // 动态鉴权
-        boolean checkPermission = authService.checkPermission(request.getMethod() + RedisConstants.SEP + getUri(request), gihonCommonProperties.getModuleType(),
-                token, user);
+        boolean checkPermission = authService.checkPermission(url, gihonCommonProperties.getModuleType(), token, user);
         if (!checkPermission) {
             throw new LoginException(ResponseStatus.FORBIDDEN);
         }
         return true;
     }
 
-    //获取资源的路径,去掉ContextPath
+    // 获取资源的路径,去掉ContextPath
     private String getUri(HttpServletRequest request) {
         String uri = request.getContextPath();
         String url = request.getRequestURI();
-//    	String url3 = request.getServletPath();
+        // String url3 = request.getServletPath();
         if (uri.equals("/")) {
             return url;
         } else {

+ 122 - 0
component-common/src/main/java/com/gihon/component/web/auth/impl/AuthServiceImpl.java

@@ -0,0 +1,122 @@
+package com.gihon.component.web.auth.impl;
+
+import java.util.Comparator;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.StringRedisTemplate;
+import org.springframework.http.HttpMethod;
+import org.springframework.stereotype.Service;
+import org.springframework.util.AntPathMatcher;
+
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.gihon.component.properties.GihonCommonProperties;
+import com.gihon.component.properties.RedisConstants;
+import com.gihon.component.util.JacksonJsonUtils;
+import com.gihon.component.web.auth.AuthService;
+import com.gihon.component.web.auth.AuthUser;
+import com.gihon.component.web.service.TokenService;
+import com.gihon.component.web.vo.PermissionVO;
+import com.gihon.component.web.vo.TokenVal;
+import com.github.xiaoymin.knife4j.core.util.CollectionUtils;
+
+import lombok.extern.slf4j.Slf4j;
+
+/**
+ * 动态鉴权
+ * 非Security
+ * @author baihe
+ *
+ */
+@Service
+public class AuthServiceImpl implements AuthService{
+
+    @Autowired
+    private TokenService tokenService;
+
+    @Autowired
+    private StringRedisTemplate stringRedisTemplate;
+
+    @Autowired
+    private GihonCommonProperties gihonCommonProperties;
+    
+   
+    private AntPathMatcher antMatcher = new AntPathMatcher();
+    
+    /**
+     * 通过请求地址和当前用户权限 获取请求地址需要的权限比较 忽略平台类型
+     * 
+     * @param uri
+     * @param token
+     * @param checkResult
+     * @return
+     */
+    public boolean checkPermission(String uri, int moduleType, String token, AuthUser checkResult) {
+        TokenVal tv = tokenService.getTokenVal(token);
+        if (tv == null || tv.getModuleType() != moduleType) {
+            return false;
+        }
+        // 获取全部的角色
+        List<String> role = checkResult.getRoleList();
+
+        // 获取全部的权限列表匹配
+        // 用权限匹配角色,如果没有角色那么就通过
+        List<String> needRole = getPermission(uri);
+        // Null 是没有配置权限只要登录即可
+        if (needRole == null) {
+            return true;
+        } else if (role == null||role.isEmpty()) {
+            return false;
+        }
+        // Empty是配置权限但是没有角色 只有管理员才行 @See PermissionServiceImpl#cloneCopyMenu
+        return needRole.stream().anyMatch(role::contains);
+    }
+
+    /**
+     * 从redis缓存中读取权限
+     * 
+     * @return
+     */
+    public List<String> getPermission(String uri) {
+        String[] uris = uri.split(RedisConstants.SEP);
+
+        Comparator<String> c = antMatcher.getPatternComparator("/**");
+
+        List<PermissionVO> list = getPermissionList();
+        if(CollectionUtils.isEmpty(list)) {
+            return null;
+        }
+        // 排序
+        HttpMethod m = HttpMethod.valueOf(uris[0]);
+        list = list.stream().filter(p -> m.matches(p.getMethod())).sorted((p, p2) -> {
+            return c.compare(p.getUrl(), p2.getUrl());
+        }).collect(Collectors.toList());
+
+        for (PermissionVO vo : list) {
+//			RequestMatcher matcher = new AntPathRequestMatcher(vo.getUrl(),vo.getMethod());
+            if (antMatcher.match(vo.getUrl(), uris[1])) {
+                return vo.getRoleList();
+            }
+        }
+        return null;
+    }
+
+    /**
+     * 从redis缓存中读取权限
+     * @See AuthService.init()
+     * @return
+     */
+    public List<PermissionVO> getPermissionList() {
+        String hashKey = gihonCommonProperties.getModuleCode() + RedisConstants.SEP + gihonCommonProperties.getModuleType();
+        String result = (String) stringRedisTemplate.opsForHash().get(RedisConstants.PERMISSN_REDIS, hashKey);
+        if (StringUtils.isBlank(result)) {
+            return null;
+        }
+        TypeReference<List<PermissionVO>> r = new TypeReference<List<PermissionVO>>() {
+        };
+        return JacksonJsonUtils.readObject(result, r);
+    }
+
+}

+ 0 - 0
component-websecurity/src/main/java/com/gihon/component/web/config/AuthWebMvcConfig.java → component-common/src/main/java/com/gihon/component/web/config/AuthWebMvcConfig.java


+ 0 - 0
component-websecurity/src/main/java/com/gihon/component/web/config/CommonExceptionController.java → component-common/src/main/java/com/gihon/component/web/config/CommonExceptionController.java


+ 1 - 0
component-websecurity/src/main/java/com/gihon/component/web/config/CommonWebConfig.java → component-common/src/main/java/com/gihon/component/web/config/CommonWebConfig.java

@@ -39,6 +39,7 @@ import org.springframework.http.converter.json.MappingJackson2HttpMessageConvert
 import org.springframework.web.client.RestTemplate;
 import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
 import org.springframework.web.filter.CorsFilter;
+import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
 import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
 
 import com.fasterxml.jackson.databind.ObjectMapper;

+ 18 - 21
component-websecurity/src/main/java/com/gihon/component/web/config/DemoKnife4jConfig.java → component-common/src/main/java/com/gihon/component/web/config/DemoKnife4jConfig.java

@@ -1,6 +1,5 @@
 package com.gihon.component.web.config;
 
-import java.net.Inet4Address;
 import java.net.InetAddress;
 import java.util.List;
 
@@ -21,7 +20,9 @@ import springfox.bean.validators.configuration.BeanValidatorPluginsConfiguration
 import springfox.documentation.builders.ApiInfoBuilder;
 import springfox.documentation.builders.PathSelectors;
 import springfox.documentation.builders.RequestHandlerSelectors;
+import springfox.documentation.builders.RequestParameterBuilder;
 import springfox.documentation.service.ApiInfo;
+import springfox.documentation.service.ParameterType;
 import springfox.documentation.service.RequestParameter;
 import springfox.documentation.spi.DocumentationType;
 import springfox.documentation.spring.web.plugins.Docket;
@@ -37,33 +38,27 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
 public class DemoKnife4jConfig implements ApplicationListener<WebServerInitializedEvent> {
 
     private static Logger logger = LoggerFactory.getLogger(DemoKnife4jConfig.class);
-    
+
     @Autowired
     private Knife4jProperties knife4jProperties;
-    
+
     @Bean(value = "web")
     public Docket createRestAdmin() {
         // 添加请求参数,我们这里把token作为请求头部参数传入后端(defaultValue还不能使用具体问题不祥)
-//        RequestParameter parameter = new RequestParameterBuilder().name("Authorization").in(ParameterType.HEADER).query(x->x.defaultValue("token")).build();
+        RequestParameter parameter =
+            new RequestParameterBuilder().name("Authorization").in(ParameterType.HEADER).query(x->x.defaultValue("Bearer ")).build();
         List<RequestParameter> parameters = Lists.newArrayList();
-//        parameters.add(parameter);
-        return new Docket(DocumentationType.SWAGGER_2)
-        		.enable(true)
-                .useDefaultResponseMessages(false)
-                .groupName(knife4jProperties.getDocuments().get(0).getGroup())
-                .apiInfo(apiInfo(knife4jProperties.getDocuments().get(0).getName()))
-                .globalRequestParameters(parameters)
-                .select()
-                .apis(RequestHandlerSelectors.basePackage("com.gihon.component"))
-                .paths(PathSelectors.any())
-                .build();
+         parameters.add(parameter);
+        return new Docket(DocumentationType.SWAGGER_2).enable(true).useDefaultResponseMessages(false)
+            .groupName(knife4jProperties.getDocuments().get(0).getGroup())
+            .apiInfo(apiInfo(knife4jProperties.getDocuments().get(0).getName())).globalRequestParameters(parameters)
+            .select().apis(RequestHandlerSelectors.basePackage("com.gihon.component")).paths(PathSelectors.any())
+            .build();
 
     }
 
     private ApiInfo apiInfo(String title) {
-        return new ApiInfoBuilder()
-                .title(title)
-                .build();
+        return new ApiInfoBuilder().title(title).build();
     }
 
     /**
@@ -72,10 +67,12 @@ public class DemoKnife4jConfig implements ApplicationListener<WebServerInitializ
     @Override
     public void onApplicationEvent(WebServerInitializedEvent event) {
         try {
-            InetAddress inetAddress = Inet4Address.getLocalHost();
-            logger.info("项目启动成功!接口文档地址: http://" + inetAddress.getHostAddress() + ":" + event.getWebServer().getPort() + event.getApplicationContext().getEnvironment().getProperty("server.servlet.context-path") + "/doc.html");
+            InetAddress inetAddress = InetAddress.getLocalHost();
+            logger.info("项目启动成功!接口文档地址: http://{}:{}{}/doc.html", inetAddress.getHostAddress(),
+                event.getWebServer().getPort(),
+                event.getApplicationContext().getEnvironment().getProperty("server.servlet.context-path"));
         } catch (Exception e) {
-        	logger.error("Knife4J error,",e);
+            logger.error("Knife4J error,", e);
         }
     }
 }

+ 0 - 0
component-websecurity/src/main/java/com/gihon/component/web/config/HttpErrorController.java → component-common/src/main/java/com/gihon/component/web/config/HttpErrorController.java


+ 1 - 1
component-springboot/src/main/java/com/gihon/component/config/web/ValidationInterceptor.java → component-common/src/main/java/com/gihon/component/web/config/ValidationInterceptor.java

@@ -1,4 +1,4 @@
-package com.gihon.component.config.web;
+package com.gihon.component.web.config;
 
 import java.lang.reflect.Method;
 import java.util.ArrayList;

+ 8 - 8
component-springboot/src/main/java/com/gihon/component/config/web/WebMvcConfig.java → component-common/src/main/java/com/gihon/component/web/config/WebMvcConfig.java

@@ -1,4 +1,4 @@
-package com.gihon.component.config.web;
+package com.gihon.component.web.config;
 
 import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
 import org.springframework.context.annotation.Bean;
@@ -19,13 +19,13 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupp
 @Configuration
 public class WebMvcConfig extends WebMvcConfigurationSupport {
 
-	@Override
-	protected void addResourceHandlers(ResourceHandlerRegistry registry) {
-		registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/resources/");
-		registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/resources/webjars/");
-		registry.addResourceHandler("/favicon.ico").addResourceLocations("classpath:/static/favicon.ico");
-		super.addResourceHandlers(registry);
-	}
+//	@Override
+//	protected void addResourceHandlers(ResourceHandlerRegistry registry) {
+//		registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/resources/");
+//		registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/resources/webjars/");
+//		registry.addResourceHandler("/favicon.ico").addResourceLocations("classpath:/static/favicon.ico");
+//		super.addResourceHandlers(registry);
+//	}
 
 	/**
 	 * 用于方法中平铺的参数校验 在Controller中 类 上使用@Validated标注,然后方法上正常使用约束注解标注平铺的属性

+ 0 - 0
component-websecurity/src/main/java/com/gihon/component/web/redis/RedisKeyExpirationListener.java → component-common/src/main/java/com/gihon/component/web/redis/RedisKeyExpirationListener.java


+ 0 - 0
component-websecurity/src/main/java/com/gihon/component/web/redis/RedisListenerConfig.java → component-common/src/main/java/com/gihon/component/web/redis/RedisListenerConfig.java


+ 0 - 0
component-websecurity/src/main/java/com/gihon/component/web/redis/package-info.java → component-common/src/main/java/com/gihon/component/web/redis/package-info.java


+ 0 - 6
component-websecurity/src/main/java/com/gihon/component/web/service/TokenService.java → component-common/src/main/java/com/gihon/component/web/service/TokenService.java

@@ -101,11 +101,5 @@ public interface TokenService {
      * @return
      */
     UserInfo getUserInfo(String account);
-    /**
-     * 从数据库获取账号信息
-     * @param account
-     * @return
-     */
-    UserInfo queryUserByUserAccount(String account);
 
 }

+ 2 - 22
component-websecurity/src/main/java/com/gihon/component/web/service/impl/TokenServiceImpl.java → component-common/src/main/java/com/gihon/component/web/service/impl/TokenServiceImpl.java

@@ -7,7 +7,6 @@ import java.util.concurrent.TimeUnit;
 import java.util.stream.Collectors;
 
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingClass;
 import org.springframework.boot.context.properties.EnableConfigurationProperties;
 import org.springframework.data.redis.core.StringRedisTemplate;
 import org.springframework.stereotype.Service;
@@ -15,13 +14,9 @@ import org.springframework.util.Base64Utils;
 import org.springframework.util.StringUtils;
 
 import com.fasterxml.jackson.core.type.TypeReference;
-import com.gihon.component.entity.rbac.GihonRole;
-import com.gihon.component.entity.rbac.GihonUser;
 import com.gihon.component.enums.ModuleType;
 import com.gihon.component.properties.GihonCommonProperties;
 import com.gihon.component.properties.RedisConstants;
-import com.gihon.component.service.GihonRoleService;
-import com.gihon.component.service.GihonUserService;
 import com.gihon.component.util.JacksonJsonUtils;
 import com.gihon.component.util.UUIDGenerater;
 import com.gihon.component.web.auth.AuthConstans;
@@ -47,7 +42,7 @@ import lombok.extern.slf4j.Slf4j;
 public class TokenServiceImpl implements TokenService {
 
 	@Autowired
-    private GihonUserService gihonUserService;
+    private UserInfoService userInfoService;
 
     @Autowired
     protected StringRedisTemplate stringRedisTemplate;
@@ -55,9 +50,6 @@ public class TokenServiceImpl implements TokenService {
     @Autowired
     protected GihonCommonProperties gihonCommonProperties;
 
-    @Autowired
-    protected GihonRoleService gihonRoleService;
-
     protected String parseToken(String originToken) {
         return Base64Utils.encodeToUrlSafeString(originToken.getBytes());
     }
@@ -224,14 +216,10 @@ public class TokenServiceImpl implements TokenService {
             }
         } 
         if(userInfo==null) {
-            userInfo = this.queryUserByUserAccount(account);
+            userInfo = userInfoService.queryUserByUserAccount(account);
             if (userInfo == null) {
                 return null;
             }
-            // add roleList;
-            List<GihonRole> rl = gihonRoleService.getRoleList(userInfo.getId());
-            userInfo.setRoleList(rl.stream().map(r -> r.getCompanyId()+RedisConstants.SEP+r.getRoleCode()).collect(Collectors.toList()));
-            userInfo.setCreatedTime(now);
             stringRedisTemplate.opsForHash().put(USER_STORE, account, JacksonJsonUtils.writeObject(userInfo));
         }
         return userInfo;
@@ -316,12 +304,4 @@ public class TokenServiceImpl implements TokenService {
         return;
     }
 
-    public UserInfo queryUserByUserAccount(String account) {
-        GihonUser user = gihonUserService.lambdaQuery().eq(GihonUser::getUsername, account).one();
-        UserInfo userInfo = null;
-        if (user != null) {
-            userInfo = new UserInfo(user);
-        }
-        return userInfo;
-    }
 }

+ 23 - 0
component-common/src/main/java/com/gihon/component/web/service/impl/UserInfoService.java

@@ -0,0 +1,23 @@
+package com.gihon.component.web.service.impl;
+
+import com.gihon.component.web.vo.UserInfo;
+/**
+ * 每个登录的都需要实现此类
+ * @author baihe
+ * @date 2023/07/17
+ */
+public interface UserInfoService {
+
+    /**
+     * 从数据库获取账号信息
+     * @param account
+     * @return
+     */
+    default UserInfo queryUserByUserAccount(String account) {
+        UserInfo userInfo = new UserInfo();
+        
+        return userInfo;
+    }
+    
+    
+}

+ 0 - 0
component-websecurity/src/main/java/com/gihon/component/web/vo/LoginUser.java → component-common/src/main/java/com/gihon/component/web/vo/LoginUser.java


+ 0 - 0
component-websecurity/src/main/java/com/gihon/component/web/vo/MenuVO.java → component-common/src/main/java/com/gihon/component/web/vo/MenuVO.java


+ 0 - 0
component-websecurity/src/main/java/com/gihon/component/web/vo/PermissionVO.java → component-common/src/main/java/com/gihon/component/web/vo/PermissionVO.java


+ 0 - 0
component-websecurity/src/main/java/com/gihon/component/web/vo/RefreshTokenVal.java → component-common/src/main/java/com/gihon/component/web/vo/RefreshTokenVal.java


+ 0 - 0
component-websecurity/src/main/java/com/gihon/component/web/vo/SsoToken.java → component-common/src/main/java/com/gihon/component/web/vo/SsoToken.java


+ 0 - 0
component-websecurity/src/main/java/com/gihon/component/web/vo/TokenVal.java → component-common/src/main/java/com/gihon/component/web/vo/TokenVal.java


+ 0 - 10
component-websecurity/src/main/java/com/gihon/component/web/vo/UserInfo.java → component-common/src/main/java/com/gihon/component/web/vo/UserInfo.java

@@ -4,7 +4,6 @@ import java.io.Serializable;
 import java.util.List;
 
 import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.gihon.component.entity.rbac.GihonUser;
 import com.gihon.component.web.auth.AuthUser;
 
 import io.swagger.annotations.ApiModelProperty;
@@ -77,14 +76,5 @@ public class UserInfo implements AuthUser, Serializable {
         
     }
 
-    public UserInfo(GihonUser user) {
-        this.id = user.getId();
-        this.username = user.getUsername();
-        this.nickName = user.getNickName();
-        this.password = user.getPassword();
-        this.salt = user.getUsername();
-        this.companyId = user.getCompanyId();
-        this.companyAdmin = user.getCompanyAdmin();
-    }
 
 }

+ 0 - 0
component-websecurity/src/main/java/com/gihon/component/web/xss/XssConfig.java → component-common/src/main/java/com/gihon/component/web/xss/XssConfig.java


+ 0 - 0
component-websecurity/src/main/java/com/gihon/component/web/xss/XssFilter.java → component-common/src/main/java/com/gihon/component/web/xss/XssFilter.java


+ 0 - 0
component-websecurity/src/main/java/com/gihon/component/web/xss/XssHttpServletRequestWrapper.java → component-common/src/main/java/com/gihon/component/web/xss/XssHttpServletRequestWrapper.java


+ 70 - 2
component-common/src/main/resources/application-common.yml

@@ -15,10 +15,12 @@ gihon:
       - /doc.html
       - /favicon.ico
       - /**login
+      - /**login/refresh
       
     id-strategy:
-      worker-id: 0
-      dataCenter-id: 0
+      worker-id: 2
+      dataCenter-id: 8
+
 spring: 
   mvc:
     pathmatch:
@@ -30,3 +32,69 @@ spring:
         max-idle: 10
         max-active: 10
         max-wait: 1000
+  datasource: 
+    druid:
+      enable: true
+#      从这里开始(druid) 下面三行是自定义
+#      url: jdbc:mysql://172.18.0.23:3306/gihon?characterEncoding=UTF-8&useSSL=false
+#      username: root
+#      password: 1q2w3e4r
+      db-type: mysql
+      driver-class-name: com.mysql.cj.jdbc.Driver
+      initialSize: 10
+      minIdle: 10
+      maxActive: 500
+      max-wait: 20000
+      pool-prepared-statements: true
+      max-pool-prepared-statement-per-connection-size: 20
+      validation-query: SELECT 'x'
+      test-on-borrow: false
+      test-on-return: false
+      test-while-idle: true
+      time-between-eviction-runs-millis: 60000  #配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
+      min-evictable-idle-time-millis: 300000    #配置一个连接在池中最小生存的时间,单位是毫秒
+      filters: stat,wall
+      filter:
+        wall:
+          enabled: true
+          config:
+            commentAllow: true
+            multiStatementAllow: true
+            noneBaseStatementAllow: true
+      # 以下的2段配置,同时适用于所有模式
+      web-stat-filter:  # WebStatFilter配置,说明请参考Druid Wiki,配置_配置WebStatFilter
+        enabled: true
+        url-pattern: /*
+        exclusions: "*.js , *.gif ,*.jpg ,*.png ,*.css ,*.ico , /druid/*"
+        session-stat-max-count: 1000
+        profile-enable: true
+        session-stat-enable: false
+      stat-view-servlet:  #展示Druid的统计信息,StatViewServlet的用途包括:1.提供监控信息展示的html页面2.提供监控信息的JSON API
+        enabled: true
+        url-pattern: /druid/*   #根据配置中的url-pattern来访问内置监控页面,如果是上面的配置,内置监控页面的首页是/druid/index.html例如:http://127.0.0.1:9000/druid/index.html
+        reset-enable: true    #允许清空统计数据
+        login-username: gihon
+        login-password: gihon         
+#mybatis-plus 通用配置   
+mybatis-plus:
+  mapper-locations:
+      - classpath:/mapper/**/*Mapper.xml
+      - classpath:/mapper/*Mapper.xml
+  #实体扫描,多个package用逗号或者分号分隔
+  typeAliasesPackage: com.gihon.**.entity,com.gihon.**.entity.*
+  global-config:
+    banner: false
+    db-config:
+      #主键类型  AUTO:"数据库ID自增", INPUT:"用户输入ID", ID_WORKER:"全局唯一ID (数字类型唯一ID)", UUID:"全局唯一ID UUID";
+      id-type: AUTO
+      #字段策略IGNORED:"忽略判断",NOT_NULL:"非 NULL 判断"),NOT_EMPTY:"非空判断"
+      insert-strategy: NOT_NULL
+      #逻辑删除配置(下面3个配置)
+      logic-delete-field: state
+      logic-delete-value: 1
+      logic-not-delete-value: 0
+  configuration:
+    #驼峰下划线转换
+    map-underscore-to-camel-case: true
+    cache-enabled: false
+    jdbc-type-for-null: 'null'

+ 0 - 46
component-database/pom.xml

@@ -1,46 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
-	<modelVersion>4.0.0</modelVersion>
-	<parent>
-		<groupId>gihon.component</groupId>
-		<artifactId>component-parent</artifactId>
-		<version>0.2.0-SNAPSHOT</version>
-		<relativePath>../</relativePath>
-	</parent>
-	<artifactId>component-database</artifactId>
-	<name>component-database</name>
-	<packaging>jar</packaging>
-	<description>数据库操作</description>
-
-	<dependencies>
-		<dependency>
-			<groupId>gihon.component</groupId>
-			<artifactId>component-entity</artifactId>
-		</dependency>
-		<dependency>
-			<groupId>gihon.component</groupId>
-			<artifactId>component-common</artifactId>
-		</dependency>
-		<dependency>
-			<groupId>com.alibaba</groupId>
-	        <artifactId>druid-spring-boot-starter</artifactId>
-		</dependency>
-	<!-- 数据库 -->
-       <!--  
-       <dependency>
-            <groupId>com.oracle.database.jdbc</groupId>
-            <artifactId>ojdbc8</artifactId>
-            <scope>runtime</scope>
-        </dependency> 
-        -->
-        <dependency>
-            <groupId>mysql</groupId>
-            <artifactId>mysql-connector-java</artifactId>
-            <scope>runtime</scope>
-        </dependency>
-	</dependencies>
-
-
-</project>

+ 0 - 66
component-database/src/main/resources/application-database.yml

@@ -1,66 +0,0 @@
-spring: 
-  datasource: 
-    druid:
-      enable: true
-#      从这里开始(druid) 下面三行是自定义
-#      url: jdbc:mysql://172.18.0.23:3306/gihon?characterEncoding=UTF-8&useSSL=false
-#      username: root
-#      password: 1q2w3e4r
-      db-type: mysql
-      driver-class-name: com.mysql.cj.jdbc.Driver
-      initialSize: 10
-      minIdle: 10
-      maxActive: 500
-      max-wait: 20000
-      pool-prepared-statements: true
-      max-pool-prepared-statement-per-connection-size: 20
-      validation-query: SELECT 'x'
-      test-on-borrow: false
-      test-on-return: false
-      test-while-idle: true
-      time-between-eviction-runs-millis: 60000  #配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
-      min-evictable-idle-time-millis: 300000    #配置一个连接在池中最小生存的时间,单位是毫秒
-      filters: stat,wall
-      filter:
-        wall:
-          enabled: true
-          config:
-            commentAllow: true
-            multiStatementAllow: true
-            noneBaseStatementAllow: true
-      # 以下的2段配置,同时适用于所有模式
-      web-stat-filter:  # WebStatFilter配置,说明请参考Druid Wiki,配置_配置WebStatFilter
-        enabled: true
-        url-pattern: /*
-        exclusions: "*.js , *.gif ,*.jpg ,*.png ,*.css ,*.ico , /druid/*"
-        session-stat-max-count: 1000
-        profile-enable: true
-        session-stat-enable: false
-      stat-view-servlet:  #展示Druid的统计信息,StatViewServlet的用途包括:1.提供监控信息展示的html页面2.提供监控信息的JSON API
-        enabled: true
-        url-pattern: /druid/*   #根据配置中的url-pattern来访问内置监控页面,如果是上面的配置,内置监控页面的首页是/druid/index.html例如:http://127.0.0.1:9000/druid/index.html
-        reset-enable: true    #允许清空统计数据
-        login-username: gihon
-        login-password: gihon         
-#mybatis-plus 通用配置   
-mybatis-plus:
-  mapper-locations:
-      - classpath:/mapper/**/*Mapper.xml
-  #实体扫描,多个package用逗号或者分号分隔
-  typeAliasesPackage: com.gihon.**.entity,com.gihon.**.entity.*
-  global-config:
-    banner: false
-    db-config:
-      #主键类型  AUTO:"数据库ID自增", INPUT:"用户输入ID", ID_WORKER:"全局唯一ID (数字类型唯一ID)", UUID:"全局唯一ID UUID";
-      id-type: AUTO
-      #字段策略IGNORED:"忽略判断",NOT_NULL:"非 NULL 判断"),NOT_EMPTY:"非空判断"
-      insert-strategy: NOT_NULL
-      #逻辑删除配置(下面3个配置)
-      logic-delete-field: state
-      logic-delete-value: 1
-      logic-not-delete-value: 0
-  configuration:
-    #驼峰下划线转换
-    map-underscore-to-camel-case: true
-    cache-enabled: false
-    jdbc-type-for-null: 'null'

+ 0 - 271
component-database/src/main/sql/gihon.sql

@@ -1,271 +0,0 @@
-/*
-Navicat MySQL Data Transfer
-
-Source Server         : 办公室外网
-Source Server Version : 50738
-Source Host           : www.jihengcc.cn:17306
-Source Database       : gihon
-
-Target Server Type    : MYSQL
-Target Server Version : 50738
-File Encoding         : 65001
-
-Date: 2022-07-19 20:52:40
-*/
-
-SET FOREIGN_KEY_CHECKS=0;
-
--- ----------------------------
--- Table structure for gihon_button
--- ----------------------------
-DROP TABLE IF EXISTS `gihon_button`;
-CREATE TABLE `gihon_button` (
-  `id` bigint(20) NOT NULL AUTO_INCREMENT,
-  `button_name` varchar(128) DEFAULT NULL COMMENT '菜单名称',
-  `button_code` varchar(128) DEFAULT NULL COMMENT '菜单编码唯一',
-  `path` varchar(128) DEFAULT NULL COMMENT '后台访问路径:用于服务器判断权限',
-  `method` varchar(16) DEFAULT NULL COMMENT '后台访问方法:用于服务器判断权限',
-  `order_num` int(11) DEFAULT NULL COMMENT '排序号升序',
-  `menu_id` bigint(20) DEFAULT NULL COMMENT '菜单ID',
-  `company_id` bigint(20) DEFAULT NULL COMMENT '公司Id(支持SAAS)',
-  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
-  `update_time` datetime DEFAULT NULL COMMENT '修改时间',
-  `create_user` bigint(20) DEFAULT NULL COMMENT '创建人',
-  `update_user` bigint(20) DEFAULT NULL COMMENT '修改人',
-  `state` int(11) DEFAULT NULL COMMENT '逻辑删除 1 删除 0 未删除',
-  PRIMARY KEY (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=35 DEFAULT CHARSET=utf8mb4;
-
--- ----------------------------
--- Records of gihon_button
--- ----------------------------
-INSERT INTO `gihon_button` VALUES ('1', '公司列表', 'company_list', '/company/list', 'GET', '1', '1', null, '2022-07-19 17:25:55', '2022-07-19 17:25:57', '1', '1', '0');
-INSERT INTO `gihon_button` VALUES ('2', '公司新增', 'company_add', '/company', 'POST', '1', '1', null, '2022-07-19 17:25:55', '2022-07-19 17:25:57', '1', '1', '0');
-INSERT INTO `gihon_button` VALUES ('3', '公司禁用', 'company_disable', 'company/disable/*', 'POST', '1', '1', null, '2022-07-19 17:25:55', '2022-07-19 17:25:57', '1', '1', '0');
-INSERT INTO `gihon_button` VALUES ('4', '公司启用', 'company_enable', 'company/enable/*', 'POST', '1', '1', null, '2022-07-19 17:25:55', '2022-07-19 17:25:57', '1', '1', '0');
-INSERT INTO `gihon_button` VALUES ('5', '公司编辑', 'company_edit', 'company/*', 'POST', '1', '1', null, '2022-07-19 17:25:55', '2022-07-19 17:25:57', '1', '1', '0');
-INSERT INTO `gihon_button` VALUES ('6', '人员列表', 'user_list', '/user', 'GET', '0', '2', null, '2022-07-19 04:38:16', '2022-07-19 04:38:16', '1', '1', '0');
-INSERT INTO `gihon_button` VALUES ('7', '人员详情', 'user_info', '/user/*', 'GET', '2', '2', null, '2022-07-19 04:38:16', '2022-07-19 04:38:16', '1', '1', '0');
-INSERT INTO `gihon_button` VALUES ('8', '人员新增', 'user_add', '/user', 'POST', '2', '2', null, '2022-07-19 04:38:16', '2022-07-19 04:38:16', '1', '1', '0');
-INSERT INTO `gihon_button` VALUES ('9', '人员编辑', 'user_edit', '/user/*', 'POST', '2', '2', null, '2022-07-19 04:38:16', '2022-07-19 04:38:16', '1', '1', '0');
-INSERT INTO `gihon_button` VALUES ('10', '人员删除', 'user_remove', '/user/*', 'DELETE', '2', '2', null, '2022-07-19 04:38:16', '2022-07-19 04:38:16', '1', '1', '0');
-INSERT INTO `gihon_button` VALUES ('11', '人员重置密码', 'user_reset', '/user/reset', 'POST', '2', '2', null, '2022-07-19 04:38:16', '2022-07-19 04:38:16', '1', '1', '0');
-INSERT INTO `gihon_button` VALUES ('12', '角色列表', 'user_list', '/role/list', 'POST', '2', '3', null, '2022-07-19 04:38:16', '2022-07-19 04:38:16', '1', '1', '0');
-INSERT INTO `gihon_button` VALUES ('13', '角色详情', 'user_info', '/role/*', 'GET', '2', '3', null, '2022-07-19 04:38:16', '2022-07-19 04:38:16', '1', '1', '0');
-INSERT INTO `gihon_button` VALUES ('14', '角色新增', 'user_add', '/role', 'POST', '2', '3', null, '2022-07-19 04:38:16', '2022-07-19 04:38:16', '1', '1', '0');
-INSERT INTO `gihon_button` VALUES ('15', '角色编辑', 'user_edit', '/role/*', 'POST', '2', '3', null, '2022-07-19 04:38:16', '2022-07-19 04:38:16', '1', '1', '0');
-INSERT INTO `gihon_button` VALUES ('16', '角色删除', 'user_remove', '/role/*', 'DELETE', '2', '3', null, '2022-07-19 04:38:16', '2022-07-19 04:38:16', '1', '1', '0');
-INSERT INTO `gihon_button` VALUES ('17', '角色按钮权限', 'user_btn_list', '/role/button/list', 'POST', '2', '3', null, '2022-07-19 04:38:16', '2022-07-19 04:38:16', '1', '1', '0');
-INSERT INTO `gihon_button` VALUES ('18', '角色按钮权限设置', 'user_btn_set', '/role/button/set', 'POST', '2', '3', null, '2022-07-19 04:38:16', '2022-07-19 04:38:16', '1', '1', '0');
-INSERT INTO `gihon_button` VALUES ('19', '菜单列表', 'module_menu_list', '/module/menu/list', 'POST', '2', '5', null, '2022-07-19 04:58:16', '2022-07-19 04:58:16', '1', '1', '0');
-INSERT INTO `gihon_button` VALUES ('20', '菜单详情', 'module_menu_info', '/module/menu/*', 'GET', '2', '5', null, '2022-07-19 04:58:16', '2022-07-19 04:58:16', '1', '1', '0');
-INSERT INTO `gihon_button` VALUES ('21', '菜单新增', 'module_menu_add', '/module/menu', 'POST', '2', '5', null, '2022-07-19 04:58:16', '2022-07-19 04:58:16', '1', '1', '0');
-INSERT INTO `gihon_button` VALUES ('22', '菜单编辑', 'module_menu_edit', '/module/menu/*', 'POST', '2', '5', null, '2022-07-19 04:58:16', '2022-07-19 04:58:16', '1', '1', '0');
-INSERT INTO `gihon_button` VALUES ('23', '菜单删除', 'module_menu_remove', '/module/menu/*', 'DELETE', '2', '5', null, '2022-07-19 04:58:16', '2022-07-19 04:58:16', '1', '1', '0');
-INSERT INTO `gihon_button` VALUES ('24', '模块列表', 'module_list', '/module/list', 'POST', '2', '6', null, '2022-07-19 04:58:16', '2022-07-19 04:58:16', '1', '1', '0');
-INSERT INTO `gihon_button` VALUES ('25', '模块详情', 'module_info', '/module/*', 'GET', '2', '6', null, '2022-07-19 04:58:16', '2022-07-19 04:58:16', '1', '1', '0');
-INSERT INTO `gihon_button` VALUES ('26', '模块新增', 'module_add', '/module', 'POST', '2', '6', null, '2022-07-19 04:58:16', '2022-07-19 04:58:16', '1', '1', '0');
-INSERT INTO `gihon_button` VALUES ('27', '模块编辑', 'module_edit', '/module/*', 'POST', '2', '6', null, '2022-07-19 04:58:16', '2022-07-19 04:58:16', '1', '1', '0');
-INSERT INTO `gihon_button` VALUES ('28', '模块删除', 'module_remove', '/module/*', 'DELETE', '2', '6', null, '2022-07-19 04:58:16', '2022-07-19 04:58:16', '1', '1', '0');
-INSERT INTO `gihon_button` VALUES ('29', '模块查询', 'module_select', '/module/all', 'GET', '2', '6', null, '2022-07-19 04:58:16', '2022-07-19 04:58:16', '1', '1', '0');
-INSERT INTO `gihon_button` VALUES ('30', '按钮列表', 'module_btn_list', '/module/button/list', 'POST', '2', '7', null, '2022-07-19 04:58:16', '2022-07-19 04:58:16', '1', '1', '0');
-INSERT INTO `gihon_button` VALUES ('31', '按钮详情', 'module_btn_info', '/module/button/*', 'GET', '2', '7', null, '2022-07-19 04:58:16', '2022-07-19 04:58:16', '1', '1', '0');
-INSERT INTO `gihon_button` VALUES ('32', '按钮新增', 'module_btn_add', '/module/button', 'POST', '2', '7', null, '2022-07-19 04:58:16', '2022-07-19 04:58:16', '1', '1', '0');
-INSERT INTO `gihon_button` VALUES ('33', '按钮编辑', 'module_btn_edit', '/module/button/*', 'POST', '2', '7', null, '2022-07-19 04:58:16', '2022-07-19 04:58:16', '1', '1', '0');
-INSERT INTO `gihon_button` VALUES ('34', '按钮删除', 'module_btn_remove', '/module/button/*', 'DELETE', '2', '7', null, '2022-07-19 04:58:16', '2022-07-19 04:58:16', '1', '1', '0');
-
--- ----------------------------
--- Table structure for gihon_company
--- ----------------------------
-DROP TABLE IF EXISTS `gihon_company`;
-CREATE TABLE `gihon_company` (
-  `id` bigint(20) NOT NULL AUTO_INCREMENT,
-  `company_name` varchar(128) DEFAULT NULL COMMENT '名称',
-  `company_description` varchar(512) DEFAULT NULL COMMENT '描述',
-  `telephone` varchar(64) DEFAULT NULL COMMENT '电话',
-  `address` varchar(512) DEFAULT NULL COMMENT '地址',
-  `enable` tinyint(4) DEFAULT NULL COMMENT '是否启用1启用0未启用',
-  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
-  `update_time` datetime DEFAULT NULL COMMENT '修改时间',
-  `create_user` bigint(20) DEFAULT NULL COMMENT '创建人',
-  `update_user` bigint(20) DEFAULT NULL COMMENT '修改人',
-  `state` int(11) DEFAULT NULL COMMENT '逻辑删除 1 删除 0 未删除',
-  PRIMARY KEY (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4;
-
--- ----------------------------
--- Records of gihon_company
--- ----------------------------
-INSERT INTO `gihon_company` VALUES ('1', '吉亨科技', '辽宁吉亨科技有限公司', null, null, '1', '2022-07-19 14:24:28', '2022-07-19 14:24:26', '1', '1', '0');
-INSERT INTO `gihon_company` VALUES ('2', '禹佳科技', '辽宁禹佳科技有限公司', null, null, '1', '2022-07-19 14:24:28', '2022-07-19 14:24:26', '1', '1', '0');
-
--- ----------------------------
--- Table structure for gihon_menu
--- ----------------------------
-DROP TABLE IF EXISTS `gihon_menu`;
-CREATE TABLE `gihon_menu` (
-  `id` bigint(20) NOT NULL AUTO_INCREMENT,
-  `menu_name` varchar(128) DEFAULT NULL COMMENT '菜单名称',
-  `menu_code` varchar(128) DEFAULT NULL COMMENT '菜单编码唯一',
-  `path` varchar(128) DEFAULT NULL COMMENT '路由路径:可以为空',
-  `order_num` int(11) DEFAULT NULL COMMENT '排序号升序',
-  `module_id` bigint(20) NOT NULL COMMENT '模块',
-  `parent_id` bigint(20) NOT NULL DEFAULT '-1' COMMENT '父菜单:-1的代表顶级菜单',
-  `company_id` bigint(20) DEFAULT NULL COMMENT '公司Id(支持SAAS)',
-  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
-  `update_time` datetime DEFAULT NULL COMMENT '修改时间',
-  `create_user` bigint(20) DEFAULT NULL COMMENT '创建人',
-  `update_user` bigint(20) DEFAULT NULL COMMENT '修改人',
-  `state` int(11) DEFAULT NULL COMMENT '逻辑删除 1 删除 0 未删除',
-  PRIMARY KEY (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4;
-
--- ----------------------------
--- Records of gihon_menu
--- ----------------------------
-INSERT INTO `gihon_menu` VALUES ('1', '公司管理', 'company_manage', null, '1', '1', '-1', null, '2022-07-19 17:19:35', '2022-07-19 17:19:38', '1', '1', '0');
-INSERT INTO `gihon_menu` VALUES ('2', '人员管理', 'user_manage', null, '2', '1', '-1', null, '2022-07-19 17:19:35', '2022-07-19 17:19:38', '1', '1', '0');
-INSERT INTO `gihon_menu` VALUES ('3', '角色管理', 'role_manage', null, '3', '1', '-1', null, '2022-07-19 17:19:35', '2022-07-19 17:19:38', '1', '1', '0');
-INSERT INTO `gihon_menu` VALUES ('4', '系统模块管理', 'sys_module_manage', null, '4', '1', '-1', null, '2022-07-19 17:19:35', '2022-07-19 17:19:38', '1', '1', '0');
-INSERT INTO `gihon_menu` VALUES ('5', '菜单管理', 'menu_manage', null, '1', '1', '4', null, '2022-07-19 17:19:35', '2022-07-19 17:19:38', '1', '1', '0');
-INSERT INTO `gihon_menu` VALUES ('6', '模块管理', 'module_manage', null, '2', '1', '4', null, '2022-07-19 17:19:35', '2022-07-19 17:19:38', '1', '1', '0');
-INSERT INTO `gihon_menu` VALUES ('7', '按钮管理', 'button_manage', null, '3', '1', '4', null, '2022-07-19 17:19:35', '2022-07-19 17:19:38', '1', '1', '0');
-
--- ----------------------------
--- Table structure for gihon_module
--- ----------------------------
-DROP TABLE IF EXISTS `gihon_module`;
-CREATE TABLE `gihon_module` (
-  `id` bigint(20) NOT NULL AUTO_INCREMENT,
-  `module_name` varchar(128) DEFAULT NULL COMMENT '模块名称',
-  `module_code` varchar(128) DEFAULT NULL COMMENT '模块编码',
-  `module_description` varchar(128) DEFAULT NULL COMMENT '模块描述',
-  `module_logo` varchar(128) DEFAULT NULL COMMENT '模块Logo',
-  `order_num` int(11) DEFAULT NULL COMMENT '排序号升序',
-  `module_type` int(11) NOT NULL COMMENT '模块类型:1WEB,2APP,3小程序',
-  `company_id` bigint(20) DEFAULT NULL COMMENT '公司Id(支持SAAS)',
-  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
-  `update_time` datetime DEFAULT NULL COMMENT '修改时间',
-  `create_user` bigint(20) DEFAULT NULL COMMENT '创建人',
-  `update_user` bigint(20) DEFAULT NULL COMMENT '修改人',
-  `state` int(11) DEFAULT NULL COMMENT '逻辑删除 1 删除 0 未删除',
-  PRIMARY KEY (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4;
-
--- ----------------------------
--- Records of gihon_module
--- ----------------------------
-INSERT INTO `gihon_module` VALUES ('1', '系统管理', 'SystemManage', 'RABC系统管理', null, '1', '1', null, '2022-07-19 16:46:36', '2022-07-19 16:46:39', '1', '1', '0');
-
--- ----------------------------
--- Table structure for gihon_role
--- ----------------------------
-DROP TABLE IF EXISTS `gihon_role`;
-CREATE TABLE `gihon_role` (
-  `id` bigint(20) NOT NULL AUTO_INCREMENT,
-  `role_name` varchar(128) DEFAULT NULL COMMENT '角色名称',
-  `role_code` varchar(128) DEFAULT NULL COMMENT '角色编码',
-  `role_description` varchar(64) DEFAULT NULL COMMENT '角色描述',
-  `company_id` bigint(20) DEFAULT NULL COMMENT '公司Id(支持SAAS)',
-  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
-  `update_time` datetime DEFAULT NULL COMMENT '修改时间',
-  `create_user` bigint(20) DEFAULT NULL COMMENT '创建人',
-  `update_user` bigint(20) DEFAULT NULL COMMENT '修改人',
-  `state` int(11) DEFAULT NULL COMMENT '逻辑删除 1 删除 0 未删除',
-  PRIMARY KEY (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4;
-
--- ----------------------------
--- Records of gihon_role
--- ----------------------------
-INSERT INTO `gihon_role` VALUES ('1', '超级管理员', 'SUPER_ADMIN', null, null, '2022-07-19 17:29:35', '2022-07-19 17:29:38', '1', '1', '0');
-INSERT INTO `gihon_role` VALUES ('2', '公司管理员', 'COMPANY_ADMIN', null, null, '2022-07-19 20:11:23', '2022-07-19 20:11:25', '1', '1', '0');
-INSERT INTO `gihon_role` VALUES ('3', '普通操作员', 'NOARMAL_OPERATER', null, null, '2022-07-19 20:11:58', '2022-07-19 20:12:00', '1', '1', '0');
-
--- ----------------------------
--- Table structure for gihon_role_button_tr
--- ----------------------------
-DROP TABLE IF EXISTS `gihon_role_button_tr`;
-CREATE TABLE `gihon_role_button_tr` (
-  `button_id` bigint(20) NOT NULL,
-  `role_id` bigint(20) NOT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-
--- ----------------------------
--- Records of gihon_role_button_tr
--- ----------------------------
-INSERT INTO `gihon_role_button_tr` VALUES ('1', '2');
-INSERT INTO `gihon_role_button_tr` VALUES ('5', '2');
-INSERT INTO `gihon_role_button_tr` VALUES ('6', '2');
-INSERT INTO `gihon_role_button_tr` VALUES ('7', '2');
-INSERT INTO `gihon_role_button_tr` VALUES ('8', '2');
-INSERT INTO `gihon_role_button_tr` VALUES ('9', '2');
-INSERT INTO `gihon_role_button_tr` VALUES ('10', '2');
-INSERT INTO `gihon_role_button_tr` VALUES ('11', '2');
-INSERT INTO `gihon_role_button_tr` VALUES ('12', '2');
-INSERT INTO `gihon_role_button_tr` VALUES ('13', '2');
-INSERT INTO `gihon_role_button_tr` VALUES ('14', '2');
-INSERT INTO `gihon_role_button_tr` VALUES ('15', '2');
-INSERT INTO `gihon_role_button_tr` VALUES ('16', '2');
-INSERT INTO `gihon_role_button_tr` VALUES ('17', '2');
-INSERT INTO `gihon_role_button_tr` VALUES ('18', '2');
-INSERT INTO `gihon_role_button_tr` VALUES ('19', '2');
-INSERT INTO `gihon_role_button_tr` VALUES ('20', '2');
-INSERT INTO `gihon_role_button_tr` VALUES ('21', '2');
-INSERT INTO `gihon_role_button_tr` VALUES ('22', '2');
-INSERT INTO `gihon_role_button_tr` VALUES ('23', '2');
-INSERT INTO `gihon_role_button_tr` VALUES ('24', '2');
-INSERT INTO `gihon_role_button_tr` VALUES ('25', '2');
-INSERT INTO `gihon_role_button_tr` VALUES ('26', '2');
-INSERT INTO `gihon_role_button_tr` VALUES ('27', '2');
-INSERT INTO `gihon_role_button_tr` VALUES ('28', '2');
-INSERT INTO `gihon_role_button_tr` VALUES ('29', '2');
-INSERT INTO `gihon_role_button_tr` VALUES ('30', '2');
-INSERT INTO `gihon_role_button_tr` VALUES ('31', '2');
-INSERT INTO `gihon_role_button_tr` VALUES ('32', '2');
-INSERT INTO `gihon_role_button_tr` VALUES ('33', '2');
-INSERT INTO `gihon_role_button_tr` VALUES ('34', '2');
-
--- ----------------------------
--- Table structure for gihon_user
--- ----------------------------
-DROP TABLE IF EXISTS `gihon_user`;
-CREATE TABLE `gihon_user` (
-  `id` bigint(20) NOT NULL AUTO_INCREMENT,
-  `nick_name` varchar(128) DEFAULT NULL COMMENT '名称',
-  `username` varchar(128) DEFAULT NULL COMMENT '账号',
-  `telephone` varchar(64) DEFAULT NULL COMMENT '电话',
-  `password` varchar(512) DEFAULT NULL COMMENT '密码',
-  `gender` int(11) DEFAULT NULL COMMENT '1男2女',
-  `company_admin` tinyint(4) DEFAULT '0' COMMENT '是否是公司管理员',
-  `company_id` bigint(20) DEFAULT NULL COMMENT '公司Id(支持SAAS)',
-  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
-  `update_time` datetime DEFAULT NULL COMMENT '修改时间',
-  `create_user` bigint(20) DEFAULT NULL COMMENT '创建人',
-  `update_user` bigint(20) DEFAULT NULL COMMENT '修改人',
-  `state` int(11) DEFAULT NULL COMMENT '逻辑删除 1 删除 0 未删除',
-  PRIMARY KEY (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4;
-
--- ----------------------------
--- Records of gihon_user
--- ----------------------------
-INSERT INTO `gihon_user` VALUES ('1', '超级管理员', 'superadmin', '12345678901', 'b958f4fe692b19aec511ae835788f72f', '1', '1', null, '2022-07-19 14:23:34', '2022-07-19 14:23:40', '1', '1', '0');
-INSERT INTO `gihon_user` VALUES ('2', '禹佳科技管理员', 'yujiaadmin', '12354', '3356d4b49334f4b7847bad63a051e4f2', '2', '1', '2', '2022-07-19 14:28:26', '2022-07-19 14:28:29', '1', '1', '0');
-INSERT INTO `gihon_user` VALUES ('3', 'yoke1', 'yoke1', '123', '00d52c23e52459aa498bf5acdb50458d', '1', '0', '2', '2022-07-19 14:29:00', '2022-07-19 14:29:04', '2', '2', '0');
-
--- ----------------------------
--- Table structure for gihon_user_role_tr
--- ----------------------------
-DROP TABLE IF EXISTS `gihon_user_role_tr`;
-CREATE TABLE `gihon_user_role_tr` (
-  `user_id` bigint(20) NOT NULL,
-  `role_id` bigint(20) NOT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-
--- ----------------------------
--- Records of gihon_user_role_tr
--- ----------------------------
-INSERT INTO `gihon_user_role_tr` VALUES ('1', '1');
-INSERT INTO `gihon_user_role_tr` VALUES ('2', '2');
-INSERT INTO `gihon_user_role_tr` VALUES ('3', '3');

+ 0 - 32
component-entity/pom.xml

@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
-	<modelVersion>4.0.0</modelVersion>
-	<parent>
-		<groupId>gihon.component</groupId>
-		<artifactId>component-parent</artifactId>
-		<version>0.2.0-SNAPSHOT</version>
-		<relativePath>../</relativePath>
-	</parent>
-	<artifactId>component-entity</artifactId>
-	<name>component-entity</name>
-	<packaging>jar</packaging>
-	<description>通用实体</description>
-
-	<dependencies>
-		<!-- mybatis-plus -->
-		<dependency>
-			<groupId>com.baomidou</groupId>
-			<artifactId>mybatis-plus-boot-starter</artifactId>
-		</dependency>
-		<!-- Valid 校验 -->
-		<dependency>
-			<groupId>org.springframework.boot</groupId>
-			<artifactId>spring-boot-starter-validation</artifactId>
-		</dependency>	
-		<dependency>
-            <groupId>com.github.xiaoymin</groupId>
-	        <artifactId>knife4j-spring-boot-starter</artifactId>
-        </dependency>
-	</dependencies>
-</project>

+ 16 - 9
component-springboot/pom.xml

@@ -5,7 +5,7 @@
     <parent>
         <groupId>gihon.component</groupId>
 		<artifactId>component-parent</artifactId>
-        <version>0.2.0-SNAPSHOT</version>
+        <version>0.3.0-SNAPSHOT</version>
         <relativePath>../</relativePath>
     </parent>
     <artifactId>component-springboot</artifactId>
@@ -14,18 +14,10 @@
 
 
     <dependencies>
-    	<dependency>
-            <groupId>gihon.component</groupId>
-            <artifactId>component-entity</artifactId>
-    	</dependency>
     	<dependency>
             <groupId>gihon.component</groupId>
             <artifactId>component-common</artifactId>
     	</dependency>
-    	<dependency>
-            <groupId>gihon.component</groupId>
-            <artifactId>component-websecurity</artifactId>
-    	</dependency>
     	<!-- 单元测试 -->
     	<dependency>
             <groupId>org.springframework.boot</groupId>
@@ -93,6 +85,21 @@
                             </descriptors>
                         </configuration>
                     </execution>
+                    <execution>
+                        <id>make-assembly-lib</id>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>single</goal>
+                        </goals>
+                        <configuration>
+                            <finalName>lib</finalName>
+                            <skipAssembly>false</skipAssembly>
+                            <appendAssemblyId>false</appendAssemblyId>
+                            <descriptors>
+                                <descriptor>${assembly.path}package-lib.xml</descriptor>
+                            </descriptors>
+                        </configuration>
+                    </execution>
                 </executions>
             </plugin>
         </plugins>

+ 1 - 1
component-springboot/src/main/java/com/gihon/component/GihonRbacApplication.java

@@ -8,7 +8,7 @@ import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfi
 import org.springframework.boot.builder.SpringApplicationBuilder;
 import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
 
-@MapperScan({"com.gihon.component.mapper"})
+@MapperScan({"com.gihon.component.*.mapper"})
 @SpringBootApplication(exclude = {SecurityAutoConfiguration.class,RedisRepositoriesAutoConfiguration.class  })
 //@ComponentScan(excludeFilters = {@Filter(type = FilterType.REGEX,pattern = {"com.gihon.sso.controller.*"})} )
 public class GihonRbacApplication extends SpringBootServletInitializer{

+ 4 - 4
component-springboot/src/main/java/com/gihon/component/rbac/controller/CompanyController.java

@@ -12,14 +12,14 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.gihon.component.entity.rbac.GihonCompany;
 import com.gihon.component.exception.BusinessException;
+import com.gihon.component.rbac.entity.GihonCompany;
+import com.gihon.component.rbac.service.GihonCompanyService;
+import com.gihon.component.rbac.vo.CompanyListReq;
 import com.gihon.component.response.PageBean;
 import com.gihon.component.response.Response;
 import com.gihon.component.response.ResponseStatus;
 import com.gihon.component.response.SelectVal;
-import com.gihon.component.service.GihonCompanyService;
-import com.gihon.component.vo.CompanyListReq;
 import com.gihon.component.web.auth.AuthUtils;
 
 import io.swagger.annotations.Api;
@@ -27,7 +27,7 @@ import io.swagger.annotations.ApiOperation;
 
 @Api(value = "公司模块", tags = "公司模块")
 @RestController
-@RequestMapping("company")
+@RequestMapping("/rbac/company")
 public class CompanyController {
 
     @Autowired

+ 8 - 8
component-springboot/src/main/java/com/gihon/component/rbac/controller/ModuleController.java

@@ -13,22 +13,22 @@ import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.gihon.component.entity.rbac.GihonButton;
-import com.gihon.component.entity.rbac.GihonMenu;
-import com.gihon.component.entity.rbac.GihonModule;
+import com.gihon.component.rbac.entity.GihonButton;
+import com.gihon.component.rbac.entity.GihonMenu;
+import com.gihon.component.rbac.entity.GihonModule;
+import com.gihon.component.rbac.service.GihonButtonService;
+import com.gihon.component.rbac.service.GihonMenuService;
+import com.gihon.component.rbac.service.GihonModuleService;
+import com.gihon.component.rbac.vo.ModuleListReq;
 import com.gihon.component.response.PageBean;
 import com.gihon.component.response.Response;
-import com.gihon.component.service.GihonButtonService;
-import com.gihon.component.service.GihonMenuService;
-import com.gihon.component.service.GihonModuleService;
-import com.gihon.component.vo.rabc.ModuleListReq;
 
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 
 @Api(value ="系统菜单权限模块" ,tags = "系统菜单权限")
 @RestController
-@RequestMapping("module")
+@RequestMapping("/rbac/module")
 public class ModuleController {
 
 	@Autowired

+ 1 - 1
component-springboot/src/main/java/com/gihon/component/rbac/controller/PermissionContoller.java

@@ -16,7 +16,7 @@ import io.swagger.annotations.ApiOperation;
 
 @Api(value ="根据权限获取菜单当前系统菜单" ,tags = "根据权限获取菜单当前系统菜单")
 @RestController
-@RequestMapping("permission")
+@RequestMapping("/rbac/permission")
 public class PermissionContoller {
 
     @Autowired

+ 6 - 6
component-springboot/src/main/java/com/gihon/component/rbac/controller/RoleController.java

@@ -13,20 +13,20 @@ import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.gihon.component.entity.rbac.GihonButton;
-import com.gihon.component.entity.rbac.GihonRole;
+import com.gihon.component.rbac.entity.GihonButton;
+import com.gihon.component.rbac.entity.GihonRole;
+import com.gihon.component.rbac.service.GihonRoleService;
+import com.gihon.component.rbac.vo.RoleButtonReq;
+import com.gihon.component.rbac.vo.RoleListReq;
 import com.gihon.component.response.PageBean;
 import com.gihon.component.response.Response;
-import com.gihon.component.service.GihonRoleService;
-import com.gihon.component.vo.rabc.RoleButtonReq;
-import com.gihon.component.vo.rabc.RoleListReq;
 
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 
 @Api(value = "角色模块", tags = "角色模块")
 @RestController
-@RequestMapping("role")
+@RequestMapping("/rbac/role")
 public class RoleController {
 
 	@Autowired

+ 4 - 4
component-springboot/src/main/java/com/gihon/component/rbac/controller/UserController.java

@@ -10,13 +10,13 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.gihon.component.entity.rbac.GihonUser;
 import com.gihon.component.exception.BusinessException;
+import com.gihon.component.rbac.entity.GihonUser;
+import com.gihon.component.rbac.service.GihonUserService;
+import com.gihon.component.rbac.vo.UserListReq;
 import com.gihon.component.response.PageBean;
 import com.gihon.component.response.Response;
 import com.gihon.component.response.ResponseStatus;
-import com.gihon.component.service.GihonUserService;
-import com.gihon.component.vo.rabc.UserListReq;
 import com.gihon.component.web.auth.AuthUtils;
 
 import io.swagger.annotations.Api;
@@ -26,7 +26,7 @@ import lombok.extern.slf4j.Slf4j;
 @Api(value = "人员模块", tags = "人员模块")
 @Slf4j
 @RestController
-@RequestMapping("user")
+@RequestMapping("/rbac/user")
 public class UserController {
     @Autowired
     private GihonUserService gihonUserService;

+ 1 - 1
component-entity/src/main/java/com/gihon/component/entity/rbac/GihonButton.java → component-springboot/src/main/java/com/gihon/component/rbac/entity/GihonButton.java

@@ -1,4 +1,4 @@
-package com.gihon.component.entity.rbac;
+package com.gihon.component.rbac.entity;
 
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableName;

+ 1 - 1
component-entity/src/main/java/com/gihon/component/entity/rbac/GihonCompany.java → component-springboot/src/main/java/com/gihon/component/rbac/entity/GihonCompany.java

@@ -1,4 +1,4 @@
-package com.gihon.component.entity.rbac;
+package com.gihon.component.rbac.entity;
 
 import javax.validation.constraints.NotBlank;
 import javax.validation.constraints.NotEmpty;

+ 1 - 1
component-entity/src/main/java/com/gihon/component/entity/rbac/GihonMenu.java → component-springboot/src/main/java/com/gihon/component/rbac/entity/GihonMenu.java

@@ -1,4 +1,4 @@
-package com.gihon.component.entity.rbac;
+package com.gihon.component.rbac.entity;
 
 import javax.validation.constraints.NotBlank;
 import javax.validation.constraints.NotNull;

+ 1 - 1
component-entity/src/main/java/com/gihon/component/entity/rbac/GihonModule.java → component-springboot/src/main/java/com/gihon/component/rbac/entity/GihonModule.java

@@ -1,4 +1,4 @@
-package com.gihon.component.entity.rbac;
+package com.gihon.component.rbac.entity;
 
 import javax.validation.constraints.Max;
 import javax.validation.constraints.Min;

+ 1 - 1
component-entity/src/main/java/com/gihon/component/entity/rbac/GihonRole.java → component-springboot/src/main/java/com/gihon/component/rbac/entity/GihonRole.java

@@ -1,4 +1,4 @@
-package com.gihon.component.entity.rbac;
+package com.gihon.component.rbac.entity;
 
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.gihon.component.entity.CompanyBaseEntity;

+ 1 - 1
component-entity/src/main/java/com/gihon/component/entity/rbac/GihonRoleButton.java → component-springboot/src/main/java/com/gihon/component/rbac/entity/GihonRoleButton.java

@@ -1,4 +1,4 @@
-package com.gihon.component.entity.rbac;
+package com.gihon.component.rbac.entity;
 
 import com.baomidou.mybatisplus.annotation.TableName;
 

+ 14 - 1
component-entity/src/main/java/com/gihon/component/entity/rbac/GihonUser.java → component-springboot/src/main/java/com/gihon/component/rbac/entity/GihonUser.java

@@ -1,4 +1,4 @@
-package com.gihon.component.entity.rbac;
+package com.gihon.component.rbac.entity;
 
 import javax.validation.constraints.Max;
 import javax.validation.constraints.Min;
@@ -8,6 +8,7 @@ import javax.validation.constraints.Size;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.fasterxml.jackson.annotation.JsonIgnore;
 import com.gihon.component.entity.CompanyBaseEntity;
+import com.gihon.component.web.vo.UserInfo;
 
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Getter;
@@ -55,4 +56,16 @@ public class GihonUser extends CompanyBaseEntity {
      */
     @ApiModelProperty(value = "是否是公司管理员")
     private Boolean companyAdmin = false;
+    
+    public UserInfo toUserInfo() {
+        UserInfo userInfo = new UserInfo();
+        userInfo.setId(this.id);
+        userInfo.setUsername(this.username);
+        userInfo.setNickName(this.nickName);
+        userInfo.setPassword(this.password);
+        userInfo.setSalt(this.username);
+        userInfo.setCompanyId(this.companyId);
+        userInfo.setCompanyAdmin(this.companyAdmin);
+        return userInfo;
+    }
 }

+ 1 - 1
component-entity/src/main/java/com/gihon/component/entity/rbac/GihonUserRole.java → component-springboot/src/main/java/com/gihon/component/rbac/entity/GihonUserRole.java

@@ -1,4 +1,4 @@
-package com.gihon.component.entity.rbac;
+package com.gihon.component.rbac.entity;
 
 import com.baomidou.mybatisplus.annotation.TableName;
 

+ 2 - 2
component-database/src/main/java/com/gihon/component/mapper/rabc/GihonButtonMapper.java → component-springboot/src/main/java/com/gihon/component/rbac/mapper/GihonButtonMapper.java

@@ -1,9 +1,9 @@
-package com.gihon.component.mapper.rabc;
+package com.gihon.component.rbac.mapper;
 
 import org.apache.ibatis.annotations.Mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.gihon.component.entity.rbac.GihonButton;
+import com.gihon.component.rbac.entity.GihonButton;
 
 @Mapper
 public interface GihonButtonMapper extends BaseMapper<GihonButton>{

+ 2 - 2
component-database/src/main/java/com/gihon/component/mapper/GihonCompanyMapper.java → component-springboot/src/main/java/com/gihon/component/rbac/mapper/GihonCompanyMapper.java

@@ -1,9 +1,9 @@
-package com.gihon.component.mapper;
+package com.gihon.component.rbac.mapper;
 
 import org.apache.ibatis.annotations.Mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.gihon.component.entity.rbac.GihonCompany;
+import com.gihon.component.rbac.entity.GihonCompany;
 
 
 @Mapper

+ 2 - 2
component-database/src/main/java/com/gihon/component/mapper/rabc/GihonMenuMapper.java → component-springboot/src/main/java/com/gihon/component/rbac/mapper/GihonMenuMapper.java

@@ -1,9 +1,9 @@
-package com.gihon.component.mapper.rabc;
+package com.gihon.component.rbac.mapper;
 
 import org.apache.ibatis.annotations.Mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.gihon.component.entity.rbac.GihonMenu;
+import com.gihon.component.rbac.entity.GihonMenu;
 
 @Mapper
 public interface GihonMenuMapper extends BaseMapper<GihonMenu>{

+ 2 - 2
component-database/src/main/java/com/gihon/component/mapper/rabc/GihonModuleMapper.java → component-springboot/src/main/java/com/gihon/component/rbac/mapper/GihonModuleMapper.java

@@ -1,9 +1,9 @@
-package com.gihon.component.mapper.rabc;
+package com.gihon.component.rbac.mapper;
 
 import org.apache.ibatis.annotations.Mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.gihon.component.entity.rbac.GihonModule;
+import com.gihon.component.rbac.entity.GihonModule;
 
 @Mapper
 public interface GihonModuleMapper extends BaseMapper<GihonModule>{

+ 2 - 2
component-database/src/main/java/com/gihon/component/mapper/rabc/GihonRoleButtonMapper.java → component-springboot/src/main/java/com/gihon/component/rbac/mapper/GihonRoleButtonMapper.java

@@ -1,4 +1,4 @@
-package com.gihon.component.mapper.rabc;
+package com.gihon.component.rbac.mapper;
 
 import java.util.List;
 
@@ -7,7 +7,7 @@ import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.gihon.component.entity.rbac.GihonRoleButton;
+import com.gihon.component.rbac.entity.GihonRoleButton;
 
 @Mapper
 public interface GihonRoleButtonMapper extends BaseMapper<GihonRoleButton>{

+ 2 - 2
component-database/src/main/java/com/gihon/component/mapper/rabc/GihonRoleMapper.java → component-springboot/src/main/java/com/gihon/component/rbac/mapper/GihonRoleMapper.java

@@ -1,9 +1,9 @@
-package com.gihon.component.mapper.rabc;
+package com.gihon.component.rbac.mapper;
 
 import org.apache.ibatis.annotations.Mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.gihon.component.entity.rbac.GihonRole;
+import com.gihon.component.rbac.entity.GihonRole;
 
 @Mapper
 public interface GihonRoleMapper extends BaseMapper<GihonRole>{

+ 2 - 2
component-database/src/main/java/com/gihon/component/mapper/rabc/GihonUserMapper.java → component-springboot/src/main/java/com/gihon/component/rbac/mapper/GihonUserMapper.java

@@ -1,9 +1,9 @@
-package com.gihon.component.mapper.rabc;
+package com.gihon.component.rbac.mapper;
 
 import org.apache.ibatis.annotations.Mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.gihon.component.entity.rbac.GihonUser;
+import com.gihon.component.rbac.entity.GihonUser;
 
 @Mapper
 public interface GihonUserMapper extends BaseMapper<GihonUser>{

+ 2 - 2
component-database/src/main/java/com/gihon/component/mapper/rabc/GihonUserRoleMapper.java → component-springboot/src/main/java/com/gihon/component/rbac/mapper/GihonUserRoleMapper.java

@@ -1,9 +1,9 @@
-package com.gihon.component.mapper.rabc;
+package com.gihon.component.rbac.mapper;
 
 import org.apache.ibatis.annotations.Mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.gihon.component.entity.rbac.GihonUserRole;
+import com.gihon.component.rbac.entity.GihonUserRole;
 
 @Mapper
 public interface GihonUserRoleMapper extends BaseMapper<GihonUserRole>{

+ 1 - 1
component-database/src/main/java/com/gihon/component/mapper/package-info.java → component-springboot/src/main/java/com/gihon/component/rbac/mapper/package-info.java

@@ -1,4 +1,4 @@
 /**
  * 需要使用 注解指定包 @MapperScan({"com.gihon.component.mapper"})
  */
-package com.gihon.component.mapper;
+package com.gihon.component.rbac.mapper;

+ 2 - 2
component-database/src/main/java/com/gihon/component/service/GihonButtonService.java → component-springboot/src/main/java/com/gihon/component/rbac/service/GihonButtonService.java

@@ -1,9 +1,9 @@
-package com.gihon.component.service;
+package com.gihon.component.rbac.service;
 
 import java.util.List;
 
 import com.baomidou.mybatisplus.extension.service.IService;
-import com.gihon.component.entity.rbac.GihonButton;
+import com.gihon.component.rbac.entity.GihonButton;
 
 public interface GihonButtonService extends IService<GihonButton> {
 

+ 3 - 3
component-database/src/main/java/com/gihon/component/service/GihonCompanyService.java → component-springboot/src/main/java/com/gihon/component/rbac/service/GihonCompanyService.java

@@ -1,12 +1,12 @@
-package com.gihon.component.service;
+package com.gihon.component.rbac.service;
 
 import java.util.List;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
-import com.gihon.component.entity.rbac.GihonCompany;
+import com.gihon.component.rbac.entity.GihonCompany;
+import com.gihon.component.rbac.vo.CompanyListReq;
 import com.gihon.component.response.SelectVal;
-import com.gihon.component.vo.CompanyListReq;
 
 public interface GihonCompanyService extends IService<GihonCompany> {
 

+ 2 - 2
component-database/src/main/java/com/gihon/component/service/GihonMenuService.java → component-springboot/src/main/java/com/gihon/component/rbac/service/GihonMenuService.java

@@ -1,11 +1,11 @@
-package com.gihon.component.service;
+package com.gihon.component.rbac.service;
 
 import java.util.List;
 
 import org.springframework.stereotype.Service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
-import com.gihon.component.entity.rbac.GihonMenu;
+import com.gihon.component.rbac.entity.GihonMenu;
 
 public interface GihonMenuService extends IService<GihonMenu> {
 

+ 3 - 3
component-database/src/main/java/com/gihon/component/service/GihonModuleService.java → component-springboot/src/main/java/com/gihon/component/rbac/service/GihonModuleService.java

@@ -1,9 +1,9 @@
-package com.gihon.component.service;
+package com.gihon.component.rbac.service;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
-import com.gihon.component.entity.rbac.GihonModule;
-import com.gihon.component.vo.rabc.ModuleListReq;
+import com.gihon.component.rbac.entity.GihonModule;
+import com.gihon.component.rbac.vo.ModuleListReq;
 
 public interface GihonModuleService extends IService<GihonModule> {
 

+ 2 - 2
component-database/src/main/java/com/gihon/component/service/GihonRoleButtonService.java → component-springboot/src/main/java/com/gihon/component/rbac/service/GihonRoleButtonService.java

@@ -1,9 +1,9 @@
-package com.gihon.component.service;
+package com.gihon.component.rbac.service;
 
 import java.util.List;
 
 import com.baomidou.mybatisplus.extension.service.IService;
-import com.gihon.component.entity.rbac.GihonRoleButton;
+import com.gihon.component.rbac.entity.GihonRoleButton;
 
 public interface GihonRoleButtonService extends IService<GihonRoleButton> {
 

+ 5 - 5
component-database/src/main/java/com/gihon/component/service/GihonRoleService.java → component-springboot/src/main/java/com/gihon/component/rbac/service/GihonRoleService.java

@@ -1,13 +1,13 @@
-package com.gihon.component.service;
+package com.gihon.component.rbac.service;
 
 import java.util.List;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
-import com.gihon.component.entity.rbac.GihonButton;
-import com.gihon.component.entity.rbac.GihonRole;
-import com.gihon.component.vo.rabc.RoleButtonReq;
-import com.gihon.component.vo.rabc.RoleListReq;
+import com.gihon.component.rbac.entity.GihonButton;
+import com.gihon.component.rbac.entity.GihonRole;
+import com.gihon.component.rbac.vo.RoleButtonReq;
+import com.gihon.component.rbac.vo.RoleListReq;
 
 public interface GihonRoleService extends IService<GihonRole> {
 

+ 2 - 2
component-database/src/main/java/com/gihon/component/service/GihonUserRoleService.java → component-springboot/src/main/java/com/gihon/component/rbac/service/GihonUserRoleService.java

@@ -1,9 +1,9 @@
-package com.gihon.component.service;
+package com.gihon.component.rbac.service;
 
 import java.util.List;
 
 import com.baomidou.mybatisplus.extension.service.IService;
-import com.gihon.component.entity.rbac.GihonUserRole;
+import com.gihon.component.rbac.entity.GihonUserRole;
 
 public interface GihonUserRoleService extends IService<GihonUserRole> {
 

+ 3 - 3
component-database/src/main/java/com/gihon/component/service/GihonUserService.java → component-springboot/src/main/java/com/gihon/component/rbac/service/GihonUserService.java

@@ -1,11 +1,11 @@
-package com.gihon.component.service;
+package com.gihon.component.rbac.service;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
-import com.gihon.component.entity.rbac.GihonUser;
 import com.gihon.component.exception.BusinessException;
+import com.gihon.component.rbac.entity.GihonUser;
+import com.gihon.component.rbac.vo.UserListReq;
 import com.gihon.component.util.PasswordUtils;
-import com.gihon.component.vo.rabc.UserListReq;
 
 public interface GihonUserService extends IService<GihonUser> {
 

+ 5 - 5
component-database/src/main/java/com/gihon/component/service/impl/GihonButtonServiceImpl.java → component-springboot/src/main/java/com/gihon/component/rbac/service/impl/GihonButtonServiceImpl.java

@@ -1,4 +1,4 @@
-package com.gihon.component.service.impl;
+package com.gihon.component.rbac.service.impl;
 
 import java.util.List;
 
@@ -6,11 +6,11 @@ import org.springframework.stereotype.Service;
 
 import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.gihon.component.entity.rbac.GihonButton;
-import com.gihon.component.entity.rbac.GihonMenu;
 import com.gihon.component.exception.BusinessException;
-import com.gihon.component.mapper.rabc.GihonButtonMapper;
-import com.gihon.component.service.GihonButtonService;
+import com.gihon.component.rbac.entity.GihonButton;
+import com.gihon.component.rbac.entity.GihonMenu;
+import com.gihon.component.rbac.mapper.GihonButtonMapper;
+import com.gihon.component.rbac.service.GihonButtonService;
 import com.google.common.collect.Lists;
 
 /**

+ 5 - 5
component-database/src/main/java/com/gihon/component/service/impl/GihonCompanyServiceImpl.java → component-springboot/src/main/java/com/gihon/component/rbac/service/impl/GihonCompanyServiceImpl.java

@@ -1,4 +1,4 @@
-package com.gihon.component.service.impl;
+package com.gihon.component.rbac.service.impl;
 
 import java.util.List;
 import java.util.stream.Collectors;
@@ -9,12 +9,12 @@ import org.springframework.util.StringUtils;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.gihon.component.entity.rbac.GihonCompany;
 import com.gihon.component.exception.BusinessException;
-import com.gihon.component.mapper.GihonCompanyMapper;
+import com.gihon.component.rbac.entity.GihonCompany;
+import com.gihon.component.rbac.mapper.GihonCompanyMapper;
+import com.gihon.component.rbac.service.GihonCompanyService;
+import com.gihon.component.rbac.vo.CompanyListReq;
 import com.gihon.component.response.SelectVal;
-import com.gihon.component.service.GihonCompanyService;
-import com.gihon.component.vo.CompanyListReq;
 
 /**
  * 直接继承没有多实现处理

+ 4 - 4
component-database/src/main/java/com/gihon/component/service/impl/GihonMenuServiceImpl.java → component-springboot/src/main/java/com/gihon/component/rbac/service/impl/GihonMenuServiceImpl.java

@@ -1,4 +1,4 @@
-package com.gihon.component.service.impl;
+package com.gihon.component.rbac.service.impl;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -7,10 +7,10 @@ import org.springframework.stereotype.Service;
 
 import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.gihon.component.entity.rbac.GihonMenu;
 import com.gihon.component.exception.BusinessException;
-import com.gihon.component.mapper.rabc.GihonMenuMapper;
-import com.gihon.component.service.GihonMenuService;
+import com.gihon.component.rbac.entity.GihonMenu;
+import com.gihon.component.rbac.mapper.GihonMenuMapper;
+import com.gihon.component.rbac.service.GihonMenuService;
 
 /**
  * 直接继承没有多实现处理

+ 5 - 5
component-database/src/main/java/com/gihon/component/service/impl/GihonModuleServiceImpl.java → component-springboot/src/main/java/com/gihon/component/rbac/service/impl/GihonModuleServiceImpl.java

@@ -1,4 +1,4 @@
-package com.gihon.component.service.impl;
+package com.gihon.component.rbac.service.impl;
 
 import org.springframework.stereotype.Service;
 import org.springframework.util.StringUtils;
@@ -6,11 +6,11 @@ import org.springframework.util.StringUtils;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.gihon.component.entity.rbac.GihonModule;
 import com.gihon.component.exception.BusinessException;
-import com.gihon.component.mapper.rabc.GihonModuleMapper;
-import com.gihon.component.service.GihonModuleService;
-import com.gihon.component.vo.rabc.ModuleListReq;
+import com.gihon.component.rbac.entity.GihonModule;
+import com.gihon.component.rbac.mapper.GihonModuleMapper;
+import com.gihon.component.rbac.service.GihonModuleService;
+import com.gihon.component.rbac.vo.ModuleListReq;
 
 /**
  * 直接继承没有多实现处理

+ 4 - 4
component-database/src/main/java/com/gihon/component/service/impl/GihonRoleButtonServiceImpl.java → component-springboot/src/main/java/com/gihon/component/rbac/service/impl/GihonRoleButtonServiceImpl.java

@@ -1,4 +1,4 @@
-package com.gihon.component.service.impl;
+package com.gihon.component.rbac.service.impl;
 
 import java.util.List;
 import java.util.stream.Collectors;
@@ -6,9 +6,9 @@ import java.util.stream.Collectors;
 import org.springframework.stereotype.Service;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.gihon.component.entity.rbac.GihonRoleButton;
-import com.gihon.component.mapper.rabc.GihonRoleButtonMapper;
-import com.gihon.component.service.GihonRoleButtonService;
+import com.gihon.component.rbac.entity.GihonRoleButton;
+import com.gihon.component.rbac.mapper.GihonRoleButtonMapper;
+import com.gihon.component.rbac.service.GihonRoleButtonService;
 
 /**
  * 直接继承没有多实现处理

+ 7 - 7
component-database/src/main/java/com/gihon/component/service/impl/GihonRoleServiceImpl.java → component-springboot/src/main/java/com/gihon/component/rbac/service/impl/GihonRoleServiceImpl.java

@@ -1,4 +1,4 @@
-package com.gihon.component.service.impl;
+package com.gihon.component.rbac.service.impl;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -12,13 +12,13 @@ import org.springframework.util.StringUtils;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.gihon.component.entity.rbac.GihonButton;
-import com.gihon.component.entity.rbac.GihonRole;
 import com.gihon.component.exception.BusinessException;
-import com.gihon.component.mapper.rabc.GihonRoleMapper;
-import com.gihon.component.service.GihonRoleService;
-import com.gihon.component.vo.rabc.RoleButtonReq;
-import com.gihon.component.vo.rabc.RoleListReq;
+import com.gihon.component.rbac.entity.GihonButton;
+import com.gihon.component.rbac.entity.GihonRole;
+import com.gihon.component.rbac.mapper.GihonRoleMapper;
+import com.gihon.component.rbac.service.GihonRoleService;
+import com.gihon.component.rbac.vo.RoleButtonReq;
+import com.gihon.component.rbac.vo.RoleListReq;
 
 /**
  * 直接继承没有多实现处理

+ 4 - 4
component-database/src/main/java/com/gihon/component/service/impl/GihonUserRoleServiceImpl.java → component-springboot/src/main/java/com/gihon/component/rbac/service/impl/GihonUserRoleServiceImpl.java

@@ -1,4 +1,4 @@
-package com.gihon.component.service.impl;
+package com.gihon.component.rbac.service.impl;
 
 import java.util.List;
 import java.util.stream.Collectors;
@@ -6,9 +6,9 @@ import java.util.stream.Collectors;
 import org.springframework.stereotype.Service;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.gihon.component.entity.rbac.GihonUserRole;
-import com.gihon.component.mapper.rabc.GihonUserRoleMapper;
-import com.gihon.component.service.GihonUserRoleService;
+import com.gihon.component.rbac.entity.GihonUserRole;
+import com.gihon.component.rbac.mapper.GihonUserRoleMapper;
+import com.gihon.component.rbac.service.GihonUserRoleService;
 
 /**
  * 直接继承没有多实现处理

+ 7 - 7
component-database/src/main/java/com/gihon/component/service/impl/GihonUserServiceImpl.java → component-springboot/src/main/java/com/gihon/component/rbac/service/impl/GihonUserServiceImpl.java

@@ -1,4 +1,4 @@
-package com.gihon.component.service.impl;
+package com.gihon.component.rbac.service.impl;
 
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -7,12 +7,12 @@ import org.springframework.util.StringUtils;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.gihon.component.entity.rbac.GihonCompany;
-import com.gihon.component.entity.rbac.GihonUser;
-import com.gihon.component.mapper.rabc.GihonUserMapper;
-import com.gihon.component.service.GihonCompanyService;
-import com.gihon.component.service.GihonUserService;
-import com.gihon.component.vo.rabc.UserListReq;
+import com.gihon.component.rbac.entity.GihonCompany;
+import com.gihon.component.rbac.entity.GihonUser;
+import com.gihon.component.rbac.mapper.GihonUserMapper;
+import com.gihon.component.rbac.service.GihonCompanyService;
+import com.gihon.component.rbac.service.GihonUserService;
+import com.gihon.component.rbac.vo.UserListReq;
 
 /**
  * 直接继承没有多实现处理

+ 101 - 0
component-springboot/src/main/java/com/gihon/component/rbac/service/impl/PermissionServiceImpl.java

@@ -1,17 +1,31 @@
 package com.gihon.component.rbac.service.impl;
 
+
 import java.util.ArrayList;
 import java.util.List;
 import java.util.stream.Collectors;
 
+import javax.annotation.PostConstruct;
+
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.redis.core.StringRedisTemplate;
 import org.springframework.stereotype.Service;
 
 import com.fasterxml.jackson.core.type.TypeReference;
+import com.gihon.component.entity.BaseEntity;
 import com.gihon.component.enums.ModuleType;
 import com.gihon.component.properties.GihonCommonProperties;
 import com.gihon.component.properties.RedisConstants;
+import com.gihon.component.rbac.entity.GihonButton;
+import com.gihon.component.rbac.entity.GihonMenu;
+import com.gihon.component.rbac.entity.GihonModule;
+import com.gihon.component.rbac.entity.GihonRole;
+import com.gihon.component.rbac.service.GihonButtonService;
+import com.gihon.component.rbac.service.GihonMenuService;
+import com.gihon.component.rbac.service.GihonModuleService;
+import com.gihon.component.rbac.service.GihonRoleButtonService;
+import com.gihon.component.rbac.service.GihonRoleService;
 import com.gihon.component.rbac.service.PermissionService;
 import com.gihon.component.util.JacksonJsonUtils;
 import com.gihon.component.web.auth.AuthConstans;
@@ -20,6 +34,9 @@ import com.gihon.component.web.auth.AuthUtils;
 import com.gihon.component.web.vo.MenuVO;
 import com.gihon.component.web.vo.PermissionVO;
 
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
 @Service
 public class PermissionServiceImpl implements PermissionService {
 
@@ -29,6 +46,21 @@ public class PermissionServiceImpl implements PermissionService {
     @Autowired
     private GihonCommonProperties gihonCommonProperties;
 
+    @Autowired
+    private GihonModuleService gihonModuleService;
+
+    @Autowired
+    private GihonMenuService gihonMenuService;
+
+    @Autowired
+    private GihonButtonService gihonButtonService;
+
+    @Autowired
+    private GihonRoleButtonService gihonRoleButtonService;
+
+    @Autowired
+    private GihonRoleService gihonRoleService;
+
     @Override
     public List<MenuVO> getPermission() {
 
@@ -90,4 +122,73 @@ public class PermissionServiceImpl implements PermissionService {
         }
     }
 
+    // 定时刷新或者AOP通知
+    @PostConstruct
+    public void init() {
+        try {
+
+            List<GihonModule> moduleList = gihonModuleService.lambdaQuery().list();
+            for (GihonModule module : moduleList) {
+                List<GihonMenu> menuList = gihonMenuService.getAllMenu(module.getId(), false);
+
+                List<MenuVO> menus = new ArrayList<>();
+
+                MenuVO root = new MenuVO();
+                root.setMenuCode(gihonCommonProperties.getModuleCode());
+                root.setMenuId(-1L);
+
+                menus.add(root);
+                MenuVO mp = new MenuVO();
+
+                menuList.forEach(m -> {
+                    MenuVO mv = new MenuVO();
+                    mv.setMenuCode(m.getMenuCode());
+                    mv.setMenuId(m.getId());
+                    menus.add(mv);
+                    // mp.setMenuId(m.getParentId());
+                    // int index = menus.indexOf(mp);
+                    // if (index > 0) {
+                    // menus.get(index).addMenu(mp);
+                    // }
+                });
+                List<GihonButton> buttonList = gihonButtonService
+                    .getMenuButton(menuList.stream().map(BaseEntity::getId).collect(Collectors.toList()), false);
+                List<PermissionVO> plist = new ArrayList<>();
+                for (GihonButton btn : buttonList) {
+                    List<Long> rbtnList = gihonRoleButtonService.getRoleListByBtn(btn.getId());
+                    PermissionVO pvo = new PermissionVO();
+                    pvo.setUrl(btn.getPath());
+                    pvo.setMethod(btn.getMethod());
+                    pvo.setBtnCode(btn.getButtonCode());
+                    pvo.setBtnName(btn.getButtonName());
+                    if (!rbtnList.isEmpty()) {
+                        List<GihonRole> rl = gihonRoleService.getRoleListByIds(rbtnList);
+                        pvo.setRoleList(rl.stream().map(r -> r.getCompanyId() + RedisConstants.SEP + r.getRoleCode())
+                            .collect(Collectors.toList()));
+                    } else {
+                        pvo.setRoleList(new ArrayList<>(0));
+                    }
+                    mp.setMenuId(btn.getMenuId());
+                    int index = menus.indexOf(mp);
+                    if (index > 0) {
+                        menus.get(index).addPermission(pvo);
+                    }
+                    if (StringUtils.isBlank(btn.getPath())) {
+                        continue;
+                    }
+                    plist.add(pvo);
+                }
+                // 用于拦截器的访问权限按钮
+                stringRedisTemplate.opsForHash().put(RedisConstants.PERMISSN_REDIS,
+                    gihonCommonProperties.getModuleCode() + RedisConstants.SEP + gihonCommonProperties.getModuleType(),
+                    JacksonJsonUtils.writeObject(plist));
+                // 用于拦截器的访问权限按钮
+                stringRedisTemplate.opsForHash().put(RedisConstants.MENU_TREE_REDIS,
+                    gihonCommonProperties.getModuleCode() + RedisConstants.SEP + gihonCommonProperties.getModuleType(),
+                    JacksonJsonUtils.writeObject(menus));
+            }
+        } catch (Exception e) {
+            log.error("初始化模块菜单失败:", e);
+        }
+    }
 }

+ 1 - 1
component-database/src/main/java/com/gihon/component/vo/CompanyListReq.java → component-springboot/src/main/java/com/gihon/component/rbac/vo/CompanyListReq.java

@@ -1,4 +1,4 @@
-package com.gihon.component.vo;
+package com.gihon.component.rbac.vo;
 
 import com.gihon.component.vo.PageReq;
 

+ 1 - 1
component-database/src/main/java/com/gihon/component/vo/rabc/ModuleListReq.java → component-springboot/src/main/java/com/gihon/component/rbac/vo/ModuleListReq.java

@@ -1,4 +1,4 @@
-package com.gihon.component.vo.rabc;
+package com.gihon.component.rbac.vo;
 
 import com.gihon.component.vo.PageReq;
 

+ 1 - 1
component-database/src/main/java/com/gihon/component/vo/rabc/RoleButtonReq.java → component-springboot/src/main/java/com/gihon/component/rbac/vo/RoleButtonReq.java

@@ -1,4 +1,4 @@
-package com.gihon.component.vo.rabc;
+package com.gihon.component.rbac.vo;
 
 import java.util.List;
 

+ 1 - 1
component-database/src/main/java/com/gihon/component/vo/rabc/RoleListReq.java → component-springboot/src/main/java/com/gihon/component/rbac/vo/RoleListReq.java

@@ -1,4 +1,4 @@
-package com.gihon.component.vo.rabc;
+package com.gihon.component.rbac.vo;
 
 import com.gihon.component.vo.PageReq;
 

+ 1 - 1
component-database/src/main/java/com/gihon/component/vo/rabc/UserListReq.java → component-springboot/src/main/java/com/gihon/component/rbac/vo/UserListReq.java

@@ -1,4 +1,4 @@
-package com.gihon.component.vo.rabc;
+package com.gihon.component.rbac.vo;
 
 import com.gihon.component.vo.PageReq;
 

+ 0 - 0
component-sso/src/main/java/com/gihon/component/sso/controller/LoginController.java → component-springboot/src/main/java/com/gihon/component/sso/controller/LoginController.java


+ 0 - 0
component-sso/src/main/java/com/gihon/component/sso/service/LoginUserService.java → component-springboot/src/main/java/com/gihon/component/sso/service/LoginUserService.java


+ 6 - 4
component-sso/src/main/java/com/gihon/component/sso/service/impl/LoginUserServiceImpl.java → component-springboot/src/main/java/com/gihon/component/sso/service/impl/LoginUserServiceImpl.java

@@ -3,10 +3,10 @@ package com.gihon.component.sso.service.impl;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import com.gihon.component.entity.rbac.GihonUser;
 import com.gihon.component.exception.LoginException;
+import com.gihon.component.rbac.entity.GihonUser;
+import com.gihon.component.rbac.service.GihonUserService;
 import com.gihon.component.response.ResponseStatus;
-import com.gihon.component.service.GihonUserService;
 import com.gihon.component.sso.service.LoginUserService;
 import com.gihon.component.util.PasswordUtils;
 import com.gihon.component.web.vo.UserInfo;
@@ -22,7 +22,7 @@ public class LoginUserServiceImpl implements LoginUserService {
         GihonUser user = gihonUserService.lambdaQuery().eq(GihonUser::getUsername, account).one();
         UserInfo userInfo = null;
         if (user != null) {
-            userInfo = new UserInfo(user);
+            userInfo = user.toUserInfo();
         }
         return userInfo;
     }
@@ -34,11 +34,13 @@ public class LoginUserServiceImpl implements LoginUserService {
             throw new LoginException(ResponseStatus.LOGIN_ERROR);
         }
         boolean checkFlag = PasswordUtils.checkPassword(userInfo.getPassword(), password, userInfo.getSalt());
-        
+
         if (!checkFlag) {
             throw new LoginException(ResponseStatus.LOGIN_ERROR);
         }
         return userInfo;
     }
 
+   
+
 }

+ 40 - 0
component-springboot/src/main/java/com/gihon/component/sso/service/impl/UserInfoServiceImpl.java

@@ -0,0 +1,40 @@
+package com.gihon.component.sso.service.impl;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.gihon.component.properties.RedisConstants;
+import com.gihon.component.rbac.entity.GihonRole;
+import com.gihon.component.rbac.entity.GihonUser;
+import com.gihon.component.rbac.service.GihonRoleService;
+import com.gihon.component.rbac.service.GihonUserService;
+import com.gihon.component.web.service.impl.UserInfoService;
+import com.gihon.component.web.vo.UserInfo;
+
+@Service
+public class UserInfoServiceImpl implements UserInfoService {
+
+    @Autowired
+    private GihonUserService gihonUserService;
+    @Autowired
+    private GihonRoleService gihonRoleService;
+
+    @Override
+    public UserInfo queryUserByUserAccount(String account) {
+        GihonUser user = gihonUserService.lambdaQuery().eq(GihonUser::getUsername, account).one();
+        UserInfo userInfo = null;
+        if (user != null) {
+            userInfo = user.toUserInfo();
+            List<GihonRole> rl = gihonRoleService.getRoleList(userInfo.getId());
+            userInfo.setRoleList(rl.stream().map(r -> r.getCompanyId() + RedisConstants.SEP + r.getRoleCode())
+                .collect(Collectors.toList()));
+        }
+
+        return userInfo;
+
+    }
+
+}

+ 2 - 1
component-springboot/src/main/resources/application-dev.yml

@@ -12,6 +12,7 @@ spring:
 gihon:
   common:
     executor: false
-    sync: false
+    async: false
+    login-path: 'sso/login'
     module-type: 1
     module-code: SystemManage

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно