-
- All Implemented Interfaces:
-
query.BasedQuery
public final class NativeInsert extends ReviseQuery
无实体类的insert语句dsl类
-
-
Field Summary
Fields Modifier and Type Field Description private DBdbprivate Connectionconnprivate BooleanisTransaction
-
Constructor Summary
Constructors Constructor Description NativeInsert(DB db)NativeInsert(DB db, Connection conn, Boolean isTransaction)
-
Method Summary
Modifier and Type Method Description final DBgetDb()final UnitsetDb(DB db)ConnectiongetConn()UnitsetConn(Connection conn)BooleangetIsTransaction()UnitsetIsTransaction(Boolean isTransaction)final NativeInsertinto(String table)insert into子句 例如:NativeInsert() into "t1" final NativeInsertcolumns(List<String> columns)insert语句的字段名 例如:NativeInsert() into "t1" columns listOf("c1", "c2") final NativeInsertcolumns(String column)insert语句的字段名 例如:NativeInsert().into("t1"). final NativeInsertselect(Function1<Select, SelectQuery> select)insert语句的子查询 final NativeInsertvalue(Map<String, Object> value)insert语句的values子句(单条) 例如:NativeInsert() into "t1" columns listOf("c1", "c2") value mutableMapOf("c1" to 1, "c2" to "xxx", "c3" to null) final NativeInsertvalues(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")) final NativeInsertvalues(Map<String, Object> values)insert语句的values子句(批量) 例如:NativeInsert().into("t1").columns("c1", "c2"). Stringsql()生成sql语句 Integerexec()执行语句并返回受影响行数(如果有自增主键会在原插入的数据里添加一个incrKey的键) final List<Long>execReturnKey()执行语句并返回自增主键列表 -
-
Constructor Detail
-
NativeInsert
NativeInsert(DB db)
-
NativeInsert
NativeInsert(DB db, Connection conn, Boolean isTransaction)
-
-
Method Detail
-
getConn
Connection getConn()
-
setConn
Unit setConn(Connection conn)
-
getIsTransaction
Boolean getIsTransaction()
-
setIsTransaction
Unit setIsTransaction(Boolean isTransaction)
-
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> 字段名列表
-
select
final NativeInsert select(Function1<Select, SelectQuery> select)
insert语句的子查询
- Parameters:
select- @kotlin.
-
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?
-
execReturnKey
final List<Long> execReturnKey()
执行语句并返回自增主键列表
-
-
-
-