Interface InsertCmd

All Superinterfaces:
Executable
All Known Implementing Classes:
Dao

public interface InsertCmd extends Executable
插入指令
Author:
Maning
  • Method Summary

    Modifier and Type
    Method
    Description
    default int
    insert(Object entity)
    插入数据,若非record类型还会回填自增值(原主键值=null且标注Column(autoIncrement=true)), fill值(FillOnInsert(populate=true))
    default <T> int
    insertBatch(List<T> entities)
    批量插入数据,batchSize由配置决定,不会对对象填充自增值
    default <T> int
    insertBatch(List<T> entities, int batchSize)
    批量插入数据,不会对对象回填自增值和fill值(不影响数据库层面自增和插入fill填)
    default <S> int
    insertBatchWith(Class<?> entityClass, List<S> sources)
    批量插入数据通过源对象(VO,Req,DTO等,通过field匹配,需确保类型兼容),不回填数据,batchSize由配置决定
    default <S> int
    insertBatchWith(Class<?> entityClass, List<S> sources, int batchSize)
    批量插入数据通过源对象(VO,Req,DTO等,通过field匹配,需确保类型兼容),不回填数据
    default int
    insertWith(Class<?> entityClass, Object source)
    插入数据通过源对象(VO,Req,DTO等,通过field匹配,需确保类型兼容),不回填数据
    default int
    insertWith(Object entityDefault, Object source)
    插入数据通过源对象(VO,Req,DTO等,通过field匹配,需确保类型兼容),不回填数据
    default int
    insertWithMap(Class<?> entityClass, Map<String,Object> source)
    插入数据通过源Map(将key当作field匹配,需确保值类型兼容)

    Methods inherited from interface Executable

    executor, interceptor
  • Method Details

    • insert

      default int insert(Object entity)
      插入数据,若非record类型还会回填自增值(原主键值=null且标注Column(autoIncrement=true)), fill值(FillOnInsert(populate=true))
      Parameters:
      entity - 实体类实例
      Returns:
      插入条数|执行结果
    • insertBatch

      default <T> int insertBatch(List<T> entities, int batchSize)
      批量插入数据,不会对对象回填自增值和fill值(不影响数据库层面自增和插入fill填)
      Type Parameters:
      T - 实体类型
      Parameters:
      entities - 实体
      batchSize - 每次执行数量
      Returns:
      插入条数|执行结果
    • insertBatch

      default <T> int insertBatch(List<T> entities)
      批量插入数据,batchSize由配置决定,不会对对象填充自增值
      Type Parameters:
      T - 实体类型
      Parameters:
      entities - 实体
      Returns:
      插入条数|执行结果
    • insertBatchWith

      default <S> int insertBatchWith(Class<?> entityClass, List<S> sources, int batchSize)
      批量插入数据通过源对象(VO,Req,DTO等,通过field匹配,需确保类型兼容),不回填数据
      Type Parameters:
      S - 源对象类型
      Parameters:
      entityClass - 实体类
      sources - 要插入的对象
      batchSize - 每次执行条数
      Returns:
      插入条数|执行结果
    • insertBatchWith

      default <S> int insertBatchWith(Class<?> entityClass, List<S> sources)
      批量插入数据通过源对象(VO,Req,DTO等,通过field匹配,需确保类型兼容),不回填数据,batchSize由配置决定
      Type Parameters:
      S - 值对象类型
      Parameters:
      entityClass - 实体类
      sources - 要插入的对象
      Returns:
      插入条数|执行结果
    • insertWith

      default int insertWith(Class<?> entityClass, Object source)
      插入数据通过源对象(VO,Req,DTO等,通过field匹配,需确保类型兼容),不回填数据
      Parameters:
      entityClass - 实体类
      source - 源对象实例
      Returns:
      插入条数|执行结果
    • insertWith

      default int insertWith(Object entityDefault, Object source)
      插入数据通过源对象(VO,Req,DTO等,通过field匹配,需确保类型兼容),不回填数据
      Parameters:
      entityDefault - 实体默认值,不能为空
      source - 源对象实例
      Returns:
      插入条数|执行结果
    • insertWithMap

      default int insertWithMap(Class<?> entityClass, Map<String,Object> source)
      插入数据通过源Map(将key当作field匹配,需确保值类型兼容)
      Parameters:
      entityClass - 实体类
      source - map
      Returns:
      插入条数|执行结果