jooq_generate插件生成代码

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&amp;characterEncoding=UTF-8&amp;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
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值