Selaa lähdekoodia

pms 瑞鹰 日报列表 兼容 移动端 多条件查询

zhangcl 20 tuntia sitten
vanhempi
commit
9296403fb2

+ 11 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotrydailyreport/IotRyDailyReportController.java

@@ -260,6 +260,17 @@ public class IotRyDailyReportController {
         // 根据查询参数筛选出 符合条件 的记录id 再传入 分页查询
         Set<Long> projectIds = new HashSet<>();
         Set<Long> taskIds = new HashSet<>();
+        // 移动端搜索条件 标识 合同名称 任务井号 ... 移动端兼容:searchKey 不为空时 自动填充未填的 contractName / taskName
+        String searchKey = pageReqVO.getSearchKey();
+        if (StrUtil.isNotBlank(searchKey)) {
+            if (StrUtil.isBlank(pageReqVO.getContractName())) {
+                pageReqVO.setContractName(searchKey);
+            }
+            if (StrUtil.isBlank(pageReqVO.getTaskName())) {
+                pageReqVO.setTaskName(searchKey);
+            }
+        }
+
         if (StrUtil.isNotBlank(pageReqVO.getContractName())) {
             IotProjectInfoPageReqVO reqVO = new IotProjectInfoPageReqVO();
             reqVO.setContractName(pageReqVO.getContractName());

+ 3 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotrydailyreport/vo/IotRyDailyReportPageReqVO.java

@@ -161,4 +161,7 @@ public class IotRyDailyReportPageReqVO extends PageParam {
 
     @Schema(description = "非生产时效查询标识", example = "Y")
     private String nonProductFlag;
+
+    @Schema(description = "移动端查询标识", example = "#33 - 一厂")
+    private String searchKey;
 }

+ 76 - 3
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/mysql/iotrydailyreport/IotRyDailyReportMapper.java

@@ -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;
+    }
+
     /**
      * 根据条件查询 瑞鹰 日报记录
      *

+ 16 - 7
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/iotrydailyreport/IotRyDailyReportServiceImpl.java

@@ -450,14 +450,23 @@ public class IotRyDailyReportServiceImpl implements IotRyDailyReportService {
             ids.add(pageReqVO.getDeptId());
             pageReqVO.setDeptIds(ids);
         }
-        // 检查contractName不为空但projectIds为空的情况
-        if (StrUtil.isNotBlank(pageReqVO.getContractName()) && (CollUtil.isEmpty(pageReqVO.getProjectIds()))) {
-            return new PageResult<>(Collections.emptyList(), 0L);
-        }
-        // 检查taskName不为空但taskIds为空的情况
-        if (StrUtil.isNotBlank(pageReqVO.getTaskName()) && (CollUtil.isEmpty(pageReqVO.getTaskIds()))) {
-            return new PageResult<>(Collections.emptyList(), 0L);
+
+        // searchKey 兼容移动端查询的情况
+        if (StrUtil.isNotBlank(pageReqVO.getSearchKey())) {
+            if (CollUtil.isEmpty(pageReqVO.getProjectIds()) && CollUtil.isEmpty(pageReqVO.getTaskIds())) {
+                return new PageResult<>(Collections.emptyList(), 0L);
+            }
+        } else {
+            // 检查contractName不为空但projectIds为空的情况
+            if (StrUtil.isNotBlank(pageReqVO.getContractName()) && (CollUtil.isEmpty(pageReqVO.getProjectIds()))) {
+                return new PageResult<>(Collections.emptyList(), 0L);
+            }
+            // 检查taskName不为空但taskIds为空的情况
+            if (StrUtil.isNotBlank(pageReqVO.getTaskName()) && (CollUtil.isEmpty(pageReqVO.getTaskIds()))) {
+                return new PageResult<>(Collections.emptyList(), 0L);
+            }
         }
+
         return iotRyDailyReportMapper.selectPage(pageReqVO);
     }