解决 db doc 导出的报错问题

This commit is contained in:
YunaiV
2021-02-20 22:02:24 +08:00
parent 8e21b5200a
commit 183bb5855a
4 changed files with 20 additions and 105 deletions

View File

@ -44,28 +44,31 @@ public class InfDbDocController {
@GetMapping("/export-html")
public synchronized void exportHtml(HttpServletResponse response) throws FileNotFoundException {
// 创建 screw 的配置
Configuration config = Configuration.builder()
.version(DOC_VERSION) // 版本
.description(DOC_DESCRIPTION) // 描述
.dataSource(buildDataSource()) // 数据源
.engineConfig(buildEngineConfig()) // 引擎配置
.produceConfig(buildProcessConfig()) // 处理配置
.build();
try (HikariDataSource dataSource = buildDataSource()) {
// 创建 screw 的配置
Configuration config = Configuration.builder()
.version(DOC_VERSION) // 版本
.description(DOC_DESCRIPTION) // 描述
.dataSource(dataSource) // 数据源
.engineConfig(buildEngineConfig()) // 引擎配置
.produceConfig(buildProcessConfig()) // 处理配置
.build();
// 执行 screw生成数据库文档
new DocumentationExecute(config).execute();
// 执行 screw生成数据库文档
new DocumentationExecute(config).execute();
// 读取,返回
ServletUtil.write(response,
new FileInputStream(FILE_OUTPUT_DIR + File.separator + DOC_FILE_NAME + FILE_OUTPUT_TYPE.getFileSuffix()),
MediaType.TEXT_HTML_VALUE);
// 读取,返回
ServletUtil.write(response,
new FileInputStream(FILE_OUTPUT_DIR + File.separator + DOC_FILE_NAME + FILE_OUTPUT_TYPE.getFileSuffix()),
MediaType.TEXT_HTML_VALUE);
}
}
/**
* 创建数据源
*/
private DataSource buildDataSource() {
// TODO 芋艿screw 暂时不支持 druid尴尬
private HikariDataSource buildDataSource() {
// 创建 HikariConfig 配置类
HikariConfig hikariConfig = new HikariConfig();
// hikariConfig.setDriverClassName("com.mysql.cj.jdbc.Driver");

View File

@ -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.SysLoginLogPageReqVO;
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.mysql.logger.SysLoginLogMapper;
import cn.iocoder.dashboard.modules.system.service.logger.SysLoginLogService;
import cn.iocoder.dashboard.modules.system.service.user.SysUserService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@ -23,9 +22,6 @@ public class SysLoginLogServiceImpl implements SysLoginLogService {
@Resource
private SysLoginLogMapper loginLogMapper;
@Resource
private SysUserService userService;
@Override
public void createLoginLog(SysLoginLogCreateReqVO reqVO) {
SysLoginLogDO loginLog = SysLoginLogConvert.INSTANCE.convert(reqVO);