1.创建实体类
@Data
@Entity
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(description = "银行匹配表")
@Table(name = "bank_trait")
public class BankTrait implements Serializable {
@Id
@Column(name = "CODE")
@NotEmpty(message = "标签名不能为空", groups = {Add.class, Update.class})
@ApiModelProperty(value = "标签名", required = true)
private String code;
@Column(name = "NAME")
@NotEmpty(message = "匹配字段不能为空", groups = {Add.class, Update.class})
@ApiModelProperty(value = "匹配字段", required = true)
private String name;
}
2.pom.xml 添加依赖(只在生成表时使用,其他时候注掉)
<plugin>
<groupId>com.mysema.maven</groupId>
<artifactId>apt-maven-plugin</artifactId>
<version>1.1.3</version>
<executions>
<execution>
<goals>
<goal>process</goal>
</goals>
<configuration>
<outputDirectory>target/generated-sources/java</outputDirectory>
<processor>com.querydsl.apt.jpa.JPAAnnotationProcessor</processor>
</configuration>
</execution>
</executions>
</plugin>
3.ddl-auto 改成update(默认是none即不生成)
jpa:
database: MYSQL
show-sql: true
hibernate:
ddl-auto: update
4.先clean再install,会生成qBankTrait
5.install之后吧q开头的文件复制到实体类的地方
6.把依赖注掉 ,运行项目 就可以生成表了 生成完记得吧pro里配置的ddl改成none
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)