首页 > 其他 > 详细

MybatisPlus

时间:2021-09-13 10:50:26      阅读:41      评论:0      收藏:0      [点我收藏+]

mybatis plus提供的IService的功能:


save(T entity); 把对象新增到数据库
saveBatch(Iterable entitys); 批量新增对象
saveOrUpdate(T entity); 根据id判断,id为null或id在数据库不存在,则新增。id不为null,修改
saveOrUpdateBatch(Iterable entitys); 根据id判断,id为null或id在数据库不存在,则新增。id不为null,修改

remove(Wrapper wrapper); // 根据复杂条件删除
removeById(Long id); // 根据id删除
removeByIds(Iterable ids); // 根据id批量删除

updateById(T entity); // 根据id修改,entity必须包含id属性
updateBatchById(Iterable entitys); // 根据id批量修改,集合中的每个entity都有id
updateByWrapper(T entity, Wrapper wrapper); 根据wrapper条件修改
update().set("column", "value").eq("column", "value").update(); // 链式更新
查询一个
getById(Long id); // 根据id查询一个
getOne(Wrapper wrapper); // 根据复杂条件查询一个
查询多个
list(Wrapper wrapper); // 根据复杂条件查询多个
listByIds(Iterable ids); // 根据id批量查询
链式查询:
query().eq().like().between().list(); // 查询多个
query().eq().like().between().page(new Page(current, size); // 分页查询
query().eq().like().between().one(); //查询一个

MybatisPlus

原文:https://www.cnblogs.com/ettisi/p/15260618.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!