mirror of
https://github.com/1024-lab/smart-admin.git
synced 2026-06-02 03:55:59 +00:00
v3.20.0 【新增】优化登录使用spring cache;【新增】优化部门cache;【新增】代码生成枚举;【优化】三级等保Label显示宽度
This commit is contained in:
@@ -2,6 +2,7 @@ package net.lab1024.sa.base.common.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -15,7 +16,7 @@ import java.util.List;
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class UserPermission {
|
||||
public class UserPermission implements Serializable {
|
||||
|
||||
/**
|
||||
* 权限列表
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
package net.lab1024.sa.base.config;
|
||||
|
||||
import com.alibaba.fastjson.support.spring.GenericFastJsonRedisSerializer;
|
||||
import net.lab1024.sa.base.module.support.cache.CacheService;
|
||||
import net.lab1024.sa.base.module.support.cache.CaffeineCacheServiceImpl;
|
||||
import net.lab1024.sa.base.module.support.cache.RedisCacheServiceImpl;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.redis.cache.RedisCacheConfiguration;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.data.redis.serializer.RedisSerializationContext;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 缓存配置
|
||||
@@ -20,6 +26,18 @@ public class CacheConfig {
|
||||
private static final String CAFFEINE_CACHE = "caffeine";
|
||||
|
||||
|
||||
@Resource
|
||||
private RedisConnectionFactory factory;
|
||||
|
||||
@Bean
|
||||
@ConditionalOnProperty(prefix = "spring.cache", name = {"type"}, havingValue = REDIS_CACHE)
|
||||
public RedisCacheConfiguration redisCacheConfiguration() {
|
||||
return RedisCacheConfiguration.defaultCacheConfig()
|
||||
.disableCachingNullValues()
|
||||
.computePrefixWith(name -> "cache:" + name + ":")
|
||||
.serializeValuesWith(RedisSerializationContext.SerializationPair.fromSerializer(new GenericFastJsonRedisSerializer()));
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnProperty(prefix = "spring.cache", name = {"type"}, havingValue = REDIS_CACHE)
|
||||
public CacheService redisCacheService() {
|
||||
|
||||
@@ -48,7 +48,8 @@ public class ListVariableService extends CodeGenerateBaseVariableService {
|
||||
CodeField codeField = getCodeFieldByColumnName(queryField.getColumnNameList().get(0), form);
|
||||
|
||||
if (CodeQueryFieldQueryTypeEnum.ENUM.equalsValue(queryField.getQueryTypeEnum())) {
|
||||
objectMap.put("frontEnumName", codeField.getEnumName());
|
||||
String upperUnderscoreEnum = CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, codeField.getEnumName());
|
||||
objectMap.put("frontEnumName", upperUnderscoreEnum);
|
||||
frontImportSet.add("import SmartEnumSelect from '/@/components/framework/smart-enum-select/index.vue';");
|
||||
}
|
||||
|
||||
@@ -77,6 +78,12 @@ public class ListVariableService extends CodeGenerateBaseVariableService {
|
||||
continue;
|
||||
}
|
||||
|
||||
// 是否存在枚举
|
||||
if (SmartStringUtil.isNotBlank(codeField.getEnumName())) {
|
||||
String upperUnderscoreEnum = CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, codeField.getEnumName());
|
||||
objectMap.put("frontEnumPlugin", "$smartEnumPlugin.getDescByValue('" + upperUnderscoreEnum + "', text)");
|
||||
}
|
||||
|
||||
// 是否存在字典
|
||||
if (SmartStringUtil.isNotBlank(codeField.getDict())) {
|
||||
objectMap.put("dict", codeField.getDict());
|
||||
|
||||
@@ -33,7 +33,7 @@ import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* 发生邮件:<br/>
|
||||
* 发送邮件:<br/>
|
||||
* 1、支持直接发送 <br/>
|
||||
* 2、支持使用邮件模板发送
|
||||
*
|
||||
|
||||
@@ -18,7 +18,7 @@ public class ${name.upperCamel}Entity {
|
||||
#foreach ($field in $fields)
|
||||
|
||||
/**
|
||||
* $field.label
|
||||
* $field.columnComment
|
||||
*/
|
||||
#if($field.primaryKeyFlag && $field.autoIncreaseFlag)
|
||||
@TableId(type = IdType.AUTO)
|
||||
|
||||
@@ -89,6 +89,7 @@
|
||||
<!---------- 表格 begin ----------->
|
||||
<a-table
|
||||
size="small"
|
||||
:scroll="{ y: 800 }"
|
||||
:dataSource="tableData"
|
||||
:columns="columns"
|
||||
rowKey="$!{primaryKeyFieldName}"
|
||||
@@ -108,6 +109,13 @@
|
||||
</template>
|
||||
#end
|
||||
#end
|
||||
#foreach ($field in $listFields)
|
||||
#if($field.frontEnumPlugin)
|
||||
<template v-if="column.dataIndex === '$!{field.fieldName}'">
|
||||
<span>{{ $!{field.frontEnumPlugin} }}</span>
|
||||
</template>
|
||||
#end
|
||||
#end
|
||||
#foreach ($field in $listFields)
|
||||
#if($field.dict)
|
||||
<template v-if="column.dataIndex === '$!{field.fieldName}'">
|
||||
|
||||
@@ -66,7 +66,7 @@ spring:
|
||||
|
||||
# 缓存实现类型
|
||||
cache:
|
||||
type: caffeine
|
||||
type: redis
|
||||
|
||||
# tomcat 配置,主要用于 配置 访问日志(便于将来排查错误)
|
||||
server:
|
||||
@@ -88,8 +88,8 @@ file:
|
||||
region: oss-cn-hangzhou
|
||||
endpoint: oss-cn-hangzhou.aliyuncs.com
|
||||
bucket-name: 1024lab-smart-admin
|
||||
access-key:
|
||||
secret-key:
|
||||
access-key:
|
||||
secret-key:
|
||||
url-prefix: https://${file.storage.cloud.bucket-name}.${file.storage.cloud.endpoint}/
|
||||
private-url-expire-seconds: 3600
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ spring:
|
||||
|
||||
# 缓存实现类型
|
||||
cache:
|
||||
type: caffeine
|
||||
type: redis
|
||||
|
||||
# tomcat 配置,主要用于 配置 访问日志(便于将来排查错误)
|
||||
server:
|
||||
|
||||
@@ -65,7 +65,7 @@ spring:
|
||||
|
||||
# 缓存实现类型
|
||||
cache:
|
||||
type: caffeine
|
||||
type: redis
|
||||
|
||||
# tomcat 配置,主要用于 配置 访问日志(便于将来排查错误)
|
||||
server:
|
||||
|
||||
@@ -66,7 +66,7 @@ spring:
|
||||
|
||||
# 缓存实现类型
|
||||
cache:
|
||||
type: caffeine
|
||||
type: redis
|
||||
|
||||
# tomcat 配置,主要用于 配置 访问日志(便于将来排查错误)
|
||||
server:
|
||||
|
||||
Reference in New Issue
Block a user