@Import(value=GeneralMapperBootstrapConfiguration.class) public class GeneralMapper extends Object
| 构造器和说明 |
|---|
GeneralMapper() |
GeneralMapper(org.apache.ibatis.session.SqlSessionFactory sqlSessionFactory) |
| 限定符和类型 | 方法和说明 |
|---|---|
Map<String,Object> |
asParam(String paramName,
Object obj)
Put GeneralEntityWrapper.paramNameValuePairs to paramMap if
obj is GeneralEntityWrapper. |
int |
deleteBatchIds(List<?> idList,
Class<?> clazz)
删除(根据ID 批量删除)
|
int |
deleteByEW(GeneralEntityWrapper<?> entityWrapper)
根据EntityWrapper条件删除记录
|
int |
deleteById(Object id,
Class<?> clazz)
根据 ID 删除
|
int |
deleteByMap(Map<String,Object> columnMap,
Class<?> clazz)
根据 columnMap 条件,删除记录
|
int |
deleteSelective(Object entity)
根据 entity 条件,删除记录
|
protected Class<?> |
getCorrespondingEntityClass(Class<?> clazz)
V1.8: Update
generalmapper helps to scan sub-entities. |
int |
insert(Object entity)
插入一条记录 Insert one record.
|
int |
insertBatch(List<?> entityList)
插入(批量) Insert batch(current version only support mysql/oracle)
|
int |
insertSelective(Object entity)
插入一条记录(选择字段, null 字段不插入) Insert one record, null column will be
ignored(if DB column has default value, then value of the DB record will
be the default value)
|
<T> List<T> |
selectBatchIds(List<?> idList,
Class<T> clazz)
查询(根据ID 批量查询)
|
<T> T |
selectById(Object id,
Class<T> clazz)
根据 ID 查询
|
<T> List<T> |
selectByMap(Map<String,Object> columnMap,
Class<T> clazz)
查询(根据 columnMap 条件)
|
int |
selectCount(Object entity)
根据 entity 条件,查询总记录数
|
<T> int |
selectCountByEW(GeneralEntityWrapper<T> entityWrapper)
Select count by entityWrapper.
|
<T> List<T> |
selectList(GeneralEntityWrapper<T> entityWrapper)
根据 entity 条件,查询全部记录
|
<T> T |
selectOne(T entity)
根据 entity 条件,查询一条记录
|
<T> List<T> |
selectPage(com.baomidou.mybatisplus.plugins.pagination.Pagination page,
GeneralEntityWrapper<T> entityWrapper)
根据 entity 条件,查询全部记录(并翻页)
|
void |
setSqlSessionFactory(org.apache.ibatis.session.SqlSessionFactory sqlSessionFactory) |
int |
update(Object entity,
Object whereEntity)
根据 whereEntity 条件,更新记录
|
int |
updateBatchById(List<?> entityList)
根据ID 批量更新
|
int |
updateById(Object entity)
根据 ID 修改
|
int |
updateSelective(Object entity,
Object whereEntity)
根据 whereEntity 条件,选择更新记录 Update record(s) by where entity(by property
values which is not null)
|
int |
updateSelectiveById(Object entity)
根据 ID 选择修改(NULL value fields will be ignored)
|
protected <T> List<T> |
wrapResult(List<T> list,
Class<?> entityClazz)
Convert EntityList to Entity Sub-class List.
|
protected <T> List<T> |
wrapResult(List<T> list,
GeneralEntityWrapper<T> entityWrapper)
如果用EntityVO extends Entity查询,把EntityList 包装成 EntityVOList
|
protected <T> T |
wrapResult(T result,
Class<?> entityClazz)
Convert Entity Result to Entity Sub-class if needed.
|
public GeneralMapper()
public GeneralMapper(org.apache.ibatis.session.SqlSessionFactory sqlSessionFactory)
public void setSqlSessionFactory(org.apache.ibatis.session.SqlSessionFactory sqlSessionFactory)
public int insert(Object entity)
@TableId
IdType:
entity - 实体对象public int insertSelective(Object entity)
插入一条记录(选择字段, null 字段不插入) Insert one record, null column will be ignored(if DB column has default value, then value of the DB record will be the default value)
entity - 实体对象public int insertBatch(List<?> entityList)
插入(批量) Insert batch(current version only support mysql/oracle)
entityList - 实体对象列表public int deleteById(Object id, Class<?> clazz)
根据 ID 删除
id - 主键IDclazz - 对象类型public int deleteByEW(GeneralEntityWrapper<?> entityWrapper)
根据EntityWrapper条件删除记录
entityWrapper - 条件封装(必须setEntity)public int deleteByMap(Map<String,Object> columnMap, Class<?> clazz)
根据 columnMap 条件,删除记录
columnMap - 表字段 map 对象clazz - 对象类型public int deleteSelective(Object entity)
根据 entity 条件,删除记录
entity - 实体对象public int deleteBatchIds(List<?> idList, Class<?> clazz)
删除(根据ID 批量删除)
idList - 主键ID列表clazz - 对象类型public int updateById(Object entity)
根据 ID 修改
entity - 实体对象public int updateSelectiveById(Object entity)
根据 ID 选择修改(NULL value fields will be ignored)
entity - 实体对象public int update(Object entity, Object whereEntity)
根据 whereEntity 条件,更新记录
entity - 实体对象whereEntity - 实体查询条件(可以为 null)public int updateSelective(Object entity, Object whereEntity)
根据 whereEntity 条件,选择更新记录 Update record(s) by where entity(by property values which is not null)
entity - 实体对象whereEntity(可以为 - null) 实体查询条件public int updateBatchById(List<?> entityList)
根据ID 批量更新
entityList - 实体对象列表public <T> T selectById(Object id, Class<T> clazz)
根据 ID 查询
id - 主键IDclazz - 对象类型public <T> List<T> selectBatchIds(List<?> idList, Class<T> clazz)
查询(根据ID 批量查询)
idList - 主键ID列表clazz - 对象类型public <T> List<T> selectByMap(Map<String,Object> columnMap, Class<T> clazz)
查询(根据 columnMap 条件)
columnMap - 表字段 map 对象clazz - 表字段 map 对象类型public <T> T selectOne(T entity)
根据 entity 条件,查询一条记录
entity - 实体对象public int selectCount(Object entity)
根据 entity 条件,查询总记录数
entity - 实体对象public <T> int selectCountByEW(GeneralEntityWrapper<T> entityWrapper)
Select count by entityWrapper.
entityWrapper - public <T> List<T> selectList(GeneralEntityWrapper<T> entityWrapper)
根据 entity 条件,查询全部记录
entityWrapper - 实体对象封装操作类(可以为 null)public <T> List<T> selectPage(com.baomidou.mybatisplus.plugins.pagination.Pagination page, GeneralEntityWrapper<T> entityWrapper)
根据 entity 条件,查询全部记录(并翻页)
page - 分页查询条件(可以为 RowBounds.DEFAULT)entityWrapper - 实体对象封装操作类(可以为 null)public Map<String,Object> asParam(String paramName, Object obj)
obj is GeneralEntityWrapper.paramName - obj - protected Class<?> getCorrespondingEntityClass(Class<?> clazz)
clazz - protected <T> List<T> wrapResult(List<T> list, Class<?> entityClazz)
list - EntityListentityClazz - EntityClass or Sub-classprotected <T> List<T> wrapResult(List<T> list, GeneralEntityWrapper<T> entityWrapper)
entityWrapper - entityWrapperlist - EntityListprotected <T> T wrapResult(T result,
Class<?> entityClazz)
result - Entity ObjectentityClazz - Entity Class or sub-classCopyright © 2017. All rights reserved.