
com.anwen.mongo.mapper.BaseMapper Maven / Gradle / Ivy
package com.anwen.mongo.mapper;
import com.anwen.mongo.conditions.aggregate.AggregateChainWrapper;
import com.anwen.mongo.conditions.interfaces.condition.CompareCondition;
import com.anwen.mongo.conditions.query.QueryChainWrapper;
import com.anwen.mongo.conditions.update.UpdateChainWrapper;
import com.anwen.mongo.execute.Execute;
import com.anwen.mongo.execute.ExecutorFactory;
import com.anwen.mongo.manager.MongoPlusClient;
import com.anwen.mongo.model.PageResult;
import com.mongodb.client.model.*;
import org.bson.Document;
import org.bson.conversions.Bson;
import java.io.Serializable;
import java.util.Collection;
import java.util.List;
/**
* mapper层
* TODO 名称待定,方法留CRUD,不同数据库实现该接口
* @author JiaChaoYang
**/
public interface BaseMapper{
MongoPlusClient getMongoPlusClient();
default Execute getExecute(){
return new ExecutorFactory().getExecute();
}
Document processIdField(T entity,Boolean skip);
boolean save(T entity);
Boolean saveBatch(Collection entityList);
Long update(Bson queryBasic,Bson updateBasic,Class> clazz);
Integer bulkWrite(List> writeModelList,Class> clazz);
Boolean update(T entity,QueryChainWrapper queryChainWrapper);
List list(Class clazz);
List list(QueryChainWrapper queryChainWrapper, Class clazz);
List aggregateList(AggregateChainWrapper queryChainWrapper, Class clazz);
T one(QueryChainWrapper queryChainWrapper,Class clazz);
@Deprecated
T limitOne(QueryChainWrapper queryChainWrapper,Class clazz);
PageResult page(QueryChainWrapper queryChainWrapper, Integer pageNum, Integer pageSize, Class clazz);
List pageList(QueryChainWrapper queryChainWrapper, Integer pageNum, Integer pageSize, Class clazz);
PageResult page(QueryChainWrapper queryChainWrapper, Integer pageNum, Integer pageSize, Integer recentPageNum, Class clazz);
T getById(Serializable id,Class clazz);
boolean isExist(Serializable id,Class> clazz);
boolean isExist(QueryChainWrapper,?> queryChainWrapper,Class> clazz);
List getByIds(Collection extends Serializable> ids,Class clazz);
Boolean update(UpdateChainWrapper, ?> updateChainWrapper, Class> clazz);
Boolean remove(UpdateChainWrapper, ?> updateChainWrapper, Class> clazz);
Long remove(Bson filter,Class> clazz);
long count(QueryChainWrapper, ?> queryChainWrapper,Class> clazz);
long recentPageCount(List compareConditionList,Class> clazz, Integer pageNum, Integer pageSize, Integer recentPageNum);
long count(Class> clazz);
List queryCommand(String command,Class clazz);
List getByColumn(String column,Object value,Class clazz);
String createIndex(Bson bson,Class> clazz);
String createIndex(Bson bson, IndexOptions indexOptions, Class> clazz);
List createIndexes(List indexes,Class> clazz);
List createIndexes(List indexes, CreateIndexOptions createIndexOptions,Class> clazz);
List listIndexes(Class> clazz);
void dropIndex(String indexName,Class> clazz);
void dropIndex(String indexName,DropIndexOptions dropIndexOptions,Class> clazz);
void dropIndex(Bson keys,Class> clazz);
void dropIndex(Bson keys,DropIndexOptions dropIndexOptions,Class> clazz);
void dropIndexes(Class> clazz);
void dropIndexes(DropIndexOptions dropIndexOptions,Class> clazz);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy