diff --git a/len-core/src/main/java/com/len/base/AbstractEntity.java b/len-core/src/main/java/com/len/base/AbstractEntity.java index dd40ac4..af3f196 100644 --- a/len-core/src/main/java/com/len/base/AbstractEntity.java +++ b/len-core/src/main/java/com/len/base/AbstractEntity.java @@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import lombok.Data; +import java.io.Serializable; import java.util.Date; /** @@ -12,7 +13,7 @@ import java.util.Date; * @date 2019-11-12. */ @Data -public class AbstractEntity { +public class AbstractEntity implements Serializable { @TableId(type = IdType.UUID) private String id; diff --git a/len-sys/src/main/java/com/len/entity/SysMenu.java b/len-sys/src/main/java/com/len/entity/SysMenu.java index e28691e..de53e15 100644 --- a/len-sys/src/main/java/com/len/entity/SysMenu.java +++ b/len-sys/src/main/java/com/len/entity/SysMenu.java @@ -1,23 +1,19 @@ package com.len.entity; -import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.len.base.AbstractEntity; import lombok.Data; -import lombok.EqualsAndHashCode; import lombok.ToString; +import java.io.Serializable; import java.util.ArrayList; -import java.util.Date; import java.util.List; @TableName("sys_menu") @Data @ToString -@EqualsAndHashCode -public class SysMenu extends AbstractEntity { +public class SysMenu extends AbstractEntity implements Serializable { private String name; diff --git a/len-sys/src/main/java/com/len/service/impl/SysUserServiceImpl.java b/len-sys/src/main/java/com/len/service/impl/SysUserServiceImpl.java index 8fc7783..1a798b1 100644 --- a/len-sys/src/main/java/com/len/service/impl/SysUserServiceImpl.java +++ b/len-sys/src/main/java/com/len/service/impl/SysUserServiceImpl.java @@ -197,7 +197,7 @@ public class SysUserServiceImpl extends BaseServiceImpl impleme List menuList = menuService.getUserMenu(s.getId()); JSONArray json = menuService.getMenuJsonByUser(menuList); - session.setAttribute("menu", json.toJSONString()); + session.setAttribute("menu",json ); List currentMenuList = new ArrayList<>(); diff --git a/len-web/pom.xml b/len-web/pom.xml index 629c577..1073117 100644 --- a/len-web/pom.xml +++ b/len-web/pom.xml @@ -9,7 +9,7 @@ 4.0.0 len-web - len-web Maven Webapp + len-web http://maven.apache.org jar diff --git a/len-web/src/main/java/com/len/config/ShiroConfig.java b/len-web/src/main/java/com/len/config/ShiroConfig.java index fb524df..f7247b2 100644 --- a/len-web/src/main/java/com/len/config/ShiroConfig.java +++ b/len-web/src/main/java/com/len/config/ShiroConfig.java @@ -23,15 +23,10 @@ import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.core.annotation.Order; import org.springframework.web.filter.DelegatingFilterProxy; import javax.servlet.Filter; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; +import java.util.*; /** * @author zhuxiaomeng @@ -39,6 +34,8 @@ import java.util.Map; * @email 154040976@qq.com * spring shiro * 元旦快乐:code everybody + *

+ * 2020/4/19 添加redis缓存,支持集群 默认redis缓存,如果单机配置可放开下面 ehcache */ @Configuration public class ShiroConfig { @@ -67,7 +64,7 @@ public class ShiroConfig { public BlogRealm blogLoginRealm() { return new BlogRealm(); } - + /*==========ehcache 缓存 begin============*/ /*@Bean public EhCacheManager getCacheManager() { EhCacheManager ehCacheManager = new EhCacheManager(); @@ -75,6 +72,18 @@ public class ShiroConfig { return ehCacheManager; }*/ + /* @Bean + public DefaultWebSessionManager defaultWebSessionManager() { + DefaultWebSessionManager defaultWebSessionManager = new DefaultWebSessionManager(); + defaultWebSessionManager.setSessionIdCookieEnabled(true); + defaultWebSessionManager.setGlobalSessionTimeout(21600000); + defaultWebSessionManager.setDeleteInvalidSessions(true); + defaultWebSessionManager.setSessionValidationSchedulerEnabled(true); + defaultWebSessionManager.setSessionIdUrlRewritingEnabled(false); + return defaultWebSessionManager; + }*/ + /*==========ehcache 缓存 end============*/ + @Bean public LifecycleBeanPostProcessor getLifecycleBeanPostProcessor() { return new LifecycleBeanPostProcessor(); @@ -169,16 +178,6 @@ public class ShiroConfig { return as; } - /* @Bean - public DefaultWebSessionManager defaultWebSessionManager() { - DefaultWebSessionManager defaultWebSessionManager = new DefaultWebSessionManager(); - defaultWebSessionManager.setSessionIdCookieEnabled(true); - defaultWebSessionManager.setGlobalSessionTimeout(21600000); - defaultWebSessionManager.setDeleteInvalidSessions(true); - defaultWebSessionManager.setSessionValidationSchedulerEnabled(true); - defaultWebSessionManager.setSessionIdUrlRewritingEnabled(false); - return defaultWebSessionManager; - }*/ @Bean public FilterRegistrationBean delegatingFilterProxy() { FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean(); @@ -193,13 +192,15 @@ public class ShiroConfig { public RedisCacheManager cacheManager() { RedisCacheManager redisCacheManager = new RedisCacheManager(); redisCacheManager.setRedisManager(redisManager()); + redisCacheManager.setPrincipalIdFieldName("id"); return redisCacheManager; } + private RedisManager redisManager() { RedisManager redisManager = new RedisManager(); // redisManager.setHost(redisConfig.getHost()); // redisManager.setPort(redisConfig.getPort()); - redisManager.setExpire(1800); +// redisManager.setExpire(1800); // redisManager.setTimeout(redisConfig.getTimeout()); return redisManager; } diff --git a/pom.xml b/pom.xml index daadcae..63cbb7f 100644 --- a/pom.xml +++ b/pom.xml @@ -1,452 +1,452 @@ - - - 4.0.0 - - com.len - lenosp - pom - 1.0-SNAPSHOT - - org.springframework.boot - spring-boot-starter-parent - 2.1.12.RELEASE - - - - UTF-8 - 1.8 - - - - len-core - len-sys - len-web - len-activiti - len-blog - len-admin - - - - - - - org.springframework.boot - spring-boot-configuration-processor - true - - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.boot - spring-boot-starter-test - - - junit - junit - 4.12 - - - - - - com.baomidou - mybatis-plus-boot-starter - 3.2.0 - - - - - - org.springframework.boot - spring-boot-starter-cache - - - org.springframework.boot - spring-boot-starter-jdbc - - - org.springframework.boot - spring-boot-starter-aop - - - - org.springframework.boot - spring-boot-starter-freemarker - - - org.springframework.boot - spring-boot-starter-logging - - - org.springframework.boot - spring-boot-starter-data-redis - - - org.springframework.boot - spring-boot-starter-actuator - - - - org.springframework.boot - spring-boot-starter-websocket - - - org.springframework.boot - spring-boot-starter-actuator - - - - - - mysql - mysql-connector-java - 5.1.6 - - - - - com.microsoft.sqlserver - sqljdbc4 - 4.0 - compile - - - - - - - - - - com.github.pagehelper - pagehelper-spring-boot-starter - 1.2.5 - - - org.mybatis - mybatis - - - org.mybatis - mybatis-spring - - - - - - - - org.mybatis - mybatis - 3.5.3 - - - - - - ehcache-core - net.sf.ehcache - 2.5.0 - - - org.apache.shiro - shiro-ehcache - 1.3.2 - - - - - org.apache.shiro - shiro-aspectj - 1.4.0 - - - - - - org.slf4j - slf4j-api - 1.7.25 - - - - - org.apache.shiro - shiro-core - 1.3.2 - - - - - org.projectlombok - lombok - 1.16.10 - provided - - - - org.apache.shiro - shiro-web - 1.3.2 - - - org.apache.shiro - shiro-spring - 1.3.2 - - - - net.mingsoft - shiro-freemarker-tags - 0.1 - - - - - org.apache.commons - commons-lang3 - 3.7 - - - - - commons-io - commons-io - 2.5 - - - commons-fileupload - commons-fileupload - 1.3.2 - - - - - com.alibaba - fastjson - 1.2.41 - - - - com.fasterxml.jackson.core - jackson-core - - - com.fasterxml.jackson.core - jackson-databind - - - com.fasterxml.jackson.datatype - jackson-datatype-joda - - - com.fasterxml.jackson.module - jackson-module-parameter-names - - - - - io.springfox - springfox-swagger2 - 2.7.0 - - - - - - io.springfox - springfox-swagger-ui - 2.7.0 - - - - org.springframework - spring-context-support - - - - - org.quartz-scheduler - quartz - 2.3.0 - - - cn.hutool - hutool-core - 4.0.12 - - - org.hibernate.validator - hibernate-validator - 6.0.10.Final - - - javax.validation - validation-api - 2.0.1.Final - - - - - com.auth0 - java-jwt - 3.4.0 - - - - - - - - org.apache.shiro - shiro-quartz - 1.3.2 - - - - org.opensymphony.quartz - quartz - - - - - - org.springframework.session - spring-session-data-redis - 2.1.2.RELEASE - - - - org.crazycake - shiro-redis - 2.4.2.1-RELEASE - - - - - - - - - - com.len - len-core - 1.0-SNAPSHOT - - - - com.len - len-web - 1.0-SNAPSHOT - - - com.len - len-sys - 1.0-SNAPSHOT - - - com.len - len-activiti - 1.0-SNAPSHOT - - - com.len - len-blog - 1.0-SNAPSHOT - - - com.len - len-admin - 1.0-SNAPSHOT - - - - - - lenosp - - - - org.apache.maven.plugins - maven-compiler-plugin - - ${java.version} - ${java.version} - - - - - org.mybatis.generator - mybatis-generator-maven-plugin - 1.3.6 - - len-web/src/main/resources/auto-config/mybatis-config.xml - true - true - - - - - org.apache.maven.plugins - maven-javadoc-plugin - 3.0.0 - - - - + + + 4.0.0 + + com.len + lenosp + pom + 1.0-SNAPSHOT + + org.springframework.boot + spring-boot-starter-parent + 2.1.12.RELEASE + + + + UTF-8 + 1.8 + + + + len-core + len-sys + len-web + len-activiti + len-blog + len-admin + + + + + + + org.springframework.boot + spring-boot-configuration-processor + true + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + + + junit + junit + 4.12 + + + + + + com.baomidou + mybatis-plus-boot-starter + 3.2.0 + + + + + + org.springframework.boot + spring-boot-starter-cache + + + org.springframework.boot + spring-boot-starter-jdbc + + + org.springframework.boot + spring-boot-starter-aop + + + + org.springframework.boot + spring-boot-starter-freemarker + + + org.springframework.boot + spring-boot-starter-logging + + + org.springframework.boot + spring-boot-starter-data-redis + + + org.springframework.boot + spring-boot-starter-actuator + + + + org.springframework.boot + spring-boot-starter-websocket + + + org.springframework.boot + spring-boot-starter-actuator + + + + + + mysql + mysql-connector-java + 5.1.6 + + + + + com.microsoft.sqlserver + sqljdbc4 + 4.0 + compile + + + + + + + + + + com.github.pagehelper + pagehelper-spring-boot-starter + 1.2.5 + + + org.mybatis + mybatis + + + org.mybatis + mybatis-spring + + + + + + + + org.mybatis + mybatis + 3.5.3 + + + + + + ehcache-core + net.sf.ehcache + 2.5.0 + + + org.apache.shiro + shiro-ehcache + 1.5.2 + + + + + org.apache.shiro + shiro-aspectj + 1.5.2 + + + + + + org.slf4j + slf4j-api + 1.7.25 + + + + + org.apache.shiro + shiro-core + 1.5.2 + + + + + org.projectlombok + lombok + 1.16.10 + provided + + + + org.apache.shiro + shiro-web + 1.3.2 + + + org.apache.shiro + shiro-spring + 1.5.2 + + + + net.mingsoft + shiro-freemarker-tags + 0.1 + + + + + org.apache.commons + commons-lang3 + 3.7 + + + + + commons-io + commons-io + 2.5 + + + commons-fileupload + commons-fileupload + 1.3.2 + + + + + com.alibaba + fastjson + 1.2.41 + + + + com.fasterxml.jackson.core + jackson-core + + + com.fasterxml.jackson.core + jackson-databind + + + com.fasterxml.jackson.datatype + jackson-datatype-joda + + + com.fasterxml.jackson.module + jackson-module-parameter-names + + + + + io.springfox + springfox-swagger2 + 2.7.0 + + + + + + io.springfox + springfox-swagger-ui + 2.7.0 + + + + org.springframework + spring-context-support + + + + + org.quartz-scheduler + quartz + 2.3.0 + + + cn.hutool + hutool-core + 4.0.12 + + + org.hibernate.validator + hibernate-validator + 6.0.10.Final + + + javax.validation + validation-api + 2.0.1.Final + + + + + com.auth0 + java-jwt + 3.4.0 + + + + + + + + org.apache.shiro + shiro-quartz + 1.3.2 + + + + org.opensymphony.quartz + quartz + + + + + + org.springframework.session + spring-session-data-redis + 2.1.9.RELEASE + + + + org.crazycake + shiro-redis + 3.2.3 + + + + + + + + + + com.len + len-core + 1.0-SNAPSHOT + + + + com.len + len-web + 1.0-SNAPSHOT + + + com.len + len-sys + 1.0-SNAPSHOT + + + com.len + len-activiti + 1.0-SNAPSHOT + + + com.len + len-blog + 1.0-SNAPSHOT + + + com.len + len-admin + 1.0-SNAPSHOT + + + + + + lenosp + + + + org.apache.maven.plugins + maven-compiler-plugin + + ${java.version} + ${java.version} + + + + + org.mybatis.generator + mybatis-generator-maven-plugin + 1.3.6 + + len-web/src/main/resources/auto-config/mybatis-config.xml + true + true + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.0.0 + + + + \ No newline at end of file