Mybatis Plus 3,oracle 自增序列配置
- config.yml 配置文件
mybatis-plus:
mapper-locations: classpath:/mapper/*Mapper.xml
global-config:
id-type: 1
key-generator: com.baomidou.mybatisplus.extension.incrementer.OracleKeyGenerator
- MybatisPlusConfigurer.java 配置
@Configuration
@MapperScan("user.mapper")
public class MybatisPlusConfigurer {
@Bean
public OracleKeyGenerator oracleKeyGenerator(){
return new OracleKeyGenerator();
}
}
- 实体配置
@TableName("T_USER")
@KeySequence(value = "SEQ_USER", clazz = Integer.class)
public class User extends Model<User> {
private static final long serialVersionUID = 1L;
@TableId(value = "USER_ID", type = IdType.INPUT)
private Integer userId;
}