Interface IdEntityService<T extends Serializable>

Type Parameters:
T - 实体类型,必须实现Serializable接口
All Superinterfaces:
EntityService<T>, ExtService<T>
All Known Subinterfaces:
IdNameEntityService<T>

public interface IdEntityService<T extends Serializable> extends EntityService<T>
基于ID实体的服务接口,提供基于主键的基本数据操作功能
Author:
Kerbores(kerbores@gmail.com)
  • Method Details

    • fetch

      default T fetch(long id)
      根据@Id所在的属性的值获取一个实体对象
      Parameters:
      id - 主键属性的值
      Returns:
      实体对象,如不存在则返回null
    • delete

      default int delete(long id)
      根据@Id所在的属性的值删除一个实体对象
      Parameters:
      id - 主键属性的值
      Returns:
      删除的记录数, 通常是0或者1
    • getMaxId

      default int getMaxId()
      根据@Id所在的属性在数据库中的最大值
      Returns:
      最大值,若数据库中没有数据,会抛出空指针异常
    • exists

      default boolean exists(long id)
      是否存在@Id所在属性的值为指定值的记录
      Parameters:
      id - 主键属性的值
      Returns:
      true,如果存在的话