Module bus.mapper

Interface BasicMapper<T,I extends Serializable>

Type Parameters:
T - 实体类类型
I - 主键类型
All Superinterfaces:
ClassMapper<T>, ConditionMapper<T,Condition<T>>, CursorMapper<T,Condition<T>>, EntityMapper<T,I>
All Known Subinterfaces:
LogicalMapper<T,I>, Mapper<T,I>

public interface BasicMapper<T,I extends Serializable> extends EntityMapper<T,I>, ConditionMapper<T,Condition<T>>, CursorMapper<T,Condition<T>>
基础 Mapper 接口,集成常用操作方法,支持继承和方法覆盖
Since:
Java 17+
Author:
Kimi Liu
  • Method Details

    • wrapper

      default ConditionWrapper<T,I> wrapper()
      创建 Condition 查询封装对象
      Returns:
      ConditionWrapper 对象
    • updateByPrimaryKeySelectiveWithForceFields

      @Lang(Caching.class) @UpdateProvider(type=FunctionProvider.class, method="updateByPrimaryKeySelectiveWithForceFields") <S extends T> int updateByPrimaryKeySelectiveWithForceFields(@Param("entity") S entity, @Param("fns") Fn.FnArray<T> fields)
      根据主键更新实体中非空字段,并强制更新指定字段
      Type Parameters:
      S - 实体类型
      Parameters:
      entity - 实体对象
      fields - 强制更新的字段集合,通过 Fn.of(Fn...) 创建 Fn.FnArray
      Returns:
      1 表示成功,0 表示失败
    • updateForFieldListByPrimaryKey

      @Lang(Caching.class) @UpdateProvider(type=FunctionProvider.class, method="updateForFieldListByPrimaryKey") <S extends T> int updateForFieldListByPrimaryKey(@Param("entity") S entity, @Param("fns") Fn.FnArray<T> fields)
      根据主键更新指定字段集合
      Type Parameters:
      S - 实体类型
      Parameters:
      entity - 实体对象
      fields - 指定更新的字段集合,通过 Fn.of(Fn...) 创建 Fn.FnArray
      Returns:
      1 表示成功,0 表示失败
    • selectByFieldList

      default <F> List<T> selectByFieldList(Fn<T,F> field, Collection<F> fieldValueList)
      根据指定字段集合查询,条件为 field IN (fieldValueList)
      Type Parameters:
      F - 字段类型
      Parameters:
      field - 字段方法引用
      fieldValueList - 字段值集合
      Returns:
      符合条件的实体对象列表
    • deleteByFieldList

      default <F> int deleteByFieldList(Fn<T,F> field, Collection<F> fieldValueList)
      根据指定字段集合删除,条件为 field IN (fieldValueList)
      Type Parameters:
      F - 字段类型
      Parameters:
      field - 字段方法引用
      fieldValueList - 字段值集合
      Returns:
      删除的记录数