From 17865c9454af61096e39278adbbd6b453b65b786 Mon Sep 17 00:00:00 2001 From: haoxr <1490493387@qq.com> Date: Sun, 3 Jan 2021 11:02:31 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E7=A7=BB=E9=99=A4jackson=E5=BA=8F=E5=88=97?= =?UTF-8?q?=E5=8C=96=E5=AF=BC=E8=87=B4=E7=A8=8B=E5=BA=8F=E6=8A=A5=E9=94=99?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 13 ++--- pom.xml | 26 ---------- youlai-common/common-redis/pom.xml | 16 ------ .../com/youlai/common/redis/RedisConfig.java | 49 ++----------------- .../com/youlai/common/web/vo/CascaderVO.java | 8 --- 5 files changed, 12 insertions(+), 100 deletions(-) diff --git a/README.md b/README.md index d34b26a7f..bef217650 100644 --- a/README.md +++ b/README.md @@ -9,9 +9,7 @@ youlai-mall是集成当前最新主流技术一套开源的商城系统。整个 **线上地址:** [www.youlai.store](http://www.youlai.store) -### 后台 - -体验码,加我微信(微信号:haoxianrui)备注“体验”获取体验资格 +### 管理后台 ![](https://i.loli.net/2021/01/02/7t9TlgCHSnam64E.png) @@ -20,9 +18,7 @@ youlai-mall是集成当前最新主流技术一套开源的商城系统。整个 ![](https://i.loli.net/2020/12/27/iLw3jEgVGQSf61F.png) -### 小程序 - -![](https://i.loli.net/2021/01/02/ZesKNr17FBUlWGE.jpg) +### 微信小程序 ![](https://i.loli.net/2021/01/02/OugrUpPVl9d5w14.png) @@ -30,6 +26,11 @@ youlai-mall是集成当前最新主流技术一套开源的商城系统。整个 ![](https://i.loli.net/2021/01/02/QDU9okJbvuVrxwc.png) + +**体验码,加我微信(微信号:haoxianrui)备注“体验”获取体验** + +![](https://i.loli.net/2021/01/02/ZesKNr17FBUlWGE.jpg) + ## **项目结构** ``` lua diff --git a/pom.xml b/pom.xml index 31d3badb4..a9af530d4 100644 --- a/pom.xml +++ b/pom.xml @@ -103,32 +103,6 @@ weixin-java-miniapp ${weixin-java-miniapp.version} - - - org.hibernate - hibernate-validator - ${hibernate-validator.version} - - - - - com.fasterxml.jackson.core - jackson-databind - ${jackson.version} - - - - com.fasterxml.jackson.core - jackson-core - ${jackson.version} - - - - com.fasterxml.jackson.core - jackson-annotations - ${jackson.version} - - diff --git a/youlai-common/common-redis/pom.xml b/youlai-common/common-redis/pom.xml index 3fb96320d..6323532d4 100644 --- a/youlai-common/common-redis/pom.xml +++ b/youlai-common/common-redis/pom.xml @@ -16,21 +16,5 @@ org.springframework.boot spring-boot-starter-data-redis - - - - com.fasterxml.jackson.core - jackson-databind - - - - com.fasterxml.jackson.core - jackson-core - - - - com.fasterxml.jackson.core - jackson-annotations - diff --git a/youlai-common/common-redis/src/main/java/com/youlai/common/redis/RedisConfig.java b/youlai-common/common-redis/src/main/java/com/youlai/common/redis/RedisConfig.java index 4d16f42f7..af6e9b631 100644 --- a/youlai-common/common-redis/src/main/java/com/youlai/common/redis/RedisConfig.java +++ b/youlai-common/common-redis/src/main/java/com/youlai/common/redis/RedisConfig.java @@ -1,63 +1,24 @@ package com.youlai.common.redis; -import com.fasterxml.jackson.annotation.JsonAutoDetect; -import com.fasterxml.jackson.annotation.PropertyAccessor; -import com.fasterxml.jackson.databind.ObjectMapper; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.data.redis.connection.RedisConnectionFactory; import org.springframework.data.redis.core.RedisTemplate; -import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer; +import org.springframework.data.redis.serializer.JdkSerializationRedisSerializer; import org.springframework.data.redis.serializer.StringRedisSerializer; @Configuration public class RedisConfig { @Bean public RedisTemplate redisTemplate(RedisConnectionFactory factory) { -// RedisTemplate redisTemplate = new RedisTemplate<>(); -// redisTemplate.setKeySerializer(new StringRedisSerializer()); -// redisTemplate.setValueSerializer(new JdkSerializationRedisSerializer()); -// redisTemplate.setHashKeySerializer(new StringRedisSerializer()); -// redisTemplate.setHashValueSerializer(new JdkSerializationRedisSerializer()); -// redisTemplate.setConnectionFactory(factory); -// redisTemplate.afterPropertiesSet(); -// return redisTemplate; - RedisTemplate redisTemplate = new RedisTemplate<>(); + redisTemplate.setKeySerializer(new StringRedisSerializer()); + redisTemplate.setValueSerializer(new JdkSerializationRedisSerializer()); + redisTemplate.setHashKeySerializer(new StringRedisSerializer()); + redisTemplate.setHashValueSerializer(new JdkSerializationRedisSerializer()); redisTemplate.setConnectionFactory(factory); - // 用Jackson2JsonRedisSerializer来序列化和反序列化redis的value值 - redisTemplate.setValueSerializer(serializer()); - - StringRedisSerializer stringRedisSerializer = new StringRedisSerializer(); - // 使用StringRedisSerializer来序列化和反序列化redis的key值 - redisTemplate.setKeySerializer(stringRedisSerializer); - - // hash的key也采用String的序列化方式 - redisTemplate.setHashKeySerializer(stringRedisSerializer); - // hash的value序列化方式采用jackson - redisTemplate.setHashValueSerializer(serializer()); redisTemplate.afterPropertiesSet(); return redisTemplate; } - - /** - * 配置Jackson2JsonRedisSerializer序列化策略 - * */ - private Jackson2JsonRedisSerializer serializer() { - // 使用Jackson2JsonRedisSerializer来序列化和反序列化redis的value值 - Jackson2JsonRedisSerializer jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer<>(Object.class); - ObjectMapper objectMapper = new ObjectMapper(); - - // 指定要序列化的域,field,get和set,以及修饰符范围,ANY是都有包括private和public - objectMapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY); - - objectMapper.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL); - - // 指定序列化输入的类型,类必须是非final修饰的,final修饰的类,比如String,Integer等会跑出异常 -// objectMapper.activateDefaultTyping(LaissezFaireSubTypeValidator.instance, ObjectMapper.DefaultTyping.NON_FINAL); - - jackson2JsonRedisSerializer.setObjectMapper(objectMapper); - return jackson2JsonRedisSerializer; - } } diff --git a/youlai-common/common-web/src/main/java/com/youlai/common/web/vo/CascaderVO.java b/youlai-common/common-web/src/main/java/com/youlai/common/web/vo/CascaderVO.java index 94c985e5d..0e68fa406 100644 --- a/youlai-common/common-web/src/main/java/com/youlai/common/web/vo/CascaderVO.java +++ b/youlai-common/common-web/src/main/java/com/youlai/common/web/vo/CascaderVO.java @@ -1,26 +1,18 @@ package com.youlai.common.web.vo; import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.experimental.Accessors; - -import java.io.Serializable; import java.util.List; @Data @Accessors(chain = true) -@ApiModel public class CascaderVO { - @ApiModelProperty(name="节点value") private String value; - @ApiModelProperty(name="节点label") private String label; - @ApiModelProperty(name="子节点") @JsonInclude(JsonInclude.Include.NON_EMPTY) private List children; }