Class UpdateSqlBuilder
java.lang.Object
cn.dinodev.spring.data.sql.builder.WhereSql<UpdateSqlBuilder>
cn.dinodev.spring.data.sql.builder.UpdateSqlBuilder
- All Implemented Interfaces:
SqlBuilder
SQL UPDATE语句构建器
用于构建UPDATE SQL语句的Builder类,支持SET子句和WHERE条件等
- Author:
- Cody Lu
-
Field Summary
Fields inherited from class cn.dinodev.spring.data.sql.builder.WhereSql
EMPTY_PARAMS, tables, whereColumns, whereParams, withName, withSql -
Method Summary
Modifier and TypeMethodDescriptionstatic UpdateSqlBuilder根据表名创建UPDATE语句构建器static UpdateSqlBuilder根据表名和别名创建UPDATE语句构建器Object[]获取sql语句需要的参数数组getSql()获取生成的sql语句设置列的更新表达式(不添加参数)设置列的更新值根据条件设置列的更新表达式(不添加参数)根据条件设置列的更新值setIfNotNull(String expr, Object value) 当值不为null时设置列的更新值toString()Methods inherited from class cn.dinodev.spring.data.sql.builder.WhereSql
and, and, and, andIf, andIf, andIfNotNull, andIfNotNull, any, any, between, between, endWith, endWith, eq, eqIf, eqIfNotBlank, eqIfNotNull, in, in, in, in, inIf, inIf, isNotNull, isNotNull, isNotNullIf, isNotNullIf, isNull, isNull, isNullIf, isNullIf, like, like, ne, neIf, neIfNotBlank, neIfNotNull, notIn, notIn, notIn, notIn, or, or, or, orIf, orIf, orIfNotNull, orIfNotNull, setThat, some, some, someEndWith, someEndWith, someIf, someIf, someLike, someLike, someStartWith, someStartWith, startWith, startWith, table, where, where, where, whereIf, whereIf, whereIfNotNull, whereIfNotNull, withMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface cn.dinodev.spring.data.sql.SqlBuilder
appendList, appendList
-
Method Details
-
create
根据表名创建UPDATE语句构建器支持的格式:
-
"table1"-
"table1 as t1"- Parameters:
table- 表名- Returns:
- 配置好的UpdateSqlBuilder实例
-
create
根据表名和别名创建UPDATE语句构建器生成的sql片段为:table AS alias
- Parameters:
table- 表名alias- 表别名- Returns:
- 配置好的UpdateSqlBuilder实例
-
set
设置列的更新值- Parameters:
expr- 列表达式,可以包含?占位符value- 参数值- Returns:
- 当前构建器实例
-
setIf
根据条件设置列的更新值- Parameters:
cnd- 条件,为true时才设置expr- 列表达式value- 参数值- Returns:
- 当前构建器实例
-
setIfNotNull
当值不为null时设置列的更新值- Parameters:
expr- 列表达式value- 参数值- Returns:
- 当前构建器实例
-
set
设置列的更新表达式(不添加参数)- Parameters:
expr- 列表达式- Returns:
- 当前构建器实例
-
setIf
根据条件设置列的更新表达式(不添加参数)- Parameters:
cnd- 条件,为true时才设置expr- 列表达式- Returns:
- 当前构建器实例
-
getSql
Description copied from interface:SqlBuilder获取生成的sql语句- Returns:
-
getParams
Description copied from interface:SqlBuilder获取sql语句需要的参数数组- Returns:
-
toString
-