实体类:
import lombok.Data;
import com.baomidou.mybatisplus.annotation.*;
//创建序列
//create sequence KeySequence minvalue 1 maxvalue 9999999999999999999999999999 start with 1 increment by 1 cache 20;
@Data
@TableName("TableName")
@KeySequence(value = "KeySequence")
public class PTGLRYJBXXB {
/**
* ID
*/
@TableId(value = "ID", type = IdType.INPUT)
private Long id;
/**
* 姓名
*/
@TableField(value ="NAME")
private String name;
启动类:
import com.baomidou.mybatisplus.core.incrementer.IKeyGenerator;
import com.baomidou.mybatisplus.extension.incrementer.OracleKeyGenerator;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.transaction.annotation.EnableTransactionManagement;
@EnableAsync
@SpringBootApplication
@EnableTransactionManagement
public class App {
public static void main(String[] args) {
new SpringApplicationBuilder(App.class)
.web(WebApplicationType.SERVLET)
.run(args);
}
@Bean
public IKeyGenerator keyGenerator() {
return new OracleKeyGenerator();
}
}