http://git.oschina.net/free/Mapper/blob/master/wiki/mapper3/5.Mappers.md/
Mapper3通用接口大全
Mapper3接口有两种形式,一种是提供了一个方法的接口。还有一种是不提供方法,但是继承了多个单方法的接口,一般是某类方法的集合。
例如SelectMapper<T>
是一个单方法的接口,BaseSelectMapper<T>
是一个继承了4个基础查询方法的接口。
基础接口
Select
接口:SelectMapper<T>
方法:List<T> select(T record);
说明:根据实体中的属性值进行查询,查询条件使用等号
接口:SelectByPrimaryKeyMapper<T>
方法:T selectByPrimaryKey(Object key);
说明:根据主键字段进行查询,方法参数必须包含完整的主键属性,查询条件使用等号
接口:SelectAllMapper<T>
方法:List<T> selectAll();
说明:查询全部结果,select(null)方法能达到同样的效果
接口:SelectOneMapper<T>
方法:T selectOne(T record);
说明:根据实体中的属性进行查询,只能有一个返回值,有多个结果是抛出异常,查询条件使用等号
接口:SelectCountMapper<T>
方法:int selectCount(T record);
说明:根据实体中的属性查询总数,查询条件使用等号
Insert
接口:InsertMapper<T>
方法:int insert(T record);
说明:保存一个实体,null的属性也会保存,不会使用数据库默认值
接口:InsertSelectiveMapper<T>
方法:int insertSelective(T record);
说明:保存一个实体,null的属性不会保存,会使用数据库默认值
Update
接口:UpdateByPrimaryKeyMapper<T>
方法:int updateByPrimaryKey(T record);
说明:根据主键更新实体全部字段,null值会被更新
接口:UpdateByPrimaryK