T - 实体类类型I - 主键类型public interface Mapper<T,I extends Serializable> extends BaseMapper<T,I>
当你使用 Oracle 或其他数据库时,insert 重写时也可以使用 @SelectKey 注解对主键进行定制
| Modifier and Type | Method and Description |
|---|---|
int |
insert(T entity)
保存实体,默认主键自增,并且名称为 id
|
int |
insertSelective(T entity)
保存实体中不为空的字段,默认主键自增,并且名称为 id
|
deleteByFieldList, selectByFieldList, updateByPrimaryKeySelectiveWithForceFields, wrapperdelete, deleteByPrimaryKey, selectByPrimaryKey, selectCount, selectList, selectOne, updateByPrimaryKey, updateByPrimaryKeySelectivecountByExample, deleteByExample, example, selectByExample, selectByExample, selectOneByExample, updateByExample, updateByExampleSelective, updateByExampleSetValuesselectCursor, selectCursorByExample@Lang(value=io.mybatis.provider.Caching.class)
@Options(useGeneratedKeys=true,
keyProperty="id")
@InsertProvider(type=EntityProvider.class,
method="insert")
int insert(T entity)
这个方法是个示例,你可以在自己的接口中使用相同的方式覆盖父接口中的配置
insert in interface EntityMapper<T,I extends Serializable>entity - 实体类@Lang(value=io.mybatis.provider.Caching.class)
@Options(useGeneratedKeys=true,
keyProperty="id")
@InsertProvider(type=EntityProvider.class,
method="insertSelective")
int insertSelective(T entity)
这个方法是个示例,你可以在自己的接口中使用相同的方式覆盖父接口中的配置
insertSelective in interface EntityMapper<T,I extends Serializable>entity - 实体类Copyright © 2022. All rights reserved.