Package 

Class NativeInsert

  • All Implemented Interfaces:
    query.BasedQuery

    
    public final class NativeInsert
    extends ReviseQuery
                        

    无实体类的insert语句dsl类

    • Constructor Detail

      • NativeInsert

        NativeInsert(DB db)
    • Method Detail

      • into

         final NativeInsert into(String table)

        insert into子句 例如:NativeInsert() into "t1"

        Parameters:
        table - String 表名
      • columns

         final NativeInsert columns(List<String> columns)

        insert语句的字段名 例如:NativeInsert() into "t1" columns listOf("c1", "c2")

        Parameters:
        columns - List<String> 字段名列表
      • columns

         final NativeInsert columns(String column)

        insert语句的字段名 例如:NativeInsert().into("t1").columns("c1", "c2")

        Parameters:
        column - Array<out String> 字段名列表
      • value

         final NativeInsert value(Map<String, Object> value)

        insert语句的values子句(单条) 例如:NativeInsert() into "t1" columns listOf("c1", "c2") value mutableMapOf("c1" to 1, "c2" to "xxx", "c3" to null)

        Parameters:
        value - MutableMap<String, Any?
      • values

         final NativeInsert values(List<Map<String, Object>> values)

        insert语句的values子句(批量) 例如:NativeInsert() into "t1" columns listOf("c1", "c2") values listOf(mutableMapOf("c1" to 1, "c2" to "xxx"), mutableMapOf("c1" to 2, "c2" to "yyy"))

        Parameters:
        values - List<MutableMap<String, Any?
      • values

         final NativeInsert values(Map<String, Object> values)

        insert语句的values子句(批量) 例如:NativeInsert().into("t1").columns("c1", "c2").values(mutableMapOf("c1" to 1, "c2" to "xxx"), mutableMapOf("c1" to 2, "c2" to "yyy"))

        Parameters:
        values - MutableMap<String, Any?
      • exec

         Integer exec()

        执行语句并返回受影响行数(如果有自增主键会在原插入的数据里添加一个incrKey的键)