<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.2.2</version>
</dependency>
# mybatis-plus 控制台打印 SQL 语句
mybatis-plus:
mapper-locations: classpath:/mapper/*.xml
configuration:
# 控制台打印执行 SQL 语句
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
# 扫描多层
mybatis-plus:
mapper-locations: classpath*:/mapper/**/*Mapper.xml
apiMappMapping.insert(mapping);
QueryWrapper<ApiMapping> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("MAPPING_ID",dto.getId());
apiMappMapping.delete(queryWrapper);
UpdateWrapper<DataSetTransformDto> dtoWrapper = new UpdateWrapper<>();
dtoWrapper.eq("ID",dto.getId());
dataSetTransformDtoMapper.update(dto,dtoWrapper);
// 分页条件
Page<ApiData> page = new Page<>(current,pageSize);
// 条件结构器
QueryWrapper<ApiData> wrapper = new QueryWrapper<>();
// 不为空 like 含糊查问
wrapper.like(StringUtils.isNotBlank(name),"NAME",name);
// 依据 API_ID order by desc 排序
wrapper.orderByDesc("API_ID");
IPage<ApiData> dataIPage = apiDataMapper.selectPage(page, wrapper);
Page<DataSetTransformDto> page = new Page<>(current,pageSize);
QueryWrapper<DataSetTransformDto> wrapper = new QueryWrapper<>();
// wrapper.like(StringUtils.isNotBlank(name),"NAME",name);
wrapper.orderByDesc("ID");
IPage<DataSetTransformDto> dtoIPage = dataSetTransformDtoMapper.selectPage(page, wrapper);
// 遍历放入汇合
dtoIPage.getRecords().stream().forEach(item->{List<ApiMapping> mappingList = apiMappMapping.selectList(new QueryWrapper<ApiMapping>().eq("MAPPING_ID", item.getId()));
item.setApiMappingList(mappingList);
});