mirror of
https://gitee.com/lab1024/smart-admin.git
synced 2025-11-08 11:43:47 +08:00
v3.8.0【优化】简介明了的数据范围说明文档;【优化】Long序列化;【优化】标签页右键关闭;【优化】表格排序Demo
This commit is contained in:
@@ -14,15 +14,24 @@ import java.io.IOException;
|
||||
* @Date 2020-06-02 22:55:07
|
||||
* @Wechat zhuoda1024
|
||||
* @Email lab1024@163.com
|
||||
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
||||
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
||||
*/
|
||||
public class LongJsonSerializer extends JsonSerializer<Long> {
|
||||
|
||||
public static final LongJsonSerializer INSTANCE = new LongJsonSerializer();
|
||||
|
||||
@Override
|
||||
public void serialize(Long value, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException, JsonProcessingException {
|
||||
String text = (value == null ? null : String.valueOf(value));
|
||||
if (text != null) {
|
||||
jsonGenerator.writeString(text);
|
||||
public void serialize(Long value, JsonGenerator gen, SerializerProvider serializerProvider) throws IOException, JsonProcessingException {
|
||||
if (null == value) {
|
||||
gen.writeNull();
|
||||
return;
|
||||
}
|
||||
// js中最大安全整数16位 Number.MAX_SAFE_INTEGER
|
||||
String longStr = String.valueOf(value);
|
||||
if (longStr.length() > 16) {
|
||||
gen.writeString(longStr);
|
||||
} else {
|
||||
gen.writeNumber(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
|
||||
import net.lab1024.sa.base.common.json.serializer.LongJsonSerializer;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@@ -17,16 +18,16 @@ import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeParseException;
|
||||
|
||||
/**
|
||||
* java8 localDate 时间类格式化配置
|
||||
* Json 序列化配置
|
||||
*
|
||||
* @Author 1024创新实验室-主任: 卓大
|
||||
* @Date 2017-11-28 15:21:10
|
||||
* @Wechat zhuoda1024
|
||||
* @Email lab1024@163.com
|
||||
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
||||
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
||||
*/
|
||||
@Configuration
|
||||
public class DateConfig {
|
||||
public class JsonConfig {
|
||||
|
||||
@Bean
|
||||
public Jackson2ObjectMapperBuilderCustomizer customizer() {
|
||||
@@ -35,6 +36,7 @@ public class DateConfig {
|
||||
builder.deserializers(new LocalDateTimeDeserializer(DatePattern.NORM_DATETIME_FORMAT.getDateTimeFormatter()));
|
||||
builder.serializers(new LocalDateSerializer(DatePattern.NORM_DATE_FORMAT.getDateTimeFormatter()));
|
||||
builder.serializers(new LocalDateTimeSerializer(DatePattern.NORM_DATETIME_FORMAT.getDateTimeFormatter()));
|
||||
builder.serializerByType(Long.class, LongJsonSerializer.INSTANCE);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -31,10 +31,9 @@ import java.util.Optional;
|
||||
/**
|
||||
* springdoc-openapi 配置
|
||||
* nginx配置前缀时如果需要访问【/swagger-ui/index.html】需添加额外nginx配置
|
||||
* location /v3/api-docs/ {
|
||||
* proxy_pass http://127.0.0.1:11024/v3/api-docs/;
|
||||
* location /v3/api-docs/ {
|
||||
* proxy_pass http://127.0.0.1:1024/v3/api-docs/;
|
||||
* }
|
||||
*
|
||||
* @Author 1024创新实验室-主任: 卓大
|
||||
* @Date 2020-03-25 22:54:46
|
||||
* @Wechat zhuoda1024
|
||||
@@ -48,7 +47,7 @@ public class SwaggerConfig {
|
||||
/**
|
||||
* 用于解决/swagger-ui/index.html页面ServersUrl 测试环境部署错误问题
|
||||
*/
|
||||
@Value("${springdoc.swagger-ui.server-base-url:''}")
|
||||
@Value("${springdoc.swagger-ui.server-base-url}")
|
||||
private String serverBaseUrl;
|
||||
|
||||
public static final String[] SWAGGER_WHITELIST = {
|
||||
@@ -59,20 +58,20 @@ public class SwaggerConfig {
|
||||
"/v3/api-docs",
|
||||
"/v3/api-docs/**",
|
||||
"/doc.html",
|
||||
};
|
||||
};
|
||||
|
||||
@Bean
|
||||
public OpenAPI api() {
|
||||
return new OpenAPI()
|
||||
.components(components())
|
||||
.info(new Info()
|
||||
.title("SmartAdmin 3.X 接口文档")
|
||||
.contact(new Contact().name("1024创新实验室").email("lab1024@163.com").url("https://1024lab.net"))
|
||||
.version("v3.X")
|
||||
.description("<font color=\"#DC143C\">**以「高质量代码」为核心,「简洁、高效、安全」**</font>基于 SpringBoot + Sa-Token + Mybatis-Plus 和 Vue3 + Vite5 + Ant Design (同时支持JavaScript和TypeScript双版本) 的快速开发平台。" +
|
||||
"<br/><font color=\"#DC143C\">**国内首个满足《网络安全》、《数据安全》、三级等保**</font>, 支持登录限制、支持国产接口加解密等安全、支持数据加解密等一系列安全体系的开源项目。" +
|
||||
"<br/><font color=\"#DC143C\">**我们开源一套漂亮的代码和一套整洁的代码规范**</font>,让大家在这浮躁的代码世界里感受到一股把代码写好的清流!同时又让开发者节省大量的时间,减少加班,快乐工作,保持谦逊,保持学习,热爱代码,更热爱生活!")
|
||||
)
|
||||
.title("SmartAdmin 3.X 接口文档")
|
||||
.contact(new Contact().name("1024创新实验室").email("lab1024@163.com").url("https://1024lab.net"))
|
||||
.version("v3.X")
|
||||
.description("<font color=\"#DC143C\">**以「高质量代码」为核心,「简洁、高效、安全」**</font>基于 SpringBoot + Sa-Token + Mybatis-Plus 和 Vue3 + Vite5 + Ant Design (同时支持JavaScript和TypeScript双版本) 的快速开发平台。" +
|
||||
"<br/><font color=\"#DC143C\">**国内首个满足《网络安全》、《数据安全》、三级等保**</font>, 支持登录限制、支持国产接口加解密等安全、支持数据加解密等一系列安全体系的开源项目。" +
|
||||
"<br/><font color=\"#DC143C\">**我们开源一套漂亮的代码和一套整洁的代码规范**</font>,让大家在这浮躁的代码世界里感受到一股把代码写好的清流!同时又让开发者节省大量的时间,减少加班,快乐工作,保持谦逊,保持学习,热爱代码,更热爱生活!")
|
||||
)
|
||||
.addSecurityItem(new SecurityRequirement().addList(RequestHeaderConst.TOKEN));
|
||||
}
|
||||
|
||||
@@ -84,27 +83,26 @@ public class SwaggerConfig {
|
||||
@Bean
|
||||
public GroupedOpenApi businessApi() {
|
||||
return GroupedOpenApi.builder()
|
||||
.group("业务接口")
|
||||
.pathsToMatch("/**")
|
||||
.pathsToExclude(SwaggerTagConst.Support.URL_PREFIX + "/**")
|
||||
.addOperationCustomizer(new SmartOperationCustomizer())
|
||||
.build();
|
||||
.group("业务接口")
|
||||
.pathsToMatch("/**")
|
||||
.pathsToExclude(SwaggerTagConst.Support.URL_PREFIX + "/**")
|
||||
.addOperationCustomizer(new SmartOperationCustomizer())
|
||||
.build();
|
||||
|
||||
}
|
||||
|
||||
@Bean
|
||||
public GroupedOpenApi supportApi() {
|
||||
return GroupedOpenApi.builder()
|
||||
.group("支撑接口(Support)")
|
||||
.pathsToMatch(SwaggerTagConst.Support.URL_PREFIX + "/**")
|
||||
.addOperationCustomizer(new SmartOperationCustomizer())
|
||||
.build();
|
||||
.group("支撑接口(Support)")
|
||||
.pathsToMatch(SwaggerTagConst.Support.URL_PREFIX + "/**")
|
||||
.addOperationCustomizer(new SmartOperationCustomizer())
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 以下代码可以用于设置 /swagger-ui/index.html 的serverBaseUrl
|
||||
* 如果使用knife4j则不需要
|
||||
*
|
||||
* @param openAPI
|
||||
* @param securityParser
|
||||
* @param springDocConfigProperties
|
||||
@@ -132,6 +130,6 @@ public class SwaggerConfig {
|
||||
}
|
||||
});
|
||||
return new OpenAPIService(openAPI, securityParser, springDocConfigProperties,
|
||||
propertyResolverUtils, openApiBuilderCustomizers, Optional.of(list), javadocProvider);
|
||||
propertyResolverUtils, openApiBuilderCustomizers, Optional.of(list), javadocProvider);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ import java.util.Set;
|
||||
* @Date 2022-05-30 21:22:12
|
||||
* @Wechat zhuoda1024
|
||||
* @Email lab1024@163.com
|
||||
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
||||
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
||||
*/
|
||||
@Configuration
|
||||
@Slf4j
|
||||
|
||||
@@ -67,14 +67,14 @@ public class WebServerListener implements ApplicationListener<WebServerInitializ
|
||||
String swaggerUrl = URLUtil.normalize(String.format("http://localhost:%d%s/swagger-ui/index.html", port, contextPath), false, true);
|
||||
String knife4jUrl = URLUtil.normalize(String.format("http://localhost:%d%s/doc.html", port, contextPath), false, true);
|
||||
log.warn("\n{}\n" +
|
||||
"\t当前启动环境:\t{} , {}" +
|
||||
"\n\t返回码初始化:\t完成{}个返回码初始化" +
|
||||
"\n\t服务本机地址:\t{}" +
|
||||
"\n\t服务外网地址:\t{}" +
|
||||
"\n\tSwagger地址:\t{}" +
|
||||
"\n\tknife4j地址:\t{}" +
|
||||
"\n-------------------------------------------------------------------------------------\n",
|
||||
title, profile, environmentEnum.getDesc(), codeCount, localhostUrl, externalUrl, swaggerUrl, knife4jUrl);
|
||||
"\t当前启动环境:\t{} , {}" +
|
||||
"\n\t返回码初始化:\t完成{}个返回码初始化" +
|
||||
"\n\t服务本机地址:\t{}" +
|
||||
"\n\t服务外网地址:\t{}" +
|
||||
"\n\tSwagger地址:\t{}" +
|
||||
"\n\tknife4j地址:\t{}" +
|
||||
"\n-------------------------------------------------------------------------------------\n",
|
||||
title, profile, environmentEnum.getDesc(), codeCount, localhostUrl, externalUrl, swaggerUrl, knife4jUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package net.lab1024.sa.base.module.support.apiencrypt.advice;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.lab1024.sa.base.common.domain.ResponseDTO;
|
||||
@@ -33,6 +35,9 @@ public class EncryptResponseAdvice implements ResponseBodyAdvice<ResponseDTO> {
|
||||
@Resource
|
||||
private ApiEncryptService apiEncryptService;
|
||||
|
||||
@Resource
|
||||
private ObjectMapper objectMapper;
|
||||
|
||||
@Override
|
||||
public boolean supports(MethodParameter returnType, Class<? extends HttpMessageConverter<?>> converterType) {
|
||||
return returnType.hasMethodAnnotation(ApiEncrypt.class) || returnType.getContainingClass().isAnnotationPresent(ApiEncrypt.class);
|
||||
@@ -44,7 +49,12 @@ public class EncryptResponseAdvice implements ResponseBodyAdvice<ResponseDTO> {
|
||||
return body;
|
||||
}
|
||||
|
||||
String encrypt = apiEncryptService.encrypt(JSON.toJSONString(body.getData()));
|
||||
String encrypt = null;
|
||||
try {
|
||||
encrypt = apiEncryptService.encrypt(objectMapper.writeValueAsString(body.getData()));
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
body.setData(encrypt);
|
||||
body.setDataType(DataTypeEnum.ENCRYPT.getValue());
|
||||
return body;
|
||||
|
||||
@@ -52,14 +52,6 @@ public class ApiEncryptServiceSmImpl implements ApiEncryptService {
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String content = "zkm1024";
|
||||
String en = new ApiEncryptServiceSmImpl().encrypt(content);
|
||||
System.out.println(en);
|
||||
String ori = new ApiEncryptServiceSmImpl().decrypt(en);
|
||||
System.out.println(ori);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String decrypt(String data) {
|
||||
|
||||
@@ -45,7 +45,7 @@ import java.util.stream.Collectors;
|
||||
* @Date 2022-06-30 22:15:38
|
||||
* @Wechat zhuoda1024
|
||||
* @Email lab1024@163.com
|
||||
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
||||
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
||||
*/
|
||||
|
||||
@Service
|
||||
|
||||
@@ -18,7 +18,7 @@ import java.util.stream.Collectors;
|
||||
* @Date 2022/9/29 17:20:41
|
||||
* @Wechat zhuoda1024
|
||||
* @Email lab1024@163.com
|
||||
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
||||
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
||||
*/
|
||||
public abstract class CodeGenerateBaseVariableService {
|
||||
|
||||
|
||||
@@ -101,7 +101,6 @@ public class AddFormVariableService extends CodeGenerateBaseVariableService {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//字典
|
||||
if (SmartStringUtil.isNotEmpty(codeField.getDict())) {
|
||||
finalFieldMap.put("dict", "\n @JsonDeserialize(using = DictValueVoDeserializer.class)");
|
||||
|
||||
@@ -15,7 +15,7 @@ import java.util.*;
|
||||
* @Date 2022/9/29 17:20:41
|
||||
* @Wechat zhuoda1024
|
||||
* @Email lab1024@163.com
|
||||
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
||||
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
||||
*/
|
||||
|
||||
public class MapperVariableService extends CodeGenerateBaseVariableService {
|
||||
|
||||
@@ -18,7 +18,7 @@ import java.util.stream.Collectors;
|
||||
* @Date 2022/9/29 17:20:41
|
||||
* @Wechat zhuoda1024
|
||||
* @Email lab1024@163.com
|
||||
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
||||
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
||||
*/
|
||||
|
||||
public class QueryFormVariableService extends CodeGenerateBaseVariableService {
|
||||
|
||||
@@ -17,7 +17,7 @@ import java.util.stream.Collectors;
|
||||
* @Date 2022/9/29 17:20:41
|
||||
* @Wechat zhuoda1024
|
||||
* @Email lab1024@163.com
|
||||
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
||||
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
||||
*/
|
||||
|
||||
public class VOVariableService extends CodeGenerateBaseVariableService {
|
||||
|
||||
@@ -39,7 +39,7 @@ import java.util.stream.Collectors;
|
||||
* @Date 2019年10月11日 15:34:47
|
||||
* @Wechat zhuoda1024
|
||||
* @Email lab1024@163.com
|
||||
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
||||
* @Copyright <a href="https://1024lab.net">1024创新实验室</a>
|
||||
*/
|
||||
@Service
|
||||
public class FileService {
|
||||
|
||||
@@ -4,13 +4,13 @@ spring:
|
||||
url: jdbc:p6spy:mysql://127.0.0.1:3306/smart_admin_v3?autoReconnect=true&useServerPreparedStmts=false&rewriteBatchedStatements=true&characterEncoding=UTF-8&useSSL=false&allowMultiQueries=true&serverTimezone=Asia/Shanghai
|
||||
username: root
|
||||
password: SmartAdmin666
|
||||
driver-class-name: com.p6spy.engine.spy.P6SpyDriver
|
||||
initial-size: 2
|
||||
min-idle: 2
|
||||
max-active: 10
|
||||
max-wait: 60000
|
||||
time-between-eviction-runs-millis: 60000
|
||||
min-evictable-idle-time-millis: 300000
|
||||
driver-class-name: com.p6spy.engine.spy.P6SpyDriver
|
||||
filters: stat
|
||||
druid:
|
||||
username: druid
|
||||
@@ -40,7 +40,7 @@ spring:
|
||||
host: smtp.163.com
|
||||
port: 465
|
||||
username: lab1024@163.com
|
||||
password: 1
|
||||
password: 1024lab
|
||||
properties:
|
||||
mail:
|
||||
smtp:
|
||||
|
||||
@@ -40,7 +40,7 @@ spring:
|
||||
host: smtp.163.com
|
||||
port: 465
|
||||
username: lab1024@163.com
|
||||
password: 1
|
||||
password: 1024lab
|
||||
properties:
|
||||
mail:
|
||||
smtp:
|
||||
|
||||
@@ -30,10 +30,11 @@ spring:
|
||||
timeout: 10000ms
|
||||
lettuce:
|
||||
pool:
|
||||
max-active: 100
|
||||
min-idle: 10
|
||||
max-idle: 50
|
||||
max-active: 5
|
||||
min-idle: 1
|
||||
max-idle: 3
|
||||
max-wait: 30000ms
|
||||
|
||||
# 邮件,置以SSL的方式发送, 这个需要使用这种方式并且端口是465
|
||||
mail:
|
||||
host: smtp.163.com
|
||||
|
||||
@@ -40,7 +40,7 @@ spring:
|
||||
host: smtp.163.com
|
||||
port: 465
|
||||
username: lab1024@163.com
|
||||
password: 1
|
||||
password: 1024lab
|
||||
properties:
|
||||
mail:
|
||||
smtp:
|
||||
|
||||
Reference in New Issue
Block a user