类 Model<T extends Model<?>>

  • 类型参数:
    T -
    所有已实现的接口:
    java.io.Serializable

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

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

    从以下版本开始:
    2016-11-06
    作者:
    hubin
    另请参阅:
    序列化表格
    • 构造器概要

      构造器 
      构造器 说明
      Model()  
    • 方法概要

      所有方法 实例方法 具体方法 
      修饰符和类型 方法 说明
      protected void closeSqlSession​(org.apache.ibatis.session.SqlSession sqlSession)
      释放sqlSession
      boolean delete​(com.baomidou.mybatisplus.core.conditions.Wrapper<T> queryWrapper)
      删除记录
      boolean deleteById()
      根据主键删除
      boolean deleteById​(java.io.Serializable id)
      根据 ID 删除
      boolean insert()
      插入(字段选择插入)
      boolean insertOrUpdate()
      插入 OR 更新
      java.io.Serializable pkVal()
      主键值
      java.util.List<T> selectAll()
      查询所有
      T selectById()
      根据主键查询
      T selectById​(java.io.Serializable id)
      根据 ID 查询
      long selectCount​(com.baomidou.mybatisplus.core.conditions.Wrapper<T> queryWrapper)
      查询总数
      java.util.List<T> selectList​(com.baomidou.mybatisplus.core.conditions.Wrapper<T> queryWrapper)
      查询总记录数
      T selectOne​(com.baomidou.mybatisplus.core.conditions.Wrapper<T> queryWrapper)
      查询一条记录
      <E extends com.baomidou.mybatisplus.core.metadata.IPage<T>>
      E
      selectPage​(E page, com.baomidou.mybatisplus.core.conditions.Wrapper<T> queryWrapper)
      翻页查询
      SqlRunner sql()
      执行 SQL
      protected org.apache.ibatis.session.SqlSession sqlSession()
      获取Session 默认自动提交
      protected java.lang.String sqlStatement​(com.baomidou.mybatisplus.core.enums.SqlMethod sqlMethod)
      获取SqlStatement
      protected java.lang.String sqlStatement​(java.lang.String sqlMethod)
      获取SqlStatement
      boolean update​(com.baomidou.mybatisplus.core.conditions.Wrapper<T> updateWrapper)
      执行 SQL 更新
      boolean updateById()
      更新(字段选择更新)
      • 从类继承的方法 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 构造器详细资料

      • Model

        public Model()
    • 方法详细资料

      • insert

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

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

        public boolean deleteById​(java.io.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 java.util.List<T> selectAll()
        查询所有
      • selectById

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

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

        public java.util.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)
      • sqlSession

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

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

        protected java.lang.String sqlStatement​(java.lang.String sqlMethod)
        获取SqlStatement
        参数:
        sqlMethod - sqlMethod
      • pkVal

        public java.io.Serializable pkVal()
        主键值
      • closeSqlSession

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