public interface CommonMapper
| 限定符和类型 | 方法和说明 |
|---|---|
<T> int |
count(T record)
根据参数进行查询总数,record可以是Class
|
<T> int |
countByExample(Class<T> entityClass,
Object example)
通过Example类来查询count
|
<T> int |
delete(T record)
根据条件进行删除,条件不能为空,并且必须有至少一个条件才能删除
该方法不能直接删除全部数据 |
<T> int |
deleteByExample(Class<T> entityClass,
Object example)
通过Example删除
|
<T> int |
deleteByPrimaryKey(Class<T> entityClass,
Object key)
根据主键进行删除,主键不能为null或空
|
<T> int |
insert(T record)
插入数据库,主键字段没有值的时候不会出现在sql中
如果是自增主键,会自动获取值 如果是自增主键,并且该主键属性有值,会使用主键的属性值,不会使用自增 |
<T> int |
insertBatchSelective(List<T> record)
批量插入非空字段,其他和上面方法类似
|
<T> int |
insertSelective(T record)
插入非空字段,其他和上面方法类似
|
<T> List<Map<String,Object>> |
select(T record)
根据参数进行查询,record可以是Class
|
<T> List<Map<String,Object>> |
selectByExample(Class<T> entityClass,
Object example)
通过Example来查询
|
<T> Map<String,Object> |
selectByPrimaryKey(Class<T> entityClass,
Object key)
根据主键查询结果,主键不能为null或空
|
<T> int |
updateByExample(T record,
Object example)
通过Example进行更新全部字段
|
<T> int |
updateByExampleSelective(T record,
Object example)
通过Example进行更新非空字段
|
<T> int |
updateByJsonEntity(com.alibaba.fastjson.JSONObject jsonObject,
T record) |
<T> int |
updateByPrimaryKey(T record)
根据主键更新全部字段,空字段也会更新数据库
|
<T> int |
updateByPrimaryKeyNull(T record)
lst 根据主键更新全部字段,空字段也会更新数据库
null也会更新
|
<T> int |
updateByPrimaryKeySelective(T record)
根据主键更新非空属性字段,不能给数据库数据设置null或空
|
@Options(flushCache=TRUE) @SelectProvider(type=CommonProvider.class, method="select") <T> List<Map<String,Object>> select(@Param(value="record") T record)
T - record - @Options(flushCache=TRUE) @SelectProvider(type=CommonProvider.class, method="count") <T> int count(@Param(value="record") T record)
T - record - @Options(flushCache=TRUE) @SelectProvider(type=CommonProvider.class, method="selectByPrimaryKey") <T> Map<String,Object> selectByPrimaryKey(@Param(value="entityClass") Class<T> entityClass, @Param(value="key") Object key)
T - entityClass - key - @InsertProvider(type=CommonProvider.class, method="insert") <T> int insert(@Param(value="record") T record)
T - record - @InsertProvider(type=CommonProvider.class, method="insertSelective") <T> int insertSelective(@Param(value="record") T record)
T - record - @InsertProvider(type=CommonProvider.class, method="insertBatchSelective") <T> int insertBatchSelective(@Param(value="record") List<T> record)
T - record - @DeleteProvider(type=CommonProvider.class, method="delete") <T> int delete(@Param(value="record") T record)
T - record - @DeleteProvider(type=CommonProvider.class, method="deleteByPrimaryKey") <T> int deleteByPrimaryKey(@Param(value="entityClass") Class<T> entityClass, @Param(value="key") Object key)
T - entityClass - key - @UpdateProvider(type=CommonProvider.class, method="updateByPrimaryKey") <T> int updateByPrimaryKey(@Param(value="record") T record)
T - record - @UpdateProvider(type=CommonProvider.class, method="updateByPrimaryKeyNull") <T> int updateByPrimaryKeyNull(@Param(value="record") T record)
T - record - @UpdateProvider(type=CommonProvider.class, method="updateByPrimaryKeySelective") <T> int updateByPrimaryKeySelective(@Param(value="record") T record)
T - record - @Options(flushCache=TRUE) @SelectProvider(type=CommonProvider.class, method="countByExample") <T> int countByExample(@Param(value="entityClass") Class<T> entityClass, @Param(value="example") Object example)
T - entityClass - example - @DeleteProvider(type=CommonProvider.class, method="deleteByExample") <T> int deleteByExample(@Param(value="entityClass") Class<T> entityClass, @Param(value="example") Object example)
T - entityClass - example - @Options(flushCache=TRUE) @SelectProvider(type=CommonProvider.class, method="selectByExample") <T> List<Map<String,Object>> selectByExample(@Param(value="entityClass") Class<T> entityClass, @Param(value="example") Object example)
T - entityClass - example - @UpdateProvider(type=CommonProvider.class, method="updateByExampleSelective") <T> int updateByExampleSelective(@Param(value="record") T record, @Param(value="example") Object example)
T - record - example - @UpdateProvider(type=CommonProvider.class, method="updateByExample") <T> int updateByExample(@Param(value="record") T record, @Param(value="example") Object example)
T - record - example - @UpdateProvider(type=CommonProvider.class, method="updateByJsonEntity") <T> int updateByJsonEntity(@Param(value="json") com.alibaba.fastjson.JSONObject jsonObject, @Param(value="record") T record)
jsonObject - 需要保存的实体属性jsonrecord - 要保存的对应实体Copyright © 2020 GTMAP. All rights reserved.