Package io.mybatis.mapper
Interface Mapper<T,I extends Serializable>
-
- Type Parameters:
T- 实体类类型I- 主键类型
- All Superinterfaces:
BaseMapper<T,I>,CursorMapper<T,Example<T>>,io.mybatis.provider.EntityInfoMapper<T>,EntityMapper<T,I>,ExampleMapper<T,Example<T>>
public interface Mapper<T,I extends Serializable> extends BaseMapper<T,I>
自定义 Mapper 示例,这个 Mapper 基于主键自增重写了 insert 方法,主要用作示例当你使用 Oracle 或其他数据库时,insert 重写时也可以使用 @SelectKey 注解对主键进行定制
- Author:
- liuzh
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description intinsert(T entity)保存实体,默认主键自增,并且名称为 idintinsertSelective(T entity)保存实体中不为空的字段,默认主键自增,并且名称为 id-
Methods inherited from interface io.mybatis.mapper.BaseMapper
deleteByFieldList, selectByFieldList, updateByPrimaryKeySelectiveWithForceFields, wrapper
-
Methods inherited from interface io.mybatis.mapper.cursor.CursorMapper
selectCursor, selectCursorByExample
-
Methods inherited from interface io.mybatis.mapper.base.EntityMapper
delete, deleteByPrimaryKey, selectByPrimaryKey, selectCount, selectList, selectOne, updateByPrimaryKey, updateByPrimaryKeySelective
-
Methods inherited from interface io.mybatis.mapper.example.ExampleMapper
countByExample, deleteByExample, example, selectByExample, selectByExample, selectOneByExample, updateByExample, updateByExampleSelective, updateByExampleSetValues
-
-
-
-
Method Detail
-
insert
@Lang(io.mybatis.provider.Caching.class) @Options(useGeneratedKeys=true, keyProperty="id") @InsertProvider(type=EntityProvider.class, method="insert") int insert(T entity)保存实体,默认主键自增,并且名称为 id这个方法是个示例,你可以在自己的接口中使用相同的方式覆盖父接口中的配置
- Specified by:
insertin interfaceEntityMapper<T,I extends Serializable>- Parameters:
entity- 实体类- Returns:
- 1成功,0失败
-
insertSelective
@Lang(io.mybatis.provider.Caching.class) @Options(useGeneratedKeys=true, keyProperty="id") @InsertProvider(type=EntityProvider.class, method="insertSelective") int insertSelective(T entity)保存实体中不为空的字段,默认主键自增,并且名称为 id这个方法是个示例,你可以在自己的接口中使用相同的方式覆盖父接口中的配置
- Specified by:
insertSelectivein interfaceEntityMapper<T,I extends Serializable>- Parameters:
entity- 实体类- Returns:
- 1成功,0失败
-
-