idea新建一个spring boot 项目,然后在pom.xml文件中引入mybatis plus 的依赖:
<!--mybatis plus extension,包含了mybatis plus core-->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>${mybatis-plus.version}</version>
</dependency>
1.QueryWrapper的方法

2.demo
使用的关键的代码
QueryWrapper<PbListBlack> sectionQueryWrapper = new QueryWrapper<>();
sectionQueryWrapper.eq("OPTYPE", 1);
sectionQueryWrapper.eq("BLTYPE", 1);
List<PbListBlack> pbListBlacks = iPbListBlackMapper.selectList(sectionQueryWrapper);
上面这段代码的意思就是,首先新建一个QueryWrapper对象,类型为PbListBlack对象,也就是你需要查询的实体数据,
sectionQueryWrapper.eq(“OPTYPE”, 1);
sectionQueryWrapper.eq(“BLTYPE”, 1);
这两句的意思是PbListBlack对象对应的数据库表中的OPTYPE,BLTYPE字段值要为1
本文介绍了如何在SpringBoot项目中通过MybatisPlus的QueryWrapper进行高效的数据查询,包括创建QueryWrapper对象、设置条件eq('OPTYPE', 1)和eq('BLTYPE', 1),并展示了实际的代码示例。
2750





