ARTICLE DETAIL

资讯详情

深耕网站建设、视觉设计与SEO优化的一线实战洞察。

mybatis-plus Wrappers相关Api

mybatis-plus  Wrappers相关Api

1.mybatis-plus  Wrappers相关Api

获取count和list

QueryWrapper<Test111> time = Wrappers.<Test111>query().ge("time","2025-11-04 00:00:00");
long count = this.count(time);
List list = this.list(time);

2. 分页

for(int i =0;i<totalPage;i++){List<Test111> recourds =  this.page(new Page(i+1,5),time).getRecords();}

3. 批量插入

this.saveBatch(list)

4. 删除

QueryWrapper<Test111> time = Wrappers.<Test111>query().ge("time","2025-11-04 00:00:00");
this.remove(time);

5. 根据ids批量更新

List<Integer> ids = records.stream().map(i->i.getId()).collect(Collectors.toList());
UpdateWrapper<Test111> update1 = Wrappers.<Test111>update();
update1.set("name","zhangsan");
update1.in("id",ids);
this.update(update1);

单表操作可以用上面的,复杂sql关联查询的,建议写sql方式

 

返回列表