public class BaseEsMapperImpl<T> extends Object implements BaseEsMapper<T>
内部实现:
核心网络请求类:RestHighLevelClient、
动态封装request类:WrapperProcessor、
查询类型枚举:EsQueryTypeEnum、
| 构造器和说明 |
|---|
BaseEsMapperImpl() |
| 限定符和类型 | 方法和说明 |
|---|---|
Boolean |
createIndex()
创建索引,根据当前mapper对应实体类信息及其注解配置生成索引信息
|
Boolean |
createIndex(String indexName)
创建索引,根据当前mapper对应实体类信息及其注解配置生成索引信息 可指定索引名进行创建 适用于定时任务按日期创建索引场景
|
Boolean |
createIndex(Wrapper<T> wrapper)
创建索引
|
Integer |
delete(Wrapper<T> wrapper)
根据 entity 条件,删除记录
|
Integer |
deleteBatchIds(Collection<? extends Serializable> idList)
删除(根据ID 批量删除)
|
Integer |
deleteBatchIds(Collection<? extends Serializable> idList,
String... indexNames)
删除(根据ID 批量删除)
|
Integer |
deleteById(Serializable id)
根据 ID 删除
|
Integer |
deleteById(Serializable id,
String... indexNames)
根据 ID 删除
|
Boolean |
deleteIndex(String... indexNames)
删除指定索引
|
String |
executeDSL(String dsl)
执行静态dsl语句 不传索引名,默认为当前mapper对应索引
|
String |
executeDSL(String dsl,
String indexName)
执行静态dsl语句 可指定作用的索引
|
String |
executeSQL(String sql)
执行SQL语句
|
Boolean |
existsIndex(String indexName)
是否存在索引
|
org.elasticsearch.client.indices.GetIndexResponse |
getIndex()
获取当前索引信息
|
org.elasticsearch.client.indices.GetIndexResponse |
getIndex(String indexName)
获取指定索引信息
|
org.elasticsearch.search.builder.SearchSourceBuilder |
getSearchSourceBuilder(Wrapper<T> wrapper)
获取SearchSourceBuilder,可用于本框架生成基础查询条件,不支持的高阶语法用户可通过SearchSourceBuilder 进一步封装
|
String |
getSource(Wrapper<T> wrapper)
获取通过本框架生成的查询参数,可用于检验本框架生成的查询参数是否正确
|
Integer |
insert(T entity)
插入一条记录
|
Integer |
insert(T entity,
String... indexNames)
插入一条记录,可指定多索引插入
|
Integer |
insertBatch(Collection<T> entityList)
批量插入
|
Integer |
insertBatch(Collection<T> entityList,
String... indexNames)
批量插入
|
EsPageInfo<T> |
pageQuery(Wrapper<T> wrapper,
Integer pageNum,
Integer pageSize)
指定返回类型及分页参数
|
Boolean |
refresh()
刷新索引
|
Boolean |
refresh(String... indexNames)
刷新指定索引
|
org.elasticsearch.action.search.SearchResponse |
scroll(org.elasticsearch.action.search.SearchScrollRequest searchScrollRequest,
org.elasticsearch.client.RequestOptions requestOptions)
es原生滚动查询
|
org.elasticsearch.action.search.SearchResponse |
search(org.elasticsearch.action.search.SearchRequest searchRequest,
org.elasticsearch.client.RequestOptions requestOptions)
es原生查询
|
org.elasticsearch.action.search.SearchResponse |
search(Wrapper<T> wrapper)
混合查询
|
SAPageInfo<T> |
searchAfterPage(Wrapper<T> wrapper,
List<Object> searchAfter,
Integer pageSize)
searchAfter类型分页
|
List<T> |
selectBatchIds(Collection<? extends Serializable> idList)
查询(根据ID 批量查询)
|
List<T> |
selectBatchIds(Collection<? extends Serializable> idList,
String... indexNames)
查询(根据ID 批量查询)
|
T |
selectById(Serializable id)
根据 ID 查询
|
T |
selectById(Serializable id,
String... indexNames)
根据 ID 查询
|
Long |
selectCount(Wrapper<T> wrapper)
获取总数(智能推断:若wrapper中指定了去重字段则去重,若未指定则不去重 推荐使用)
|
Long |
selectCount(Wrapper<T> wrapper,
boolean distinct)
无论wrapper中是否指定去重字段,都以用户传入的distinct布尔值作为是否去重的条件
|
List<T> |
selectList(Wrapper<T> wrapper)
根据 entity 条件,查询全部记录
|
T |
selectOne(Wrapper<T> wrapper)
根据 entity 条件,查询一条记录
|
Boolean |
setCurrentActiveIndex(String indexName)
设置当前Mapper默认激活的全局索引名称 务必谨慎操作,设置后全局生效,永驻jvm,除非项目重启
|
Integer |
update(T entity,
Wrapper<T> updateWrapper)
根据 whereEntity 条件,更新记录
|
Integer |
updateBatchByIds(Collection<T> entityList)
根据ID 批量更新
|
Integer |
updateBatchByIds(Collection<T> entityList,
String... indexNames)
根据ID 批量更新
|
Integer |
updateById(T entity)
根据 ID 更新
|
Integer |
updateById(T entity,
String... indexNames)
根据 ID 更新
|
Boolean |
updateIndex(Wrapper<T> wrapper)
更新索引
|
public Boolean existsIndex(String indexName)
BaseEsMapperexistsIndex 在接口中 BaseEsMapper<T>indexName - 索引名称public org.elasticsearch.client.indices.GetIndexResponse getIndex()
BaseEsMappergetIndex 在接口中 BaseEsMapper<T>public org.elasticsearch.client.indices.GetIndexResponse getIndex(String indexName)
BaseEsMappergetIndex 在接口中 BaseEsMapper<T>indexName - 指定索引名public Boolean createIndex()
BaseEsMappercreateIndex 在接口中 BaseEsMapper<T>public Boolean createIndex(String indexName)
BaseEsMappercreateIndex 在接口中 BaseEsMapper<T>indexName - 指定的索引名,会覆盖注解上指定的索引名public Boolean createIndex(Wrapper<T> wrapper)
BaseEsMappercreateIndex 在接口中 BaseEsMapper<T>wrapper - 条件public Boolean updateIndex(Wrapper<T> wrapper)
BaseEsMapperupdateIndex 在接口中 BaseEsMapper<T>wrapper - 条件public Boolean deleteIndex(String... indexNames)
BaseEsMapperdeleteIndex 在接口中 BaseEsMapper<T>indexNames - 索引名称数组public Boolean refresh()
BaseEsMapperrefresh 在接口中 BaseEsMapper<T>public Boolean refresh(String... indexNames)
BaseEsMapperrefresh 在接口中 BaseEsMapper<T>indexNames - 索引名称public String executeSQL(String sql)
BaseEsMapperexecuteSQL 在接口中 BaseEsMapper<T>sql - 被执行的sql语句public String executeDSL(String dsl)
BaseEsMapperexecuteDSL 在接口中 BaseEsMapper<T>dsl - dsl语句public String executeDSL(String dsl, String indexName)
BaseEsMapperexecuteDSL 在接口中 BaseEsMapper<T>dsl - dsl语句indexName - 作用的索引名public org.elasticsearch.action.search.SearchResponse search(Wrapper<T> wrapper)
BaseEsMappersearch 在接口中 BaseEsMapper<T>wrapper - 条件public org.elasticsearch.action.search.SearchResponse search(org.elasticsearch.action.search.SearchRequest searchRequest,
org.elasticsearch.client.RequestOptions requestOptions)
throws IOException
BaseEsMappersearch 在接口中 BaseEsMapper<T>searchRequest - 查询请求参数requestOptions - 类型IOException - IO异常public org.elasticsearch.action.search.SearchResponse scroll(org.elasticsearch.action.search.SearchScrollRequest searchScrollRequest,
org.elasticsearch.client.RequestOptions requestOptions)
throws IOException
BaseEsMapperscroll 在接口中 BaseEsMapper<T>searchScrollRequest - 查询请求参数requestOptions - 类型IOException - IO异常public org.elasticsearch.search.builder.SearchSourceBuilder getSearchSourceBuilder(Wrapper<T> wrapper)
BaseEsMappergetSearchSourceBuilder 在接口中 BaseEsMapper<T>wrapper - 条件public String getSource(Wrapper<T> wrapper)
BaseEsMappergetSource 在接口中 BaseEsMapper<T>wrapper - 条件public EsPageInfo<T> pageQuery(Wrapper<T> wrapper, Integer pageNum, Integer pageSize)
BaseEsMapperpageQuery 在接口中 BaseEsMapper<T>wrapper - 条件pageNum - 当前页pageSize - 每页条数public SAPageInfo<T> searchAfterPage(Wrapper<T> wrapper, List<Object> searchAfter, Integer pageSize)
BaseEsMappersearchAfterPage 在接口中 BaseEsMapper<T>wrapper - 条件searchAfter - 当前页 第一页时为nullpageSize - 每页条数public Long selectCount(Wrapper<T> wrapper)
BaseEsMapperselectCount 在接口中 BaseEsMapper<T>wrapper - 条件public Long selectCount(Wrapper<T> wrapper, boolean distinct)
BaseEsMapperselectCount 在接口中 BaseEsMapper<T>wrapper - 条件distinct - 是否去重public Integer insert(T entity)
BaseEsMapperinsert 在接口中 BaseEsMapper<T>entity - 插入的数据对象public Integer insert(T entity, String... indexNames)
BaseEsMapperinsert 在接口中 BaseEsMapper<T>entity - 插入的数据对象indexNames - 指定插入的索引名数组public Integer insertBatch(Collection<T> entityList)
BaseEsMapperinsertBatch 在接口中 BaseEsMapper<T>entityList - 插入的数据对象列表public Integer insertBatch(Collection<T> entityList, String... indexNames)
BaseEsMapperinsertBatch 在接口中 BaseEsMapper<T>entityList - 插入的数据对象列表indexNames - 指定插入的索引名数组public Integer deleteById(Serializable id)
BaseEsMapperdeleteById 在接口中 BaseEsMapper<T>id - 主键public Integer deleteById(Serializable id, String... indexNames)
BaseEsMapperdeleteById 在接口中 BaseEsMapper<T>id - 主键indexNames - 指定删除的索引名数组public Integer deleteBatchIds(Collection<? extends Serializable> idList)
BaseEsMapperdeleteBatchIds 在接口中 BaseEsMapper<T>idList - 主键列表public Integer deleteBatchIds(Collection<? extends Serializable> idList, String... indexNames)
BaseEsMapperdeleteBatchIds 在接口中 BaseEsMapper<T>idList - 主键列表indexNames - 指定删除的索引名数组public Integer delete(Wrapper<T> wrapper)
BaseEsMapperdelete 在接口中 BaseEsMapper<T>wrapper - 条件public Integer updateById(T entity)
BaseEsMapperupdateById 在接口中 BaseEsMapper<T>entity - 更新对象public Integer updateById(T entity, String... indexNames)
BaseEsMapperupdateById 在接口中 BaseEsMapper<T>entity - 更新对象indexNames - 指定更新的索引名称数组public Integer updateBatchByIds(Collection<T> entityList)
BaseEsMapperupdateBatchByIds 在接口中 BaseEsMapper<T>entityList - 更新对象列表public Integer updateBatchByIds(Collection<T> entityList, String... indexNames)
BaseEsMapperupdateBatchByIds 在接口中 BaseEsMapper<T>entityList - 更新对象列表indexNames - 指定更新的索引名称数组public Integer update(T entity, Wrapper<T> updateWrapper)
BaseEsMapperupdate 在接口中 BaseEsMapper<T>entity - 更新对象updateWrapper - 条件public T selectById(Serializable id)
BaseEsMapperselectById 在接口中 BaseEsMapper<T>id - 主键public T selectById(Serializable id, String... indexNames)
BaseEsMapperselectById 在接口中 BaseEsMapper<T>id - 主键indexNames - 指定查询的索引名数组public List<T> selectBatchIds(Collection<? extends Serializable> idList)
BaseEsMapperselectBatchIds 在接口中 BaseEsMapper<T>idList - 主键列表public List<T> selectBatchIds(Collection<? extends Serializable> idList, String... indexNames)
BaseEsMapperselectBatchIds 在接口中 BaseEsMapper<T>idList - 主键列表indexNames - 指定查询的索引名数组public T selectOne(Wrapper<T> wrapper)
BaseEsMapperselectOne 在接口中 BaseEsMapper<T>wrapper - 条件public List<T> selectList(Wrapper<T> wrapper)
BaseEsMapperselectList 在接口中 BaseEsMapper<T>wrapper - 条件public Boolean setCurrentActiveIndex(String indexName)
BaseEsMappersetCurrentActiveIndex 在接口中 BaseEsMapper<T>indexName - 索引名称Copyright © 2023. All rights reserved.