package tk.mybatis.mapper.common.special;

import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Options;
import tk.mybatis.mapper.provider.SpecialProvider;

public interface InsertUseGeneratedKeysMapper<T> {
    @Options(
        useGeneratedKeys = true,
        keyProperty = "id"
    )
    @InsertProvider(
        type = SpecialProvider.class,
        method = "dynamicSQL"
    )
    int insertUseGeneratedKeys(T var1);
}

1、使用  insertUseGeneratedKeys插入数据时,如果id字段不是AUTO_INCREMENT,则不会生成新的id

2、建表的时候主键名定义为id,否则不会返回主键

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-07-25
  • 2022-02-01
  • 2021-05-27
  • 2021-07-27
  • 2021-07-15
  • 2021-07-29
猜你喜欢
  • 2022-02-14
  • 2021-10-30
  • 2021-07-19
  • 2022-12-23
  • 2021-08-26
  • 2022-02-08
相关资源
相似解决方案