Mybatis-plus4条件构造器使用方式
作者:ha_lydms
这篇文章主要介绍了Mybatis-plus4条件构造器使用方式,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教
Mybatis-plus4条件构造器使用
分为4种条件构造器:
new QueryWrappe
new QueryWrapper<Customers>().lambda()
new LambdaQueryWrapper<Customers>()
Wrappers.lambdaQuery(Customers.class)
1、QueryWrapper
- QueryWrapper
new QueryWrapper<Customers>() .eq("id", 1) .in("birth", "张三");
- UpdateWrapper
UpdateWrapper<Customers> uw = new UpdateWrapper<Customers>() .eq("id", 1) .set("birth", "张三");
2、QueryWrapper.lambda
new QueryWrapper<Customers>().lambda() .eq(Customers::getId, 1) .in(Customers::getBirth, "");
LambdaUpdateWrapper<Customers> uw = new UpdateWrapper<Customers>().lambda() .eq(Customers::getId, 1) .set(Customers::getName, "张三");
3、LambdaQueryWrapper
new LambdaQueryWrapper<Customers>() .eq(Customers::getId, 1) .in(Customers::getBirth, "");
LambdaUpdateWrapper<Customers> uw = new LambdaUpdateWrapper<Customers>() .eq(Customers::getId, 1) .set(Customers::getName, "张三");
4、Wrappers
LambdaQueryWrapper<Customers> eq = Wrappers.lambdaQuery(Customers.class) .eq(Customers::getId, 1) .in(Customers::getBirth, "");
LambdaUpdateWrapper<Customers> uwnow = Wrappers.lambdaUpdate(Customers.class) .eq(Customers::getId, 1) .set(Customers::getName, "张三");
总结
以上为个人经验,希望能给大家一个参考,也希望大家多多支持脚本之家。