Spring boot 中 Mybatis Plus 在 Oracle 新增数据时,主键自增问题

问题:

新增数据时提示,无效的列类型:1111,如下图:
无效的列类型:1111


解决办法:

1.spring boot 依赖版本改为 mybatis-plus-boot-starter
2.在配置文件中增加

#主键类型  0:"数据库ID自增", 1:"用户输入ID",2:"全局唯一ID (数字类型唯一ID)", 3:"全局唯一ID UUID";
id-type: 1
# Sequence序列接口实现类配置
key-generator: com.baomidou.mybatisplus.incrementer.OracleKeyGenerator

3.实体增加 @KeySequence 注解,@TableId 增加 type = IdType.INPUT

@TableName("T_BASE_USER_INFO")
@KeySequence(value = "SEQ_BASE_USER_INFO", clazz = Integer.class)
public class BaseUserInfo extends Model<BaseUserInfo> {

    private static final long serialVersionUID = 1L;

    /**
     * 用户ID
     */
    @TableId(value = "USER_ID", type = IdType.INPUT)
    private Integer userId;

猜你喜欢

转载自blog.csdn.net/ancdc/article/details/81096471