mybatis-mapper / mapper

MyBatis Mapper
https://mapper.mybatis.io
Apache License 2.0
325 stars 47 forks source link

EntityColumn 检测是否设置了主键策略异常 #97

Closed zisedk closed 1 month ago

zisedk commented 5 months ago

EntityColumn

  /**
   * 当前字段是否设置了主键策略
   */
  public boolean hasPrimaryKeyStrategy() {
    return id && (useGeneratedKeys || (afterSql != null && !afterSql.isEmpty()) || genId != GenId.NULL.class);
  }

使用JPA解析的时候 genId 没进行赋值就是 null ,这个地方校检的时候 返回当前有 主键策略 导致插入数据时在 KeySqlMsCustomize 不停地输出警告

方法 insertSelective 使用了 @Options(useGeneratedKeys = true),忽略实体上的主键策略
abel533 commented 5 months ago

来个PR?