mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2025-01-19 19:50:06 +08:00
解决 db doc 导出的报错问题
This commit is contained in:
parent
8e21b5200a
commit
183bb5855a
@ -20,19 +20,10 @@ import com.ruoyi.framework.interceptor.RepeatSubmitInterceptor;
|
|||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
public class ResourcesConfig implements WebMvcConfigurer {
|
public class ResourcesConfig implements WebMvcConfigurer {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private RepeatSubmitInterceptor repeatSubmitInterceptor;
|
private RepeatSubmitInterceptor repeatSubmitInterceptor;
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
|
||||||
/** 本地文件上传路径 */
|
|
||||||
registry.addResourceHandler(Constants.RESOURCE_PREFIX + "/**").addResourceLocations("file:" + RuoYiConfig.getProfile() + "/");
|
|
||||||
|
|
||||||
/** swagger配置 */
|
|
||||||
registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/");
|
|
||||||
registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 自定义拦截规则
|
* 自定义拦截规则
|
||||||
*/
|
*/
|
||||||
|
@ -1,75 +0,0 @@
|
|||||||
package com.ruoyi.framework.config.properties;
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import com.alibaba.druid.pool.DruidDataSource;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* druid 配置属性
|
|
||||||
*
|
|
||||||
* @author ruoyi
|
|
||||||
*/
|
|
||||||
@Configuration
|
|
||||||
public class DruidProperties {
|
|
||||||
@Value("${spring.datasource.druid.initialSize}")
|
|
||||||
private int initialSize;
|
|
||||||
|
|
||||||
@Value("${spring.datasource.druid.minIdle}")
|
|
||||||
private int minIdle;
|
|
||||||
|
|
||||||
@Value("${spring.datasource.druid.maxActive}")
|
|
||||||
private int maxActive;
|
|
||||||
|
|
||||||
@Value("${spring.datasource.druid.maxWait}")
|
|
||||||
private int maxWait;
|
|
||||||
|
|
||||||
@Value("${spring.datasource.druid.timeBetweenEvictionRunsMillis}")
|
|
||||||
private int timeBetweenEvictionRunsMillis;
|
|
||||||
|
|
||||||
@Value("${spring.datasource.druid.minEvictableIdleTimeMillis}")
|
|
||||||
private int minEvictableIdleTimeMillis;
|
|
||||||
|
|
||||||
@Value("${spring.datasource.druid.maxEvictableIdleTimeMillis}")
|
|
||||||
private int maxEvictableIdleTimeMillis;
|
|
||||||
|
|
||||||
@Value("${spring.datasource.druid.validationQuery}")
|
|
||||||
private String validationQuery;
|
|
||||||
|
|
||||||
@Value("${spring.datasource.druid.testWhileIdle}")
|
|
||||||
private boolean testWhileIdle;
|
|
||||||
|
|
||||||
@Value("${spring.datasource.druid.testOnBorrow}")
|
|
||||||
private boolean testOnBorrow;
|
|
||||||
|
|
||||||
@Value("${spring.datasource.druid.testOnReturn}")
|
|
||||||
private boolean testOnReturn;
|
|
||||||
|
|
||||||
public DruidDataSource dataSource(DruidDataSource datasource) {
|
|
||||||
/** 配置初始化大小、最小、最大 */
|
|
||||||
datasource.setInitialSize(initialSize);
|
|
||||||
datasource.setMaxActive(maxActive);
|
|
||||||
datasource.setMinIdle(minIdle);
|
|
||||||
|
|
||||||
/** 配置获取连接等待超时的时间 */
|
|
||||||
datasource.setMaxWait(maxWait);
|
|
||||||
|
|
||||||
/** 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 */
|
|
||||||
datasource.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis);
|
|
||||||
|
|
||||||
/** 配置一个连接在池中最小、最大生存的时间,单位是毫秒 */
|
|
||||||
datasource.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis);
|
|
||||||
datasource.setMaxEvictableIdleTimeMillis(maxEvictableIdleTimeMillis);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 用来检测连接是否有效的sql,要求是一个查询语句,常用select 'x'。如果validationQuery为null,testOnBorrow、testOnReturn、testWhileIdle都不会起作用。
|
|
||||||
*/
|
|
||||||
datasource.setValidationQuery(validationQuery);
|
|
||||||
/** 建议配置为true,不影响性能,并且保证安全性。申请连接的时候检测,如果空闲时间大于timeBetweenEvictionRunsMillis,执行validationQuery检测连接是否有效。 */
|
|
||||||
datasource.setTestWhileIdle(testWhileIdle);
|
|
||||||
/** 申请连接时执行validationQuery检测连接是否有效,做了这个配置会降低性能。 */
|
|
||||||
datasource.setTestOnBorrow(testOnBorrow);
|
|
||||||
/** 归还连接时执行validationQuery检测连接是否有效,做了这个配置会降低性能。 */
|
|
||||||
datasource.setTestOnReturn(testOnReturn);
|
|
||||||
return datasource;
|
|
||||||
}
|
|
||||||
}
|
|
@ -44,11 +44,12 @@ public class InfDbDocController {
|
|||||||
|
|
||||||
@GetMapping("/export-html")
|
@GetMapping("/export-html")
|
||||||
public synchronized void exportHtml(HttpServletResponse response) throws FileNotFoundException {
|
public synchronized void exportHtml(HttpServletResponse response) throws FileNotFoundException {
|
||||||
|
try (HikariDataSource dataSource = buildDataSource()) {
|
||||||
// 创建 screw 的配置
|
// 创建 screw 的配置
|
||||||
Configuration config = Configuration.builder()
|
Configuration config = Configuration.builder()
|
||||||
.version(DOC_VERSION) // 版本
|
.version(DOC_VERSION) // 版本
|
||||||
.description(DOC_DESCRIPTION) // 描述
|
.description(DOC_DESCRIPTION) // 描述
|
||||||
.dataSource(buildDataSource()) // 数据源
|
.dataSource(dataSource) // 数据源
|
||||||
.engineConfig(buildEngineConfig()) // 引擎配置
|
.engineConfig(buildEngineConfig()) // 引擎配置
|
||||||
.produceConfig(buildProcessConfig()) // 处理配置
|
.produceConfig(buildProcessConfig()) // 处理配置
|
||||||
.build();
|
.build();
|
||||||
@ -61,11 +62,13 @@ public class InfDbDocController {
|
|||||||
new FileInputStream(FILE_OUTPUT_DIR + File.separator + DOC_FILE_NAME + FILE_OUTPUT_TYPE.getFileSuffix()),
|
new FileInputStream(FILE_OUTPUT_DIR + File.separator + DOC_FILE_NAME + FILE_OUTPUT_TYPE.getFileSuffix()),
|
||||||
MediaType.TEXT_HTML_VALUE);
|
MediaType.TEXT_HTML_VALUE);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建数据源
|
* 创建数据源
|
||||||
*/
|
*/
|
||||||
private DataSource buildDataSource() {
|
// TODO 芋艿:screw 暂时不支持 druid,尴尬
|
||||||
|
private HikariDataSource buildDataSource() {
|
||||||
// 创建 HikariConfig 配置类
|
// 创建 HikariConfig 配置类
|
||||||
HikariConfig hikariConfig = new HikariConfig();
|
HikariConfig hikariConfig = new HikariConfig();
|
||||||
// hikariConfig.setDriverClassName("com.mysql.cj.jdbc.Driver");
|
// hikariConfig.setDriverClassName("com.mysql.cj.jdbc.Driver");
|
||||||
|
@ -5,10 +5,9 @@ import cn.iocoder.dashboard.modules.system.controller.logger.vo.loginlog.SysLogi
|
|||||||
import cn.iocoder.dashboard.modules.system.controller.logger.vo.loginlog.SysLoginLogExportReqVO;
|
import cn.iocoder.dashboard.modules.system.controller.logger.vo.loginlog.SysLoginLogExportReqVO;
|
||||||
import cn.iocoder.dashboard.modules.system.controller.logger.vo.loginlog.SysLoginLogPageReqVO;
|
import cn.iocoder.dashboard.modules.system.controller.logger.vo.loginlog.SysLoginLogPageReqVO;
|
||||||
import cn.iocoder.dashboard.modules.system.convert.logger.SysLoginLogConvert;
|
import cn.iocoder.dashboard.modules.system.convert.logger.SysLoginLogConvert;
|
||||||
import cn.iocoder.dashboard.modules.system.dal.mysql.logger.SysLoginLogMapper;
|
|
||||||
import cn.iocoder.dashboard.modules.system.dal.dataobject.logger.SysLoginLogDO;
|
import cn.iocoder.dashboard.modules.system.dal.dataobject.logger.SysLoginLogDO;
|
||||||
|
import cn.iocoder.dashboard.modules.system.dal.mysql.logger.SysLoginLogMapper;
|
||||||
import cn.iocoder.dashboard.modules.system.service.logger.SysLoginLogService;
|
import cn.iocoder.dashboard.modules.system.service.logger.SysLoginLogService;
|
||||||
import cn.iocoder.dashboard.modules.system.service.user.SysUserService;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
@ -23,9 +22,6 @@ public class SysLoginLogServiceImpl implements SysLoginLogService {
|
|||||||
@Resource
|
@Resource
|
||||||
private SysLoginLogMapper loginLogMapper;
|
private SysLoginLogMapper loginLogMapper;
|
||||||
|
|
||||||
@Resource
|
|
||||||
private SysUserService userService;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createLoginLog(SysLoginLogCreateReqVO reqVO) {
|
public void createLoginLog(SysLoginLogCreateReqVO reqVO) {
|
||||||
SysLoginLogDO loginLog = SysLoginLogConvert.INSTANCE.convert(reqVO);
|
SysLoginLogDO loginLog = SysLoginLogConvert.INSTANCE.convert(reqVO);
|
||||||
|
Loading…
Reference in New Issue
Block a user