pom.xml
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jooq</artifactId>
</dependency>
<!--springboot parent 会自动管理版本号-->
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
</dependency>
<!--springboot parent 会自动管理版本号-->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<!--springboot parent 会自动管理版本号-->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
自动生成数据库表代码
<build>
<plugins>...</plugins>
</build>
<plugin>
<groupId>org.jooq</groupId>
<artifactId>jooq-codegen-maven</artifactId>
<!-- The plugin should hook into the generate goal -->
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.47</version>
</dependency>
</dependencies>
<configuration>
<jdbc>
<driver>com.mysql.jdbc.Driver</driver>
<url>jdbc:mysql://ip:3306/?useUnicode=true&characterEncoding=UTF-8&useSSL=false</url>
<user>root</user>
<password>xxx</password>
</jdbc>
<generator>
<name>org.jooq.util.JavaGenerator</name>
<database>
<name>org.jooq.util.mysql.MySQLDatabase</name>
<inputSchema>maqingbin</inputSchema>
<includes>.*</includes>
<excludes>flyway_schema_history</excludes>
<recordTimestampFields>updated_at</recordTimestampFields>
</database>
<target>
<packageName>com.qbsea.mysboot2common.jooq.generated</packageName>
<directory>src/main/java</directory>
</target>
</generator>
</configuration>
</plugin>
jooq-codegen:generate