From a1a70f82e2ea38cbe024c8157f2460f04c9602c1 Mon Sep 17 00:00:00 2001 From: Aborn Jiang Date: Thu, 21 Apr 2022 22:05:28 +0800 Subject: [PATCH 1/2] fix weird prefixes keys when use RedisUtils.scan --- .../src/main/java/me/zhengjie/utils/RedisUtils.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/eladmin-common/src/main/java/me/zhengjie/utils/RedisUtils.java b/eladmin-common/src/main/java/me/zhengjie/utils/RedisUtils.java index eeeae0f5e..b49b3ca54 100644 --- a/eladmin-common/src/main/java/me/zhengjie/utils/RedisUtils.java +++ b/eladmin-common/src/main/java/me/zhengjie/utils/RedisUtils.java @@ -23,6 +23,7 @@ import org.springframework.data.redis.connection.RedisConnection; import org.springframework.data.redis.connection.RedisConnectionFactory; import org.springframework.data.redis.core.*; +import org.springframework.data.redis.serializer.StringRedisSerializer; import org.springframework.stereotype.Component; import java.util.*; @@ -41,6 +42,9 @@ public class RedisUtils { public RedisUtils(RedisTemplate redisTemplate) { this.redisTemplate = redisTemplate; + this.redisTemplate.setHashKeySerializer(new StringRedisSerializer()); + this.redisTemplate.setKeySerializer(new StringRedisSerializer()); + this.redisTemplate.setStringSerializer(new StringRedisSerializer()); } /** From 8e406a195863cf626da8a8f84308b66ded3f9207 Mon Sep 17 00:00:00 2001 From: Aborn Jiang Date: Tue, 31 May 2022 05:58:22 +0800 Subject: [PATCH 2/2] Column use `` for reserved key ref: https://stackoverflow.com/questions/2224503/how-to-map-an-entity-field-whose-name-is-a-reserved-word-in-jpa --- .../src/main/resources/template/generator/admin/Entity.ftl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eladmin-system/src/main/resources/template/generator/admin/Entity.ftl b/eladmin-system/src/main/resources/template/generator/admin/Entity.ftl index 9d8b1e719..c5cf9c264 100644 --- a/eladmin-system/src/main/resources/template/generator/admin/Entity.ftl +++ b/eladmin-system/src/main/resources/template/generator/admin/Entity.ftl @@ -55,7 +55,7 @@ public class ${className} implements Serializable { @GeneratedValue(strategy = GenerationType.IDENTITY) - @Column(name = "${column.columnName}"<#if column.columnKey = 'UNI'>,unique = true<#if column.istNotNull && column.columnKey != 'PRI'>,nullable = false) + @Column(name = "`${column.columnName}`"<#if column.columnKey = 'UNI'>,unique = true<#if column.istNotNull && column.columnKey != 'PRI'>,nullable = false) <#if column.istNotNull && column.columnKey != 'PRI'> <#if column.columnType = 'String'> @NotBlank @@ -82,4 +82,4 @@ public class ${className} implements Serializable { public void copy(${className} source){ BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); } -} \ No newline at end of file +}