All Downloads are FREE. Search and download functionalities are using the official Maven repository.
Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
org.noear.wood.BaseMapper Maven / Gradle / Ivy
package org.noear.wood;
import org.noear.wood.ext.Act1;
import org.noear.wood.ext.Act2;
import org.noear.wood.wrap.Property;
import java.util.List;
import java.util.Map;
/**
* @author noear
*/
public interface BaseMapper {
/**
* 当前数据源
*/
DbContext db();
/**
* 当前表名
*/
String tableName();
/**
* 当前表主键
*/
String tablePk();
/**
* 当前实体类
*/
Class> entityClz();
/**
* 插入数据,根据excludeNull决定是否要拼接值为null的数据
* @param entity 写入的实体
* @param excludeNull 是否排除null属性
* @return
*/
Long insert(T entity, boolean excludeNull);
/**
* 插入数据,由外部组装数据
* @param entity 写入的实体
* @param dataBuilder 数据组装器
* @return
*/
Long insert(T entity, Act2 dataBuilder);
/**
* 批量插入数据
* @param list
*/
void insertList(List list);
/**
* 批量插入数据
* @param list 待插入的数据
* @param dataBuilder 数据组装器
*/
void insertList(List list, Act2 dataBuilder);
Integer deleteById(Object id);
Integer deleteByIds(Iterable idList);
Integer deleteByMap(Map columnMap);
Integer delete(Act1 condition);
/**
* @param excludeNull 排除null
*/
Integer updateById(T entity, boolean excludeNull);
/**
* @param entity 待更新的实体
* @param dataBuilder 组装data的方式,方便支持部分属性允许设置为null,部分不允许
*/
Integer updateById(T entity, Act2 dataBuilder);
Integer update(T entity, boolean excludeNull, Act1 condition);
/**
* @param entity 待更新的实体
* @param dataBuilder 组装data的方式,方便支持部分属性允许设置为null,部分不允许
* @param condition 更新数据的条件
* @return
*/
Integer update(T entity, Act2 dataBuilder, Act1 condition);
int[] updateList(List list, Act2 dataBuilder, Property... conditionFields);
/**
* 新增或修改数据 更新时根据主键更新
* @param entity 要处理的实体
* @param excludeNull 是否排除null值
* @return
*/
Long upsert(T entity, boolean excludeNull);
/**
* 新增或修改数据 更新时根据主键更新
* @param entity 要处理的实体
* @param dataBuilder 数据组装器
* @return
*/
Long upsert(T entity, Act2 dataBuilder);
/**
* 新增或修改数据 更新时根据条件字段更新
* @param entity 要处理的实体
* @param excludeNull 是否排除null值
* @param conditionFields 更新的条件
* @return
*/
Long upsertBy(T entity, boolean excludeNull, String conditionFields);
/**
* 新增或修改数据 更新时根据条件字段更新
* @param entity 要处理的实体
* @param dataBuilder 数据组装器
* @param conditionFields 更新的条件
* @return
*/
Long upsertBy(T entity, Act2 dataBuilder, String conditionFields);
boolean existsById(Object id);
boolean exists(Act1 condition);
T selectById(Object id);
List selectByIds(Iterable idList);
List selectByMap(Map columnMap);
T selectItem(T entity);
T selectItem(Act1 condition);
Map selectMap(Act1 condition);
Object selectValue(String column, Act1 condition);
Long selectCount(Act1 condition);
List selectList(Act1 condition);
List> selectMapList(Act1 condition);
List selectArray(String column, Act1 condition);
List selectList(int start, int size, Act1 condition);
List> selectMapList(int start, int size, Act1 condition);
List selectArray(String column, int start, int size, Act1 condition);
IDataReader selectReader(Act1 condition);
IDataReader selectReader(int fetchSize, Act1 condition);
/**
* @param start 从0开始
*/
IPage selectPage(int start, int size, Act1 condition);
IPage> selectMapPage(int start, int size, Act1 condition);
List selectTop(int size, Act1 condition);
List> selectMapTop(int size, Act1 condition);
}