Package 

Class Insert

  • All Implemented Interfaces:
    query.BasedQuery

    
    public final class Insert
    extends ReviseQuery
                        

    insert语句dsl类

    • Method Summary

      Modifier and Type Method Description
      final DB getDb()
      final Unit setDb(DB db)
      Connection getConn()
      Unit setConn(Connection conn)
      Boolean getIsTransaction()
      Unit setIsTransaction(Boolean isTransaction)
      final <T extends TableSchema> Insert into(T table) insert into子句 例如:Insert() into Table
      final Insert insert(Object entity) 使用实体数据生成sql(实体类需要定义正确的伴生对象) 例如:Insert() into entity
      final Insert insert(List<Object> entity) 使用实体数据列表生成sql(实体类需要定义正确的伴生对象) 例如:Insert() into listOf(entity1, entity2)
      final Insert value(Object obj) values子句 例如:Insert() into Table value entity
      final <T extends Any> Insert values(List<T> objList) values子句(批量) 例如:Insert() into Table values listOf(entity1, entity2)
      final <T extends Any> Insert values(T obj) values子句(批量) 例如:Insert().into(Table).
      String sql() 生成sql语句
      Integer exec() 执行插入语句并返回受影响行数(如果实体类伴生对象定义了自增主键,插入成功后会替换掉实体对象中对应字段的值)
      • Methods inherited from class query.insert.Insert

        toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • into

         final <T extends TableSchema> Insert into(T table)

        insert into子句 例如:Insert() into Table

        Parameters:
        table - TableSchema 实体类伴生对象名
      • insert

         final Insert insert(Object entity)

        使用实体数据生成sql(实体类需要定义正确的伴生对象) 例如:Insert() into entity

        Parameters:
        entity - Any 实体数据
      • insert

         final Insert insert(List<Object> entity)

        使用实体数据列表生成sql(实体类需要定义正确的伴生对象) 例如:Insert() into listOf(entity1, entity2)

        Parameters:
        entity - List<Any> 实体数据列表
      • value

         final Insert value(Object obj)

        values子句 例如:Insert() into Table value entity

        Parameters:
        obj - Any 实体对象
      • values

         final <T extends Any> Insert values(List<T> objList)

        values子句(批量) 例如:Insert() into Table values listOf(entity1, entity2)

        Parameters:
        objList - List<T> 实体对象列表
      • values

         final <T extends Any> Insert values(T obj)

        values子句(批量) 例如:Insert().into(Table).values(entity1, entity2)

        Parameters:
        obj - Array<out T> 实体对象列表
      • exec

         Integer exec()

        执行插入语句并返回受影响行数(如果实体类伴生对象定义了自增主键,插入成功后会替换掉实体对象中对应字段的值)