mybatis-plus一些通用方法

Posted 终会飞翔

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mybatis-plus一些通用方法相关的知识,希望对你有一定的参考价值。

insert相关

boolean insert(T entity); //插入

boolean insertSelective(T entity); //选择性插入,null字段不插入

boolean insertBatch(List<T> entityList); //批量插入

delete相关

boolean deleteById(I id); //通过ID删除

boolean deleteByMap(Map<String, Object> columnMap); // 通过自定义MAP删除

boolean deleteSelective(T entity); //通过entity实体选择性删除,null字段不作为条件

boolean deleteBatchIds(List<I> idList); //批量删除

update相关

boolean updateById(T entity); //通过ID更新

boolean updateSelectiveById(T entity); //通过ID选择性更新,null字段不更新

boolean update(T entity, T whereEntity); //通过whereEntity实体构造where条件进行更新

boolean updateSelective(T entity, T whereEntity); //通过whereEntity实体构造where条件进行选择性更新

boolean updateBatchById(List<T> entityList); //批量更新

select相关

T selectById(I id); //通过ID查询

List<T> selectBatchIds(List<I> idList); //通过ID集合批量查询

List<T> selectByMap(Map<String, Object> columnMap); //通过自定义MAP查询

T selectOne(T entity); //通过实体entity查询

int selectCount(T entity); //统计查询

List<T> selectList(EntityWrapper<T> entityWrapper); //List查询,entityWrapper为查询条件构造器

Page<T> selectPage(Page<T> page, EntityWrapper<T> entityWrapper); //分页查询,page为分页实体,entityWrapper为查询条件构造器

以上是关于mybatis-plus一些通用方法的主要内容,如果未能解决你的问题,请参考以下文章

Mybatis-Plus通用Mapper CRUD之insert(附带视频教程)

优雅高效的MyBatis-Plus工具快速入门使用

Mybatis-Plus 插件学习

Mybatis-Plus:通用CRUD操作

Mybatis-Plus:通用CRUD操作

Mybatis-Plus:通用CRUD操作