最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

springboot集成screw反向生成數(shù)據(jù)庫(kù)說明文檔

 更新時(shí)間:2025年01月09日 09:57:36   作者:肥仔哥哥1930  
screw是一個(gè)一鍵式生成數(shù)據(jù)庫(kù)文檔的開源工具包,目前screw可以生成word、md和html格式類的文檔,本文主要來講講如何通過screw反向生成數(shù)據(jù)庫(kù)說明文檔,感興趣的可以了解下

一、screw介紹

不是大廠寫的,是個(gè)人寫的,但是不得不說,好使啊, 為愛發(fā)電。

二、使用步驟

1.新建一個(gè)空的springboot項(xiàng)目

這個(gè)使用idea,選擇springboot,下一步下一步就行。

我這里是maven項(xiàng)目,pom文件引入jar包。

我這里的整個(gè)pom.xml內(nèi)容

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>3.3.3</version>
		<relativePath/> <!-- lookup parent from repository -->
	</parent>
	<groupId>com.easylinkin</groupId>
	<artifactId>my-screw</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<name>my-screw</name>
	<description>my-screw</description>
	<url/>
	<licenses>
		<license/>
	</licenses>
	<developers>
		<developer/>
	</developers>
	<scm>
		<connection/>
		<developerConnection/>
		<tag/>
		<url/>
	</scm>
	<properties>
		<java.version>17</java.version>
	</properties>
	<dependencies>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter</artifactId>
		</dependency>

		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-test</artifactId>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-web</artifactId>
		</dependency>
		<dependency>
			<groupId>cn.smallbun.screw</groupId>
			<artifactId>screw-core</artifactId>
			<version>1.0.5</version>
		</dependency>
		<dependency>
			<groupId>com.mysql</groupId>
			<artifactId>mysql-connector-j</artifactId>
		</dependency>
		<dependency>
			<groupId>com.zaxxer</groupId>
			<artifactId>HikariCP</artifactId>
		</dependency>
		<dependency>
			<groupId>org.projectlombok</groupId>
			<artifactId>lombok</artifactId>
		</dependency>
	</dependencies>

	<build>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
			</plugin>
		</plugins>
	</build>

</project>

2.生成文檔的測(cè)試類

package com.easylinkin.myscrew;

import cn.smallbun.screw.core.Configuration;
import cn.smallbun.screw.core.engine.EngineConfig;
import cn.smallbun.screw.core.engine.EngineFileType;
import cn.smallbun.screw.core.engine.EngineTemplateType;
import cn.smallbun.screw.core.execute.DocumentationExecute;
import cn.smallbun.screw.core.process.ProcessConfig;
import com.zaxxer.hikari.HikariDataSource;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

@Slf4j
@SpringBootTest
class MyScrewApplicationTests {

	//@Test
	void contextLoads() {
	}

	/**
	 * 獲取數(shù)據(jù)源配置
	 */
	@Test
	void generate() {
		log.info("開始生成數(shù)據(jù)庫(kù)文檔");
		String dbFilePath = "/Users/zwmac/work/ovu/數(shù)據(jù)庫(kù)";
		// 生成文件配置
		EngineConfig engineConfig = EngineConfig.builder()
				// 生成文件路徑,自己mac本地的地址,這里需要自己更換下路徑
				.fileOutputDir(dbFilePath)
				// 打開目錄
				.openOutputDir(false)
				// 文件類型 HTML/WORD/MD 三種格式
				.fileType(EngineFileType.WORD)
				// 生成模板實(shí)現(xiàn)
				.produceType(EngineTemplateType.freemarker).build();

		//數(shù)據(jù)庫(kù)名稱
		String[] dbNames = {"ovuhome"};
		for (String dbName : dbNames) {
			HikariDataSource hikariDataSource = new HikariDataSource();
			//設(shè)置數(shù)據(jù)庫(kù)連接
			hikariDataSource.setJdbcUrl("jdbc:mysql://127.0.0.1:3306/" + dbName + "?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&allowPublicKeyRetrieval=true");
			hikariDataSource.setUsername("root");
			hikariDataSource.setPassword("12345678");
			// 生成文檔配置(包含以下自定義版本號(hào)、描述等配置連接)
			Configuration config = Configuration.builder()
					//文檔版本號(hào)
					.version("1.0.1")
					//文檔名稱
					.description("公寓數(shù)據(jù)庫(kù)設(shè)計(jì)文檔")
					//數(shù)據(jù)源
					.dataSource(hikariDataSource)
					//生成引擎配置
					.engineConfig(engineConfig)
					//高級(jí)配置
					//.produceConfig(getProcessConfig())
					.build();

			// 執(zhí)行生成
			new DocumentationExecute(config).execute();
		}
		log.info("生成數(shù)據(jù)庫(kù)文檔完成");
	}

	/**
	 * 配置想要生成的表+ 配置想要忽略的表
	 * @return 生成表配置
	 */
	public static ProcessConfig getProcessConfig(){
		// 忽略表名
		List<String> ignoreTableName = Arrays.asList("testa_testa","testb_testb");
		// 忽略表前綴
		List<String> ignorePrefix = Arrays.asList("testa","testb");
		// 忽略表后綴
		List<String> ignoreSuffix = Arrays.asList("_testa","_testb");
		return ProcessConfig.builder()
				//根據(jù)名稱指定表生成 我需要生成所有表 這里暫時(shí)不設(shè)置
				.designatedTableName(new ArrayList<>())
				//根據(jù)表前綴生成 我需要生成所有表 這里暫時(shí)不設(shè)置
				.designatedTablePrefix(new ArrayList<>())
				//根據(jù)表后綴生成 我需要生成所有表 這里暫時(shí)不設(shè)置
				.designatedTableSuffix(new ArrayList<>())
				//忽略表名
				.ignoreTableName(ignoreTableName)
				//忽略表前綴
				.ignoreTablePrefix(ignorePrefix)
				//忽略表后綴
				.ignoreTableSuffix(ignoreSuffix).build();
	}

}

測(cè)試類運(yùn)行,就不說了,自己摸索摸索。

3.生成的word文檔效果

到此這篇關(guān)于springboot集成screw反向生成數(shù)據(jù)庫(kù)說明文檔的文章就介紹到這了,更多相關(guān)springboot screw生成數(shù)據(jù)庫(kù)說明文檔內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • java 獲取路徑的各種方法(總結(jié))

    java 獲取路徑的各種方法(總結(jié))

    下面小編就為大家?guī)硪黄猨ava 獲取路徑的各種方法(總結(jié))。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧
    2016-08-08
  • springboot+dubbo+zookeeper的簡(jiǎn)單實(shí)例詳解

    springboot+dubbo+zookeeper的簡(jiǎn)單實(shí)例詳解

    本文主要介紹了springboot+dubbo+zookeeper的簡(jiǎn)單實(shí)例,文中通過示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2021-10-10
  • eclipse創(chuàng)建一個(gè)基于maven的web項(xiàng)目詳細(xì)步驟

    eclipse創(chuàng)建一個(gè)基于maven的web項(xiàng)目詳細(xì)步驟

    開始學(xué)習(xí)maven,并用maven創(chuàng)建了第一個(gè)屬于自己的web項(xiàng)目,下面這篇文章主要給大家介紹了關(guān)于eclipse創(chuàng)建一個(gè)基于maven的web項(xiàng)目的相關(guān)資料,文中通過圖文介紹的非常詳細(xì),需要的朋友可以參考下
    2023-12-12
  • rabbitmq之無法自動(dòng)創(chuàng)建隊(duì)列的問題及解決過程

    rabbitmq之無法自動(dòng)創(chuàng)建隊(duì)列的問題及解決過程

    文章描述了一項(xiàng)目使用RabbitMQ但僅使用發(fā)送功能未監(jiān)聽,導(dǎo)致啟動(dòng)時(shí)無自動(dòng)創(chuàng)建隊(duì)列的問題,作者通過手動(dòng)連接RabbitMQ配置隊(duì)列信息來解決此問題,并提供了一種測(cè)試可用的方法,此方法僅為作者個(gè)人經(jīng)驗(yàn),僅供參考
    2026-05-05
  • JAVA反射機(jī)制實(shí)例教程

    JAVA反射機(jī)制實(shí)例教程

    這篇文章主要介紹了JAVA反射機(jī)制,包括了Java反射機(jī)制的各種應(yīng)用技巧,非常具有實(shí)用價(jià)值,需要的朋友可以參考下
    2014-09-09
  • Struts2學(xué)習(xí)筆記(9)-Result配置全局結(jié)果集

    Struts2學(xué)習(xí)筆記(9)-Result配置全局結(jié)果集

    這篇文章主要介紹Struts2中使用Result配置全局結(jié)果集的方法,希望能給大家做一個(gè)參考。
    2016-06-06
  • Springboot整合ip2region實(shí)現(xiàn)用戶ip歸屬地獲取

    Springboot整合ip2region實(shí)現(xiàn)用戶ip歸屬地獲取

    ip2region是一個(gè)離線IP地址定位庫(kù)和IP定位數(shù)據(jù)管理框架,提供了眾多主流編程語言的 xdb 數(shù)據(jù)生成和查詢客戶端實(shí)現(xiàn),下面我們來看看如何使用ip2region實(shí)現(xiàn)用戶ip歸屬地獲取吧
    2025-05-05
  • mybatisPlus配置邏輯字段不生效問題解決

    mybatisPlus配置邏輯字段不生效問題解決

    本文主要介紹了mybatisPlus配置邏輯字段不生效問題解決,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2024-05-05
  • SpringBoot集成Swagger2構(gòu)建在線API文檔的代碼詳解

    SpringBoot集成Swagger2構(gòu)建在線API文檔的代碼詳解

    這篇文章主要介紹了SpringBoot集成Swagger2構(gòu)建在線API文檔,本文通過實(shí)例代碼給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2020-12-12
  • JavaScript異步通信三種玩法實(shí)例代碼

    JavaScript異步通信三種玩法實(shí)例代碼

    在JavaScript中實(shí)現(xiàn)異步編程的方法多種多樣,每種方法都有其特定的應(yīng)用場(chǎng)景和優(yōu)缺點(diǎn),這篇文章主要介紹了JavaScript異步通信三種玩法的相關(guān)資料,文中通過代碼介紹的非常詳細(xì),需要的朋友可以參考下
    2025-12-12

最新評(píng)論

邓州市| 柏乡县| 乐亭县| 大悟县| 镶黄旗| 玛曲县| 新巴尔虎右旗| 茶陵县| 堆龙德庆县| 武宁县| 启东市| 苗栗市| 达拉特旗| 武乡县| 望谟县| 靖江市| 吴忠市| 榆林市| 剑阁县| 伊川县| 淮南市| 威信县| 阿拉善右旗| 油尖旺区| 张家界市| 怀仁县| 宁海县| 湘潭县| 南充市| 秦皇岛市| 新化县| 达孜县| 襄垣县| 卓资县| 青州市| 蒙阴县| 泾源县| 库尔勒市| 临泉县| 鞍山市| 绥棱县|