一、查询方式
LambdaQueryWrapper<DyCommonQualificationRelate> qualificationRelateWrapper = Wrappers.lambdaQuery(DyCommonQualificationRelate.class)
.eq(DyCommonQualificationRelate::getCompanyId, companyId);
Integer categoryCount = dyClassAuthService.lambdaQuery().eq(DyClassAuth::getEntityId, vo.getEntityId());
LambdaQueryWrapper<DyClassAuth> objectLambdaQueryWrapper = new LambdaQueryWrapper<>();
objectLambdaQueryWrapper.eq();
二、表连接操作
CompanyCategoryInfoDto是用来接收表连接后的数据
依赖:
<!-- https://mvnrepository.com/artifact/com.github.yulichang/mybatis-plus-join-boot-starter -->
<dependency>
<groupId>com.github.yulichang</groupId>
<artifactId>mybatis-plus-join-boot-starter</artifactId>
<version>1.4.5</version>
</dependency>
import com.github.yulichang.toolkit.MPJWrappers;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
MPJLambdaWrapper<DyClassAuth> wrapper = MPJWrappers.lambdaJoin(DyClassAuth.class)
.selectAs(DyClassAuth::getLevel2CategoryId, CompanyCategoryInfoDto::getCategoryId)
.selectAs(DyClassAuth::getEntityId, CompanyCategoryInfoDto::getEntityId)
.selectAs(DyServiceProvider::getEntityName, CompanyCategoryInfoDto::getEntityName)
.selectAs(DyServiceProvider::getStatus, CompanyCategoryInfoDto::getEntityStatus)
.selectAs(DyRoleAuth::getStatus, CompanyCategoryInfoDto::getRoleAuthStatus)
.leftJoin(DyServiceProvider.class, DyServiceProvider::getEntityId, DyClassAuth::getEntityId)
.leftJoin(DyRoleAuth.class, DyRoleAuth::getMerchantEntityId, DyClassAuth::getEntityId)
.eq(DyClassAuth::getIsCheckSuccess, YesNoEnum.YES.getValue())
.eq(DyServiceProvider::getCompanyId, companyId)
.eq(DyClassAuth::getLevel2CategoryId, categoryId);
List<CompanyCategoryInfoDto> categoryInfoList = baseMapper.selectJoinList(CompanyCategoryInfoDto.class, wrapper);