public class AnsiDialect extends DbBase implements Dialect
Modifier and Type | Field and Description |
---|---|
protected JdbcProperties |
jdbcProperties |
protected org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate |
namedParameterJdbcTemplate |
protected Wrapper |
wrapper |
Constructor and Description |
---|
AnsiDialect(org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate namedParameterJdbcTemplate,
JdbcProperties jdbcProperties) |
Modifier and Type | Method and Description |
---|---|
AnsiDialect |
clone() |
Dialect |
cloneDialect()
克隆方言
|
DialectNameEnum |
dialectName()
方言名
|
String |
getPageJoinSql()
获得用于SQL字符串拼接的SQL分页字符串
|
Long |
insertOrUpdate(String tableName,
com.alibaba.fastjson.JSONObject paramJson,
String[] conditions,
DbUpdateEnum dBUpdateEnum)
插入或更新
表中必须存在数据唯一性约束
|
<T> PageVO<T> |
page(String tableName,
PageIPO pageIPO,
SortEnum sortEnum,
Class<T> mappedClass)
单表分页查询
|
<T> PageVO<T> |
pageSql(String querySql,
PageIPO pageIPO,
Class<T> mappedClass)
复杂SQL分页查询
|
<T> PageVO<T> |
pageSql(String countSql,
String querySql,
PageIPO pageIPO,
Class<T> mappedClass)
复杂SQL分页查询
|
<T> PageVO<T> |
pageWhere(String tableName,
String whereSql,
PageIPO pageIPO,
Class<T> mappedClass)
单表分页查询
|
Page |
toPage(PageIPO pageIPO)
转换为经过方言处理的分页查询参数,用于SQL分页查询
|
aopAfter, aopAfter, aopAfter, aopBefore, aopBefore, audit, extractTables, getDataSource, getDeleteWhereSql, getJdbcProperties, getJdbcTemplate, getNamedParameterJdbcTemplate, getRowMapper, isDataSize, isUpdateAndExpectedEqual, isUpdateAndExpectedGreaterThanEqual, listResultToGetResult, paramFormat, paramToWhereSql, paramToWhereSql, paramValidate, paramValidate, paramValidate, paramValidate, paramValidate, paramValidate, paramValidate, paramValidate, queryForJson, queryForList, queryForList, queryForObject, queryForRowSet, resultToJson, resultToObject, setDataSource, updateAndExpectedEqual, updateAndExpectedGreaterThanEqual, updateBatchAndExpectedEqual
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getJdbcProperties, getNamedParameterJdbcTemplate, getWrapper, setJdbcProperties, setNamedParameterJdbcTemplate, setWrapper
protected Wrapper wrapper
protected JdbcProperties jdbcProperties
protected org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate namedParameterJdbcTemplate
public AnsiDialect(org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate namedParameterJdbcTemplate, JdbcProperties jdbcProperties)
public Dialect cloneDialect()
Dialect
cloneDialect
in interface Dialect
public AnsiDialect clone()
public DialectNameEnum dialectName()
Dialect
dialectName
in interface Dialect
public String getPageJoinSql()
默认实现MySQL标准,如:
getPageJoinSql
in interface Dialect
public Long insertOrUpdate(String tableName, com.alibaba.fastjson.JSONObject paramJson, String[] conditions, DbUpdateEnum dBUpdateEnum)
Dialect
更新触发条件:此数据若存在唯一性约束则更新,否则便执行插入数据
MySQL执行示例:
INSERT INTO table (param1, param2, ...)
VALUES
(:param1, :param2, ...)
ON DUPLICATE KEY UPDATE
condition = condition + :condition, ...
insertOrUpdate
in interface Dialect
tableName
- 表名paramJson
- 插入或更新所用到的参数conditions
- 更新条件(对应paramJson内的key值)dBUpdateEnum
- 更新类型 DbUpdateEnumpublic Page toPage(PageIPO pageIPO)
Dialect
public <T> PageVO<T> page(String tableName, PageIPO pageIPO, SortEnum sortEnum, Class<T> mappedClass)
Dialect
阿里最优SQL示例:
SELECT a.* FROM 表1 a, (select id from 表1 where 条件 ORDER BY id LIMIT 100000,20 ) b where a.id=b.id
public <T> PageVO<T> pageWhere(String tableName, String whereSql, PageIPO pageIPO, Class<T> mappedClass)
Dialect
阿里最优SQL示例:
SELECT a.* FROM 表1 a, (select id from 表1 where 条件 LIMIT 100000,20 ) b where a.id=b.id
public <T> PageVO<T> pageSql(String querySql, PageIPO pageIPO, Class<T> mappedClass)
Dialect
阿里最优查询SQL示例:
SELECT a.* FROM 表1 a, (select id from 表1 where 条件 LIMIT :page, :limit) b where a.id=b.id
public <T> PageVO<T> pageSql(@Nullable String countSql, String querySql, PageIPO pageIPO, Class<T> mappedClass)
Dialect
统计SQL示例:
SELECT count(*) count FROM 表1 a, (select id from 表1 where 条件) b where a.id=b.id
阿里最优查询SQL示例:
SELECT a.* FROM 表1 a, (select id from 表1 where 条件 LIMIT :page, :limit) b where a.id=b.id
Copyright © 2022 Pivotal Software, Inc.. All rights reserved.