2023-09-10
目录结构
logback.xml
<?xml version="1.0" encoding="UTF-8"?> <configuration> </configuration>
application.yml
spring: datasource: driver-class-name: com.mysql.cj.jdbc.Driver url: jdbc:mysql://localhost:3306/db01?serverTimezone=UTC username: root password: 123456 type: com.alibaba.druid.pool.DruidDataSource main: banner-mode: off mybatis-plus: configuration: log-impl: org.apache.ibatis.logging.stdout.StdOutImpl global-config: banner: false
TestDeptDao
@Test public void selectConditionOne(){ QueryWrapper<Dept> qw = new QueryWrapper<>(); qw.lt("id", 20); List<Dept> depts = deptDao.selectList(qw); System.out.println("depts = " + depts); } @Test public void selectConditionTwo(){ QueryWrapper<Dept> qw = new QueryWrapper<>(); qw.lambda().ge(Dept::getId,20); List<Dept> depts = deptDao.selectList(qw); System.out.println("depts = " + depts); } @Test public void selectConditionThree(){ LambdaQueryWrapper<Dept> lqw = new LambdaQueryWrapper<>(); lqw.ge(Dept::getId,10); List<Dept> depts = deptDao.selectList(lqw); System.out.println("depts = " + depts); } @Test public void selectConditionMultOne(){ LambdaQueryWrapper<Dept> lqw = new LambdaQueryWrapper<>(); lqw.ge(Dept::getId,10); lqw.le(Dept::getId,30); List<Dept> depts = deptDao.selectList(lqw); System.out.println("depts = " + depts); } @Test public void selectConditionMultTwo(){ LambdaQueryWrapper<Dept> lqw = new LambdaQueryWrapper<>(); lqw.ge(Dept::getId,40).or().le(Dept::getId,10); List<Dept> depts = deptDao.selectList(lqw); System.out.println("depts = " + depts); }
标签:LambdaQueryWrapper,qw,depts,lqw,getId,查询,Dept,设置,logback From: https://www.cnblogs.com/isDaHua/p/17691667.html