|
|
@@ -103,11 +103,40 @@ public interface IotRyDailyReportMapper extends BaseMapperX<IotRyDailyReportDO>
|
|
|
}
|
|
|
|
|
|
default PageResult<IotRyDailyReportDO> selectPage(IotRyDailyReportPageReqVO reqVO) {
|
|
|
+ // 1. 构建基础查询(不含 projectIds/taskIds 的 IN 条件)
|
|
|
+ LambdaQueryWrapperX<IotRyDailyReportDO> queryWrapper = buildBaseQuery(reqVO);
|
|
|
+ // 2. 根据 searchKey 决定 projectIds/taskIds 的组合方式
|
|
|
+ if (StrUtil.isNotBlank(reqVO.getSearchKey())) {
|
|
|
+ // 移动端:使用 OR
|
|
|
+ Collection<Long> projectIds = reqVO.getProjectIds();
|
|
|
+ Collection<Long> taskIds = reqVO.getTaskIds();
|
|
|
+ boolean hasProject = CollUtil.isNotEmpty(projectIds);
|
|
|
+ boolean hasTask = CollUtil.isNotEmpty(taskIds);
|
|
|
+ if (hasProject || hasTask) {
|
|
|
+ queryWrapper.and(wq -> {
|
|
|
+ if (hasProject) {
|
|
|
+ wq.in(IotRyDailyReportDO::getProjectId, projectIds);
|
|
|
+ }
|
|
|
+ if (hasProject && hasTask) {
|
|
|
+ wq.or();
|
|
|
+ }
|
|
|
+ if (hasTask) {
|
|
|
+ wq.in(IotRyDailyReportDO::getTaskId, taskIds);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // PC 端:使用 AND
|
|
|
+ queryWrapper
|
|
|
+ .inIfPresent(IotRyDailyReportDO::getProjectId, reqVO.getProjectIds())
|
|
|
+ .inIfPresent(IotRyDailyReportDO::getTaskId, reqVO.getTaskIds());
|
|
|
+ }
|
|
|
+
|
|
|
// 获取查询参数中的 projectClassification 值
|
|
|
String projectClassification = reqVO.getProjectClassification();
|
|
|
- LambdaQueryWrapperX<IotRyDailyReportDO> queryWrapper = new LambdaQueryWrapperX<IotRyDailyReportDO>();
|
|
|
+ // LambdaQueryWrapperX<IotRyDailyReportDO> queryWrapper = new LambdaQueryWrapperX<IotRyDailyReportDO>();
|
|
|
// 创建查询包装器
|
|
|
- queryWrapper
|
|
|
+ /* queryWrapper
|
|
|
// .eqIfPresent(IotRyDailyReportDO::getDeptId, reqVO.getDeptId())
|
|
|
.inIfPresent(IotRyDailyReportDO::getDeptId, reqVO.getDeptIds())
|
|
|
.eqIfPresent(IotRyDailyReportDO::getProjectId, reqVO.getProjectId())
|
|
|
@@ -145,7 +174,7 @@ public interface IotRyDailyReportMapper extends BaseMapperX<IotRyDailyReportDO>
|
|
|
.eqIfPresent(IotRyDailyReportDO::getAuditStatus, reqVO.getAuditStatus())
|
|
|
.betweenIfPresent(IotRyDailyReportDO::getCreateTime, reqVO.getCreateTime())
|
|
|
.orderByDesc(IotRyDailyReportDO::getCreateTime)
|
|
|
- .orderByAsc(IotRyDailyReportDO::getId);
|
|
|
+ .orderByAsc(IotRyDailyReportDO::getId); */
|
|
|
|
|
|
// 处理 statuses 条件:当 statuses 有值时,查询 rigStatus 或 repairStatus 不在 statuses 中的数据
|
|
|
Collection<String> statuses = reqVO.getStatuses();
|
|
|
@@ -194,6 +223,50 @@ public interface IotRyDailyReportMapper extends BaseMapperX<IotRyDailyReportDO>
|
|
|
return selectPage(reqVO, queryWrapper);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 构建公共基础查询条件(不包含 projectIds/taskIds 的 IN,但保留精确 ID)
|
|
|
+ */
|
|
|
+ default LambdaQueryWrapperX<IotRyDailyReportDO> buildBaseQuery(IotRyDailyReportPageReqVO reqVO) {
|
|
|
+ LambdaQueryWrapperX<IotRyDailyReportDO> wrapper = new LambdaQueryWrapperX<>();
|
|
|
+ wrapper
|
|
|
+ .inIfPresent(IotRyDailyReportDO::getDeptId, reqVO.getDeptIds())
|
|
|
+ .eqIfPresent(IotRyDailyReportDO::getProjectId, reqVO.getProjectId())
|
|
|
+ .eqIfPresent(IotRyDailyReportDO::getTaskId, reqVO.getTaskId())
|
|
|
+ .eqIfPresent(IotRyDailyReportDO::getRelocationDays, reqVO.getRelocationDays())
|
|
|
+ .betweenIfPresent(IotRyDailyReportDO::getLatestWellDoneTime, reqVO.getLatestWellDoneTime())
|
|
|
+ .eqIfPresent(IotRyDailyReportDO::getCurrentDepth, reqVO.getCurrentDepth())
|
|
|
+ .eqIfPresent(IotRyDailyReportDO::getDailyFootage, reqVO.getDailyFootage())
|
|
|
+ .eqIfPresent(IotRyDailyReportDO::getMonthlyFootage, reqVO.getMonthlyFootage())
|
|
|
+ .eqIfPresent(IotRyDailyReportDO::getAnnualFootage, reqVO.getAnnualFootage())
|
|
|
+ .eqIfPresent(IotRyDailyReportDO::getDailyPowerUsage, reqVO.getDailyPowerUsage())
|
|
|
+ .eqIfPresent(IotRyDailyReportDO::getMonthlyPowerUsage, reqVO.getMonthlyPowerUsage())
|
|
|
+ .eqIfPresent(IotRyDailyReportDO::getDailyFuel, reqVO.getDailyFuel())
|
|
|
+ .eqIfPresent(IotRyDailyReportDO::getMonthlyFuel, reqVO.getMonthlyFuel())
|
|
|
+ .betweenIfPresent(IotRyDailyReportDO::getNonProductionTime, reqVO.getNonProductionTime())
|
|
|
+ .eqIfPresent(IotRyDailyReportDO::getRyNptReason, reqVO.getRyNptReason())
|
|
|
+ .betweenIfPresent(IotRyDailyReportDO::getConstructionStartDate, reqVO.getConstructionStartDate())
|
|
|
+ .betweenIfPresent(IotRyDailyReportDO::getConstructionEndDate, reqVO.getConstructionEndDate())
|
|
|
+ .eqIfPresent(IotRyDailyReportDO::getProductionStatus, reqVO.getProductionStatus())
|
|
|
+ .eqIfPresent(IotRyDailyReportDO::getNextPlan, reqVO.getNextPlan())
|
|
|
+ .eqIfPresent(IotRyDailyReportDO::getRigStatus, reqVO.getRigStatus())
|
|
|
+ .eqIfPresent(IotRyDailyReportDO::getPersonnel, reqVO.getPersonnel())
|
|
|
+ .eqIfPresent(IotRyDailyReportDO::getMudDensity, reqVO.getMudDensity())
|
|
|
+ .eqIfPresent(IotRyDailyReportDO::getMudViscosity, reqVO.getMudViscosity())
|
|
|
+ .eqIfPresent(IotRyDailyReportDO::getLateralLength, reqVO.getLateralLength())
|
|
|
+ .eqIfPresent(IotRyDailyReportDO::getWellInclination, reqVO.getWellInclination())
|
|
|
+ .eqIfPresent(IotRyDailyReportDO::getAzimuth, reqVO.getAzimuth())
|
|
|
+ .eqIfPresent(IotRyDailyReportDO::getExtProperty, reqVO.getExtProperty())
|
|
|
+ .eqIfPresent(IotRyDailyReportDO::getSort, reqVO.getSort())
|
|
|
+ .eqIfPresent(IotRyDailyReportDO::getRemark, reqVO.getRemark())
|
|
|
+ .eqIfPresent(IotRyDailyReportDO::getStatus, reqVO.getStatus())
|
|
|
+ .eqIfPresent(IotRyDailyReportDO::getProcessInstanceId, reqVO.getProcessInstanceId())
|
|
|
+ .eqIfPresent(IotRyDailyReportDO::getAuditStatus, reqVO.getAuditStatus())
|
|
|
+ .betweenIfPresent(IotRyDailyReportDO::getCreateTime, reqVO.getCreateTime())
|
|
|
+ .orderByDesc(IotRyDailyReportDO::getCreateTime)
|
|
|
+ .orderByAsc(IotRyDailyReportDO::getId);
|
|
|
+ return wrapper;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 根据条件查询 瑞鹰 日报记录
|
|
|
*
|