| 构造器和说明 |
|---|
BaseSqlProvider() |
| 限定符和类型 | 方法和说明 |
|---|---|
protected abstract List<String> |
allFields(boolean withPk)
所有字段列表(以逗号隔开)
|
static String |
batchCrud(Map map)
批量更新, 插入, 删除操作语句构造
IEntityMapper.batchCrud(BatchCrud) |
String |
buildDeleteSql(WrapperData ew,
boolean isLogic)
根据WrapperData设置构建删除语句
|
static String |
buildInsertSelect(DbType dbType,
String tableName,
String[] fields,
IQuery query) |
String |
buildInsertSql(String prefix,
E entity,
boolean withPk)
构建插入语句
|
String |
buildUpdaterSql(WrapperData ew)
根据WrapperData设置构建更新语句
|
protected void |
checkUpdateVersionWhere(List<String> wheres)
更新时, 检查乐观锁字段条件是否设置
|
String |
count(Map map)
count(IQuery) SQL构造
|
String |
countNoLimit(Map map)
去掉limit部分 count(IQuery) SQL构造
|
protected abstract DbType |
dbType()
数据库类型
|
String |
delete(Map map)
根据动态查询条件物理删除数据SQL构造
|
String |
deleteById(Map map)
根据主键物理删除数据SQL构造
|
String |
deleteByIds(Map map)
根据主键列表物理删除数据SQL构造
|
String |
deleteByMap(Map<String,Object> map)
按map删除数据SQL构造
|
String |
findById(Serializable id)
根据主键查找数据SQL构造
|
String |
findOne(Map map)
根据动态条件查询一条记录SQL构造
|
String |
insert(E entity)
插入id未赋值的entity
|
String |
insertBatch(Map map) |
protected abstract List<String> |
insertBatchEntity(int index,
E entity,
boolean withPk)
批量插入时,第index个实例VALUES SQL构造
|
String |
insertBatchWithPk(Map map) |
protected abstract void |
insertEntity(InsertList inserts,
String prefix,
E entity,
boolean withPk)
单个插入时, insert字段和值
|
String |
insertSelect(Map map)
|
String |
insertWithPk(E entity)
插入id已赋值的entity
|
String |
listByIds(Map map)
根据Id列表查询数据SQL构造
|
String |
listByMap(Map map)
根据Map查询数据SQL构造
|
String |
listEntity(Map map)
根据动态条件查询Entity SQL构造
|
String |
listMaps(Map map)
根据动态条件查询Map列表 SQL构造
|
String |
listObjs(Map map)
根据动态条件查询单列数据列表 SQL构造
|
String |
logicDelete(Map map)
根据动态查询条件逻辑删除数据SQL构造
|
String |
logicDeleteById(Map map)
根据主键逻辑删除数据SQL构造
|
String |
logicDeleteByIds(Map map)
根据主键列表逻辑删除数据SQL构造
|
String |
logicDeleteByMap(Map<String,Object> map)
按map逻辑删除数据SQL构造
|
protected abstract boolean |
longTypeOfLogicDelete()
逻辑删除字段是否为 Long 型
|
protected abstract IMapping |
mapping()
获取字段映射关系
|
protected abstract boolean |
primaryIsNull(E entity)
entity无主键或者主键值为null
|
protected abstract boolean |
primaryNotNull(E entity)
entity无主键或者主键有值
|
protected abstract void |
setEntityByDefault(IEntity entity)
|
protected abstract String |
tableName()
返回表名
|
String |
updateBy(Map<String,Object> map)
update(IQuery) SQL构造
|
protected abstract List<String> |
updateDefaults(Map<String,String> updates,
boolean ignoreLockVersion)
构造updates中没有显式设置的默认值构造
|
public static String batchCrud(Map map)
IEntityMapper.batchCrud(BatchCrud)map - k-v条件public static String buildInsertSelect(DbType dbType, String tableName, String[] fields, IQuery query)
protected abstract void insertEntity(InsertList inserts, String prefix, E entity, boolean withPk)
inserts - 插入字段值对entity - 实体实例withPk - true:with id; false: without idprotected abstract List<String> insertBatchEntity(int index, E entity, boolean withPk)
index - 序号entity - 实例withPk - true:with id; false: without idprotected abstract boolean primaryIsNull(E entity)
entity - 实体实例protected abstract boolean primaryNotNull(E entity)
entity - 实体实例public String countNoLimit(Map map)
map - k-v条件public String findById(Serializable id)
id - 主键public String logicDeleteByIds(Map map)
map - k-v条件public String deleteByMap(Map<String,Object> map)
map - k-v条件public String logicDeleteByMap(Map<String,Object> map)
map - k-v条件public String updateBy(Map<String,Object> map)
map - k-v条件protected abstract void setEntityByDefault(IEntity entity)
entity - 实体实例protected abstract List<String> updateDefaults(Map<String,String> updates, boolean ignoreLockVersion)
updates - 显式update字段public String buildInsertSql(String prefix, E entity, boolean withPk)
prefix - entity变量前缀entity - 实体实例withPk - 包含主键?public String buildUpdaterSql(WrapperData ew)
ew - 更新/查询 构造数据protected void checkUpdateVersionWhere(List<String> wheres)
public String buildDeleteSql(WrapperData ew, boolean isLogic)
ew - 更新/查询 构造数据protected abstract DbType dbType()
protected abstract String tableName()
protected abstract List<String> allFields(boolean withPk)
withPk - 是否包含主键字段protected abstract IMapping mapping()
protected abstract boolean longTypeOfLogicDelete()
Copyright © 2021. All rights reserved.