T - 实体类类型I - 主键类型public interface BaseMapper<T,I extends Serializable> extends EntityMapper<T,I>, ExampleMapper<T,Example<T>>, CursorMapper<T,Example<T>>
| Modifier and Type | Method and Description |
|---|---|
default <F> int |
deleteByFieldList(Fn<T,F> field,
Collection<F> fieldValueList)
根据指定字段集合删除:field in (fieldValueList)
|
default <F> List<T> |
selectByFieldList(Fn<T,F> field,
Collection<F> fieldValueList)
根据指定字段集合查询:field in (fieldValueList)
|
int |
updateByPrimaryKeySelectiveWithForceFields(T entity,
Fn.Fns<T> forceUpdateFields)
根据主键更新实体中不为空的字段,强制字段不区分是否 null,都更新
|
default ExampleWrapper<T,I> |
wrapper()
Example 查询封装
|
delete, deleteByPrimaryKey, insert, insertSelective, selectByPrimaryKey, selectCount, selectList, selectOne, updateByPrimaryKey, updateByPrimaryKeySelectivecountByExample, deleteByExample, example, selectByExample, selectByExample, selectOneByExample, updateByExample, updateByExampleSelective, updateByExampleSetValuesselectCursor, selectCursorByExampledefault ExampleWrapper<T,I> wrapper()
@Lang(value=io.mybatis.provider.Caching.class) @UpdateProvider(type=FnProvider.class, method="updateByPrimaryKeySelectiveWithForceFields") int updateByPrimaryKeySelectiveWithForceFields(@Param(value="entity") T entity, @Param(value="fns") Fn.Fns<T> forceUpdateFields)
当前方法来自 FnMapper,该接口中的其他方法用 ExampleMapper 也能实现
entity - 实体类forceUpdateFields - 强制更新的字段,不区分字段是否为 null,通过 Fn.of(Fn...) 创建 Fn.Fnsdefault <F> List<T> selectByFieldList(Fn<T,F> field, Collection<F> fieldValueList)
这个方法是个示例,你也可以使用 Java8 的默认方法实现一些通用方法
F - 字段类型field - 字段fieldValueList - 字段值集合default <F> int deleteByFieldList(Fn<T,F> field, Collection<F> fieldValueList)
这个方法是个示例,你也可以使用 Java8 的默认方法实现一些通用方法
F - 字段类型field - 字段fieldValueList - 字段值集合Copyright © 2022. All rights reserved.