In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces the knowledge of "how to generate database documents with one click". In the operation of actual cases, many people will encounter such a dilemma. Next, let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Database document diagram MySQLMariaDBTIDBOracleSqlServerPostgreSQLCache DB
The introduction of screw core package, HikariCP database connection pool, HikariCP claimed to be the best performance of database connection pool.
Cn.smallbun.screw
Screw-core
1.0.3
Com.zaxxer
HikariCP
3.4.5
Mysql
Mysql-connector-java
8.0.20
Configure the data source and set useInformationSchema to get tables comment information.
Spring.datasource.url=jdbc:mysql://45.93.1.5:3306/fire?useUnicode=true&characterEncoding=UTF-8&useSSL=false
Spring.datasource.username=root
Spring.datasource.password=123456
Spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
Spring.datasource.xa.properties.useInformationSchema=true
Screw can be executed in two ways, the first is pom file configuration, and the other is code execution.
Org.springframework.boot
Spring-boot-maven-plugin
Cn.smallbun.screw
Screw-maven-plugin
1.0.3
Com.zaxxer
HikariCP
3.4.5
Mysql
Mysql-connector-java
8.0.20
Root
123456
Com.mysql.cj.jdbc.Driver
Jdbc:mysql://41.92.6.5:3306/fire
HTML
False
Freemarker
Database document generation
${project.version}
Fire database documents
Compile
Run
After configuration, double-click on maven project- > screw to execute ok.
Insert a picture description here
Code generation is also very simple.
@ SpringBootTest
Public class ScrewApplicationTests {
@ Autowired
ApplicationContext applicationContext
@ Test
Void contextLoads () {
DataSource dataSourceMysql = applicationContext.getBean (DataSource.class)
/ / generate file configuration
EngineConfig engineConfig = EngineConfig.builder ()
/ / generate the file path, the local address of your own mac, and you need to change the path here.
.fileOutputDir ("Dpurs /")
/ / Open the directory
.openOutputDir (false)
/ / File type
.fileType (EngineFileType.HTML)
/ / generate template implementation
.produceType (EngineTemplateType.freemarker) .build ()
/ / generate document configuration (including the following custom version number, description, etc. Configuration connection)
Configuration config = Configuration.builder ()
.version ("1.0.3")
.description ("generate document information description")
.dataSource (dataSourceMysql)
.engineConfig (engineConfig)
.produceConfig (getProcessConfig ())
.build ()
/ / perform generation
New DocumentationExecute (config) .execute ()
}
/ * *
* configure the tables you want to generate + configure the tables you want to ignore
*
* @ return generate table configuration
, /
Public static ProcessConfig getProcessConfig () {
/ / ignore table names
List ignoreTableName = Arrays.asList ("a", "test_group")
/ / ignore table prefixes, such as database tables starting with a
List ignorePrefix = Arrays.asList ("a", "t")
/ / ignore table suffix
List ignoreSuffix = Arrays.asList ("_ test", "czb_")
Return ProcessConfig.builder ()
/ / generate the table according to the name
.acquiatedTableName (Arrays.asList ("fire_user"))
/ / generate according to the table prefix
.accounatedTablePrefix (new ArrayList ())
/ / generate according to the table suffix
.acquiatedTableSuffix (new ArrayList ())
/ / ignore table names
.SecretreTableName (ignoreTableName)
/ / ignore table prefix
.SecretreTablePrefix (ignorePrefix)
/ / ignore table suffix
.roomreTableSuffix (ignoreSuffix) .build ()
}
}
Screw has documents in HTML, DOC and MD formats.
Changes in the code
.fileType (EngineFileType.HTML)
Or pom files.
MD
DOC document style
Work document
HTML document style
Insert a picture description here
MD document style
This is the end of the content of "how to generate database documents with one click". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.