欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

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

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

一、screw介紹

不是大廠寫(xiě)的,是個(gè)人寫(xiě)的,但是不得不說(shuō),好使啊, 為愛(ài)發(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("開(kāi)始生成數(shù)據(jù)庫(kù)文檔");
		String dbFilePath = "/Users/zwmac/work/ovu/數(shù)據(jù)庫(kù)";
		// 生成文件配置
		EngineConfig engineConfig = EngineConfig.builder()
				// 生成文件路徑,自己mac本地的地址,這里需要自己更換下路徑
				.fileOutputDir(dbFilePath)
				// 打開(kāi)目錄
				.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)行,就不說(shuō)了,自己摸索摸索。

3.生成的word文檔效果

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

相關(guān)文章

  • 使用IDEA將Java/Kotliin工程導(dǎo)出Jar包的正確姿勢(shì)

    使用IDEA將Java/Kotliin工程導(dǎo)出Jar包的正確姿勢(shì)

    這篇文章主要介紹了使用IDEA將Java/Kotliin工程導(dǎo)出Jar包的正確姿勢(shì),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2020-03-03
  • Mybatis-plus使用注解 @TableField(exist = false)

    Mybatis-plus使用注解 @TableField(exist = false)

    這篇文章主要介紹了Mybatis-plus使用注解 @TableField(exist = false),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2021-03-03
  • java Person,Student,GoodStudent 三個(gè)類的繼承、構(gòu)造函數(shù)的執(zhí)行

    java Person,Student,GoodStudent 三個(gè)類的繼承、構(gòu)造函數(shù)的執(zhí)行

    這篇文章主要介紹了java Person,Student,GoodStudent 三個(gè)類的繼承、構(gòu)造函數(shù)的執(zhí)行,需要的朋友可以參考下
    2017-02-02
  • springboot的切面應(yīng)用方式(注解Aspect)

    springboot的切面應(yīng)用方式(注解Aspect)

    文章總結(jié):Spring?Boot提供了三種攔截器:Filter、Interceptor和Aspect,Filter主要用于內(nèi)容過(guò)濾和非登錄狀態(tài)的非法請(qǐng)求過(guò)濾,無(wú)法獲取Spring框架相關(guān)的信息,Interceptor可以在獲取請(qǐng)求類名、方法名的同時(shí),獲取請(qǐng)求參數(shù),但無(wú)法獲取參數(shù)值
    2024-11-11
  • java處理日期的工具類DateUtil

    java處理日期的工具類DateUtil

    這篇文章主要為大家詳細(xì)介紹了java處理日期的工具類DateUtil,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2020-10-10
  • JAVA系統(tǒng)中Spring?Boot應(yīng)用程序的配置文件application.yml使用詳解

    JAVA系統(tǒng)中Spring?Boot應(yīng)用程序的配置文件application.yml使用詳解

    這篇文章主要介紹了JAVA系統(tǒng)中Spring?Boot應(yīng)用程序的配置文件application.yml的相關(guān)資料,application.yml是Spring?Boot應(yīng)用程序的配置文件,定義了服務(wù)器、Spring、日志、安全及其他配置屬性,確保應(yīng)用程序正確啟動(dòng)和運(yùn)行,需要的朋友可以參考下
    2025-01-01
  • Java中如何調(diào)用cmd壓縮文件

    Java中如何調(diào)用cmd壓縮文件

    以下是對(duì)Java調(diào)用cmd壓縮文件的實(shí)現(xiàn)方法進(jìn)行了分析介紹,需要的朋友可以參考下
    2013-07-07
  • MyBatis分頁(yè)查詢與特殊字符處理方式

    MyBatis分頁(yè)查詢與特殊字符處理方式

    這篇文章主要介紹了MyBatis分頁(yè)查詢與特殊字符處理方式,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2023-12-12
  • Java中ArrayList類的用法與源碼完全解析

    Java中ArrayList類的用法與源碼完全解析

    這篇文章主要介紹了Java中ArrayList類的用法與源碼完全解析,ArrayList類通過(guò)List接口實(shí)現(xiàn),是Java中引申出的一種數(shù)據(jù)結(jié)構(gòu),需要的朋友可以參考下
    2016-05-05
  • Java后臺(tái)返回和處理JSon數(shù)據(jù)的方法步驟

    Java后臺(tái)返回和處理JSon數(shù)據(jù)的方法步驟

    這篇文章主要介紹了Java后臺(tái)返回和處理JSon數(shù)據(jù)的方法步驟,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2019-09-09

最新評(píng)論