java中MyBatis-Plus的CRUD接口

MyBatis-Plus

MyBatis-Plus的CRUD接口

一、Service CRUD接口

1、Save
#插入一条数据:boolean save(T entity);
#插入批量:boolean savebBatch(Collection entityList)
2、Remove
#根据entity条件,删除记录:boolean remove(Wrapper queryWrapper) (Wrapper queryWrapper 实体包装类 QueryWrapper)
#根据Id删除:boolean removeById(Serializable id)
#根据Id批量删除:boolean removeById(Collection idList)
3、Update
#根据UpdateWrapper条件,更新记录 需要设置sqlset:boolean update)(Wrapper UpdateWrapper)
#根据whereEntity条件,更新记录:boolean Update(T entity ,Wrapper,UpdateWrapper)
#根据Id选择更改:boolean updateById(T entity)
#根据id批量更新:boolean uodateBatchById(Collection entityList)
4、Get
#根据id查询:T getById(Serializable id)
#根据Wrapper查询一条记录:T getOne(Wrapper,queryWrapper)
#根据Wrapper查询一条记录:Map(Wrapper,queryWrapper)
5、List
#查询所有:List list()
#查询列表:List list(Wrapper queryWrapper)
#根据id,批量查询:Collection listById(Collection idList)
#根据cloumnMap条件查询:Collection listByMap(Map(String,Object),cloumnMap)
#查询所有列表:List> listMaps();
#查询列表:List> listMap(Wrapper queryWrapper)
#查询所有记录:List listObjs()
#根据Wrapper条件,查询所有记录:List listObjs(Wrapper queryWrapper)
6、Page
#无条件分页查询:IPage page(IPage page)
#条件分页查询:IPage page(IPage page,Wrapper queryWrapper)
#无条件分页查询:IPage> pageMaps(IPage page)
#条件分页查询:IPage> pageMaps
7、Count
#查询总记录数:int count()
#根据Wrapper条件,查询总记录数:int count(Wrapper queryWrapper)
8、Chain(链式)
①:query
#链式查询 普通:QueryChainWrapper query();
#链式查询 lambda 式。注意:不支持 Kotlin:LambdaQueryChainWrapper lambdaQuery()
②:update
#链式更改 普通:UpdateChainWrapper update();
#链式更改 lambda 式。注意:不支持 Kotlin :LambdaUpdateChainWrapper lambdaUpdate();

二、Mapper CRUD接口

1、Insert
#插入一条记录:int insert(T entity)
2、Delete
#根据entity条件,删除记录:int delete(@Param(Constants.WRAPPER) Wrapper wrapper)
#根据id批量删除:int deleteBatchIds(@Param(Constants.COLLECTION) Collection idList)
#根据id删除:int deleteBatchIds(Serialiable id)
#根据cloumnMap条件,删除记录:int deleteByMap(@Param(Constants.COLUMN_MAP) Map columnMap)
3、Update
#根据 whereEntity 条件,更新记录:int update(@Param(Constants.ENTITY) T entity, @Param(Constants.WRAPPER) Wrapper updateWrapper)
#根据id修改:int UpdateById(@Param(Constants.ENTITY) T entity)
4、Select
#根据id查询:T SelectById(Serializable id)
#根据entity查询一条记录:T selectOne(@Param(Constants.Collection) Wrapper qyeryWrapper)
#根据id批量查询:List selectBatchById(@Param(Constants.Collection) Collection idList)
#根据entity条件,查询全部记录:List selectList(@Param(Constants.WRAPPER) Wrapper queryWrapper)
#查询(根据 columnMap 条件):List selectByMap(@Param(Constants.COLUMN_MAP) Map columnMap)
#根据 Wrapper 条件,查询全部记录:List> selectMaps(@Param(Constants.WRAPPER) Wrapper queryWrapper)
#根据 Wrapper 条件,查询全部记录。注意: 只返回第一个字段的值:List selectObjs(@Param(Constants.WRAPPER) Wrapper queryWrapper)
#根据 entity 条件,查询全部记录(并翻页):IPage selectPage(IPage page, @Param(Constants.WRAPPER) Wrapper queryWrapper)
#根据 Wrapper 条件,查询全部记录(并翻页):IPage> selectMapsPage(IPage page, @Param(Constants.WRAPPER) Wrapper queryWrapper)
#根据 Wrapper 条件,查询总记录数:Integer selectCount(@Param(Constants.WRAPPER) Wrapper queryWrapper)

小白一枚,如有错误,请多指教

你可能感兴趣的:(java,java,mybatis,ssm)