public interface PreparedSql
支持的占位符有:? 或者 #{para} 或者 #{para%}, 都可以通过PreparedStatement防范SQL注入攻击.
Support placeholder ? or #{para} or #{para%}
若是可以,建议使用面向对象的操作方式,如:Suid和SuidRich,可以使用Bee缓存,获取更高的查询效率.
若没有使用占位符,则传入空数组或Map即可.
If possible, it is recommended to use object-oriented operation methods, such as Suid and SuidRich.
It can use Bee cache to achieve higher query efficiency.
注意 Notice:
PreparedSql没有T参数的方法中,因没有与entity关联,在多数据源情况下,只会从默认数据源中获取数据.
PreparedSql method which which no T parameter, is not associated with entity, in the case of
multiple Datasources, will be select the record from the default Datasource.
支持如name=#{name},name like #{name%}的map参数形式.
, 1.2
| 限定符和类型 | 方法和说明 |
|---|---|
int |
modify(String sql)
已过时。
不建议使用,因为框架不知道具体是更改了什么表,会影响缓存的正确性,从而产生缓存数据不准确的危险.
It is not recommended because the framework does not know what table has been changed, which will affect the correctness of the cache and cause the risk of inaccurate cache data. |
int |
modify(String sql,
Map<String,Object> map)
已过时。
不建议使用,因为框架不知道具体是更改了什么表,会影响缓存的正确性,从而产生缓存数据不准确的危险.
It is not recommended because the framework does not know what table has been changed, which will affect the correctness of the cache and cause the risk of inaccurate cache data. |
int |
modify(String sql,
Object[] preValues)
已过时。
不建议使用,因为框架不知道具体是更改了什么表,会影响缓存的正确性,从而产生缓存数据不准确的危险.
It is not recommended because the framework does not know what table has been changed, which will affect the correctness of the cache and cause the risk of inaccurate cache data. |
List<String[]> |
select(String sql)
通过无参数的sql查询语句数据.Select record(s) via the sql statement.
|
List<String[]> |
select(String sqlStr,
Map<String,Object> map)
查询并将每一行结果转成String数组.Select and transform every record to string array.
|
List<String[]> |
select(String sqlStr,
Map<String,Object> map,
int start,
int size)
查询并将每一行结果转成String数组.Select and transform every record to string array.
|
List<String[]> |
select(String sql,
Object[] preValues)
查询并将每一行结果转成String数组.Select and transform every record to string array.
|
List<String[]> |
select(String sql,
Object[] preValues,
int start,
int size)
查询并将每一行结果转成String数组.Select and transform every record to string array.
|
<T> List<T> |
select(String sqlStr,
T entity,
Map<String,Object> parameterMap)
通过变量的占位语句查询数据.entity和map都可以向参数传递值,map可以作为entity的补充,用于传递范围查询等复杂查询的参数
Select the record(s) via the placeholder statement of variable.Both entity and map can pass values to parameters. |
<T> List<T> |
select(String sqlStr,
T entity,
Map<String,Object> parameterMap,
int start,
int size)
通过变量的占位语句查询数据.entity和map都可以向参数传递值,map可以作为entity的补充,用于传递范围查询等复杂查询的参数
Select the record(s) via the placeholder statement of variable.Both entity and map can pass values to parameters. |
<T> List<T> |
select(String sql,
T returnType,
Object[] preValues)
通过问号的占位语句查询数据.Select record(s) via the placeholder(?)
|
<T> List<T> |
select(String sql,
T returnType,
Object[] preValues,
int start,
int size)
通过问号的占位语句查询数据.Select record(s) via the placeholder(?)
|
String |
selectFun(String sql)
用函数查询结果.Select result with function.
|
String |
selectFun(String sqlStr,
Map<String,Object> map)
用函数查询结果.Select result with function.
|
String |
selectFun(String sql,
Object[] preValues)
用函数查询结果.Select result with function.
|
String |
selectJson(String sqlStr)
查询结果,并以json格式返回.Select and return json format result.
|
String |
selectJson(String sqlStr,
Map<String,Object> map)
查询结果,并以json格式返回.Select and return json format result.
|
String |
selectJson(String sqlStr,
Map<String,Object> map,
int start,
int size)
查询结果,并以json格式返回.Select and return json format result.
|
String |
selectJson(String sql,
Object[] preValues)
用可带问号的占位语句查询结果,并以json格式返回.Select and return json format result.
|
String |
selectJson(String sql,
Object[] preValues,
int start,
int size)
用可带问号的占位语句查询结果,并以json格式返回.Select and return json format result.
|
<T> List<T> |
selectSomeField(String sqlStr,
T entity,
Map<String,Object> parameterMap)
通过变量的占位语句查询数据(只查询部分字段).entity和map都可以向参数传递值,map可以作为entity的补充,用于传递范围查询等复杂查询的参数
Select some column of the record(s) via the placeholder statement of variable.Both entity and map can pass values to parameters. |
<T> List<T> |
selectSomeField(String sqlStr,
T entity,
Map<String,Object> parameterMap,
int start,
int size)
通过变量的占位语句查询数据(只查询部分字段).entity和map都可以向参数传递值,map可以作为entity的补充,用于传递范围查询等复杂查询的参数
Select some column of the record(s) via the placeholder statement of variable.Both entity and map can pass values to parameters. |
<T> List<T> |
selectSomeField(String sql,
T returnType,
Object[] preValues)
通过问号的占位语句查询数据(只查询部分字段)
Select some column of record(s) via the placeholder(?) |
<T> List<T> |
selectSomeField(String sql,
T returnType,
Object[] preValues,
int start,
int size)
通过问号的占位语句查询数据(只查询部分字段)
Select some column of record(s) via the placeholder(?) |
<T> List<T> select(String sql, T returnType, Object[] preValues)
sql - 直接用?作为占位符的sql查询语句.returnType - 返回entity的类型.preValues - 按下标顺序给sql的占位符设值的Object数组.<T> List<T> select(String sql, T returnType, Object[] preValues, int start, int size)
sql - 直接用?作为占位符的sql查询语句.returnType - 返回entity的类型.preValues - 按下标顺序给sql的占位符设值的Object数组.<T> List<T> select(String sqlStr, T entity, Map<String,Object> parameterMap)
eg:select * from orders where userid=#{userid} eg:select * from orders where name like #{name%}
sqlStr - 使用#{para}作为占位符的sql查询语句.entity - entity中非null的值,会转换成map的元素作为参数,entity的字段会自动转成表的列名;entity也将作用返回结构的类型.parameterMap - map结构的参数,通过map的key与sqlStr中变量名对应.
若map有元素的key与从entity转来的一样,会使用map的.<T> List<T> select(String sqlStr, T entity, Map<String,Object> parameterMap, int start, int size)
eg:select * from orders where userid=#{userid} eg:select * from orders where name like #{name%}
sqlStr - 使用#{para}作为占位符的sql查询语句.entity - entity中非null的值,会转换成map的元素作为参数,entity的字段会自动转成表的列名;entity也将作用返回结构的类型.parameterMap - map结构的参数,通过map的key与sqlStr中变量名对应.
若map有元素的key与从entity转来的一样,会使用map的.start - 开始下标(从0或1开始,eg:MySQL是0,Oracle是1). start index,min value is 0 or 1(eg:MySQL is 0,Oracle is 1).size - 结果集大小 大于等于1. fetch result size (>0).<T> List<T> selectSomeField(String sql, T returnType, Object[] preValues)
eg: select * from orders where userid=?
sql - 直接用?作为占位符的sql查询语句.returnType - 返回entity的类型.preValues - 按下标顺序给sql的占位符设值的Object数组.<T> List<T> selectSomeField(String sql, T returnType, Object[] preValues, int start, int size)
eg: select * from orders where userid=?
sql - 直接用?作为占位符的sql查询语句.returnType - 返回entity的类型.preValues - 按下标顺序给sql的占位符设值的Object数组.start - 开始下标(从0或1开始,eg:MySQL是0,Oracle是1). start index,min value is 0 or 1(eg:MySQL is 0,Oracle is 1).size - 结果集大小 大于等于1. fetch result size (>0).<T> List<T> selectSomeField(String sqlStr, T entity, Map<String,Object> parameterMap)
eg:select * from orders where userid=#{userid} eg:select * from orders where name like #{name%}
sqlStr - 使用#{para}作为占位符的sql查询语句.entity - entity中非null的值,会转换成map的元素作为参数,entity的字段会自动转成表的列名;entity也将作用返回结构的类型.parameterMap - map结构的参数,通过map的key与sqlStr中变量名对应.
若map有元素的key与从entity转来的一样,会使用map的.<T> List<T> selectSomeField(String sqlStr, T entity, Map<String,Object> parameterMap, int start, int size)
eg:select * from orders where userid=#{userid} eg:select * from orders where name like #{name%}
sqlStr - 使用#{para}作为占位符的sql查询语句.entity - entity中非null的值,会转换成map的元素作为参数,entity的字段会自动转成表的列名;entity也将作用返回结构的类型.parameterMap - map结构的参数,通过map的key与sqlStr中变量名对应.
若map有元素的key与从entity转来的一样,会使用map的.start - 开始下标(从0或1开始,eg:MySQL是0,Oracle是1). start index,min value is 0 or 1(eg:MySQL is 0,Oracle is 1).size - 结果集大小 大于等于1. fetch result size (>0).String selectFun(String sql, Object[] preValues)
注意:因没有与entity关联,没有应用上缓存. Notice:can not use the cache because don't relay the entity.
sql - SQL select statementpreValues - 按下标顺序给sql的占位符设值的Object数组.String selectFun(String sqlStr, Map<String,Object> map)
注意:因没有与entity关联,没有应用上缓存. Notice:can not use the cache because don't relay the entity.
sqlStr - SQL select statementmap - map结构的参数,通过map的key与sqlStr中变量名对应.List<String[]> select(String sql, Object[] preValues)
注意:因没有与entity关联,没有应用上缓存. Notice:can not use the cache because don't relay the entity.
sql - SQL select statementpreValues - parameter values for placeholderList<String[]> select(String sql, Object[] preValues, int start, int size)
注意:因没有与entity关联,没有应用上缓存. Notice:can not use the cache because don't relay the entity.
因没有与entity关联,在多数据源情况下,只会从默认数据源中获取数据.
Because it is not associated with entity, in the case of multiple Datasources,
will be select the record from the default Datasource.
sql - SQL select statementpreValues - parameter values for placeholderstart - 开始下标(从0或1开始,eg:MySQL是0,Oracle是1). start index,min value is 0 or 1(eg:MySQL is 0,Oracle is 1).size - 结果集大小 大于等于1. fetch result size (>0).List<String[]> select(String sqlStr, Map<String,Object> map)
注意:因没有与entity关联,没有应用上缓存. Notice:can not use the cache because don't relay the entity.
sqlStr - SQL select statementmap - parameter values for placeholderList<String[]> select(String sqlStr, Map<String,Object> map, int start, int size)
注意:因没有与entity关联,没有应用上缓存. Notice:can not use the cache because don't relay the entity.
因没有与entity关联,在多数据源情况下,只会从默认数据源中获取数据.
Because it is not associated with entity, in the case of multiple Datasources,
will be select the record from the default Datasource.
sqlStr - SQL select statementmap - parameter values for placeholderstart - 开始下标(从0或1开始,eg:MySQL是0,Oracle是1). start index,min value is 0 or 1(eg:MySQL is 0,Oracle is 1).size - 结果集大小 大于等于1. fetch result size (>0).String selectJson(String sql, Object[] preValues)
注意:因没有与entity关联,没有应用上缓存. Notice:can not use the cache because don't relay the entity.
sql - SQL select statementpreValues - 占位符对应的参数数组.parameter values for placeholderString selectJson(String sql, Object[] preValues, int start, int size)
注意:因没有与entity关联,没有应用上缓存. Notice:can not use the cache because don't relay the entity.
因没有与entity关联,在多数据源情况下,只会从默认数据源中获取数据.
Because it is not associated with entity, in the case of multiple Datasources,
will be select the record from the default Datasource.
sql - SQL select statementpreValues - 占位符对应的参数数组.parameter values for placeholderstart - 开始下标(从0或1开始,eg:MySQL是0,Oracle是1). start index,min value is 0 or 1(eg:MySQL is 0,Oracle is 1).size - 结果集大小 大于等于1. fetch result size (>0).String selectJson(String sqlStr, Map<String,Object> map)
注意:因没有与entity关联,没有应用上缓存. Notice:can not use the cache because don't relay the entity.
sqlStr - SQL select statementmap - 占位符对应的参数map.parameter values for placeholderString selectJson(String sqlStr, Map<String,Object> map, int start, int size)
注意:因没有与entity关联,没有应用上缓存. Notice:can not use the cache because don't relay the entity.
因没有与entity关联,在多数据源情况下,只会从默认数据源中获取数据.
Because it is not associated with entity, in the case of multiple Datasources,
will be select the record from the default Datasource.
sqlStr - SQL select statementmap - 占位符对应的参数map.parameter values for placeholderstart - 开始下标(从0或1开始,eg:MySQL是0,Oracle是1). start index,min value is 0 or 1(eg:MySQL is 0,Oracle is 1).size - 结果集大小 大于等于1. fetch result size (>0).String selectJson(String sqlStr)
注意:因没有与entity关联,没有应用上缓存. Notice:can not use the cache because don't relay the entity.
sqlStr - 无参数的sql查询语句.SQL select statementList<String[]> select(String sql)
sql - 无参数的sql查询语句.SQL select statementString selectFun(String sql)
注意:因没有与entity关联,没有应用上缓存. Notice:can not use the cache because don't relay the entity.
sql - SQL select statement@Deprecated int modify(String sql, Object[] preValues)
sql - SQL语句.SQL statement.preValues - 占位符对应的参数数组.parameter values for placeholder@Deprecated int modify(String sql, Map<String,Object> map)
sql - SQL语句.SQL statement.map - 占位符对应的参数map.parameter values for placeholder@Deprecated int modify(String sql)
sql - SQL语句.SQL statement.Copyright © 2021. All rights reserved.