类 Model<T extends Model<?>>

java.lang.Object
com.baomidou.mybatisplus.extension.activerecord.Model<T>
类型参数:
T -
所有已实现的接口:
Serializable

public abstract class Model<T extends Model<?>> extends Object implements Serializable
ActiveRecord 模式 CRUD

必须存在对应的原始mapper并继承baseMapper并且可以使用的前提下 才能使用此 AR 模式 !!!

从以下版本开始:
2016-11-06
作者:
hubin
另请参阅:
  • 构造器详细资料

    • Model

      public Model()
  • 方法详细资料

    • insert

      public boolean insert()
      插入(字段选择插入)
    • insertOrUpdate

      public boolean insertOrUpdate()
      插入 OR 更新
    • deleteById

      public boolean deleteById(Serializable id)
      根据 ID 删除
      参数:
      id - 主键ID
    • deleteById

      public boolean deleteById()
      根据主键删除
    • delete

      public boolean delete(com.baomidou.mybatisplus.core.conditions.Wrapper<T> queryWrapper)
      删除记录
      参数:
      queryWrapper - 实体对象封装操作类(可以为 null)
    • updateById

      public boolean updateById()
      更新(字段选择更新)
    • update

      public boolean update(com.baomidou.mybatisplus.core.conditions.Wrapper<T> updateWrapper)
      执行 SQL 更新
      参数:
      updateWrapper - 实体对象封装操作类(可以为 null,里面的 entity 用于生成 where 语句)
    • selectAll

      public List<T> selectAll()
      查询所有
    • selectById

      public T selectById(Serializable id)
      根据 ID 查询
      参数:
      id - 主键ID
    • selectById

      public T selectById()
      根据主键查询
    • selectList

      public List<T> selectList(com.baomidou.mybatisplus.core.conditions.Wrapper<T> queryWrapper)
      查询总记录数
      参数:
      queryWrapper - 实体对象封装操作类(可以为 null)
    • selectOne

      public T selectOne(com.baomidou.mybatisplus.core.conditions.Wrapper<T> queryWrapper)
      查询一条记录
      参数:
      queryWrapper - 实体对象封装操作类(可以为 null)
    • selectPage

      public <E extends com.baomidou.mybatisplus.core.metadata.IPage<T>> E selectPage(E page, com.baomidou.mybatisplus.core.conditions.Wrapper<T> queryWrapper)
      翻页查询
      参数:
      page - 翻页查询条件
      queryWrapper - 实体对象封装操作类(可以为 null)
    • selectCount

      public long selectCount(com.baomidou.mybatisplus.core.conditions.Wrapper<T> queryWrapper)
      查询总数
      参数:
      queryWrapper - 实体对象封装操作类(可以为 null)
    • sql

      public SqlRunner sql()
      执行 SQL
    • sqlSession

      protected org.apache.ibatis.session.SqlSession sqlSession()
      获取Session 默认自动提交
    • sqlStatement

      protected String sqlStatement(com.baomidou.mybatisplus.core.enums.SqlMethod sqlMethod)
      获取SqlStatement
      参数:
      sqlMethod - sqlMethod
    • sqlStatement

      protected String sqlStatement(String sqlMethod)
      获取SqlStatement
      参数:
      sqlMethod - sqlMethod
    • pkVal

      public Serializable pkVal()
      主键值
    • closeSqlSession

      protected void closeSqlSession(org.apache.ibatis.session.SqlSession sqlSession)
      释放sqlSession
      参数:
      sqlSession - session