Bladeren bron

pms 瑞都日报查询列表 兼容 移动端查询

zhangcl 1 dag geleden
bovenliggende
commit
0dd84920a8

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

@@ -880,6 +880,17 @@ public class IotRdDailyReportController {
         // 根据查询参数筛选出 符合条件 的记录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/iotrddailyreport/vo/IotRdDailyReportPageReqVO.java

@@ -177,4 +177,7 @@ public class IotRdDailyReportPageReqVO extends PageParam {
 
     @Schema(description = "时间查询类型", example = "本月 本季度 本年")
     private String timeType;
+
+    @Schema(description = "移动端查询标识", example = "#33 - 一厂")
+    private String searchKey;
 }

+ 71 - 2
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/mysql/iotrddailyreport/IotRdDailyReportMapper.java

@@ -1,5 +1,6 @@
 package cn.iocoder.yudao.module.pms.dal.mysql.iotrddailyreport;
 
+import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.util.StrUtil;
 import cn.iocoder.yudao.framework.common.pojo.PageResult;
 import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
@@ -26,8 +27,27 @@ import java.util.List;
 public interface IotRdDailyReportMapper extends BaseMapperX<IotRdDailyReportDO> {
 
     default PageResult<IotRdDailyReportDO> selectPage(IotRdDailyReportPageReqVO reqVO) {
-        LambdaQueryWrapperX<IotRdDailyReportDO> wrapper = buildCommonQuery(reqVO)
-                .eqIfPresent(IotRdDailyReportDO::getProjectId, reqVO.getProjectId());
+        LambdaQueryWrapperX<IotRdDailyReportDO> wrapper = buildBaseQuery(reqVO);
+
+        // 关键:移动端搜索(searchKey 非空) -> projectIds 与 taskIds 使用 OR
+        if (StrUtil.isNotBlank(reqVO.getSearchKey())) {
+            Collection<Long> projectIds = reqVO.getProjectIds();
+            Collection<Long> taskIds = reqVO.getTaskIds();
+            boolean hasProject = CollUtil.isNotEmpty(projectIds);
+            boolean hasTask = CollUtil.isNotEmpty(taskIds);
+
+            if (hasProject || hasTask) {
+                wrapper.and(wq -> {
+                    if (hasProject) wq.in(IotRdDailyReportDO::getProjectId, projectIds);
+                    if (hasProject && hasTask) wq.or();
+                    if (hasTask) wq.in(IotRdDailyReportDO::getTaskId, taskIds);
+                });
+            }
+        } else {
+            // PC 端多条件:维持 AND
+            wrapper.inIfPresent(IotRdDailyReportDO::getProjectId, reqVO.getProjectIds())
+                    .inIfPresent(IotRdDailyReportDO::getTaskId, reqVO.getTaskIds());
+        }
 
         wrapper.and(wq -> wq.eq(IotRdDailyReportDO::getPlatformWell, 0)
                 .or()
@@ -132,6 +152,55 @@ public interface IotRdDailyReportMapper extends BaseMapperX<IotRdDailyReportDO>
                 .orderByDesc(IotRdDailyReportDO::getCreateTime);
     }
 
+    /**
+     * 基础字段的查询逻辑 不包含 projectIds / taskIds 集合条件
+     * @param reqVO
+     * @return
+     */
+    default LambdaQueryWrapperX<IotRdDailyReportDO> buildBaseQuery(IotRdDailyReportPageReqVO reqVO) {
+        return new LambdaQueryWrapperX<IotRdDailyReportDO>()
+                .inIfPresent(IotRdDailyReportDO::getDeptId, reqVO.getDeptIds())
+                .eqIfPresent(IotRdDailyReportDO::getProjectId, reqVO.getProjectId())
+                .eqIfPresent(IotRdDailyReportDO::getTaskId, reqVO.getTaskId())               // 精确 taskId 保留
+                .eqIfPresent(IotRdDailyReportDO::getProjectClassification, reqVO.getProjectClassification())
+                .eqIfPresent(IotRdDailyReportDO::getTechniqueIds, reqVO.getTechniqueIds())
+                .eqIfPresent(IotRdDailyReportDO::getDeviceIds, reqVO.getDeviceIds())
+                .betweenIfPresent(IotRdDailyReportDO::getStartTime, reqVO.getStartTime())
+                .betweenIfPresent(IotRdDailyReportDO::getEndTime, reqVO.getEndTime())
+                .eqIfPresent(IotRdDailyReportDO::getCumulativeWorkingWell, reqVO.getCumulativeWorkingWell())
+                .eqIfPresent(IotRdDailyReportDO::getCumulativeWorkingLayers, reqVO.getCumulativeWorkingLayers())
+                .eqIfPresent(IotRdDailyReportDO::getDailyPumpTrips, reqVO.getDailyPumpTrips())
+                .eqIfPresent(IotRdDailyReportDO::getDailyToolsSand, reqVO.getDailyToolsSand())
+                .eqIfPresent(IotRdDailyReportDO::getRunCount, reqVO.getRunCount())
+                .eqIfPresent(IotRdDailyReportDO::getBridgePlug, reqVO.getBridgePlug())
+                .eqIfPresent(IotRdDailyReportDO::getWaterVolume, reqVO.getWaterVolume())
+                .eqIfPresent(IotRdDailyReportDO::getHourCount, reqVO.getHourCount())
+                .eqIfPresent(IotRdDailyReportDO::getDailyFuel, reqVO.getDailyFuel())
+                .eqIfPresent(IotRdDailyReportDO::getDailyPowerUsage, reqVO.getDailyPowerUsage())
+                .betweenIfPresent(IotRdDailyReportDO::getProductionTime, reqVO.getProductionTime())
+                .betweenIfPresent(IotRdDailyReportDO::getNonProductionTime, reqVO.getNonProductionTime())
+                .eqIfPresent(IotRdDailyReportDO::getRdNptReason, reqVO.getRdNptReason())
+                .betweenIfPresent(IotRdDailyReportDO::getConstructionStartDate, reqVO.getConstructionStartDate())
+                .betweenIfPresent(IotRdDailyReportDO::getConstructionEndDate, reqVO.getConstructionEndDate())
+                .eqIfPresent(IotRdDailyReportDO::getProductionStatus, reqVO.getProductionStatus())
+                .eqIfPresent(IotRdDailyReportDO::getExternalRental, reqVO.getExternalRental())
+                .eqIfPresent(IotRdDailyReportDO::getNextPlan, reqVO.getNextPlan())
+                .eqIfPresent(IotRdDailyReportDO::getRdStatus, reqVO.getRdStatus())
+                .eqIfPresent(IotRdDailyReportDO::getMalfunction, reqVO.getMalfunction())
+                .betweenIfPresent(IotRdDailyReportDO::getFaultDowntime, reqVO.getFaultDowntime())
+                .eqIfPresent(IotRdDailyReportDO::getPersonnel, reqVO.getPersonnel())
+                .eqIfPresent(IotRdDailyReportDO::getTotalStaffNum, reqVO.getTotalStaffNum())
+                .eqIfPresent(IotRdDailyReportDO::getLeaveStaffNum, reqVO.getLeaveStaffNum())
+                .eqIfPresent(IotRdDailyReportDO::getExtProperty, reqVO.getExtProperty())
+                .eqIfPresent(IotRdDailyReportDO::getSort, reqVO.getSort())
+                .eqIfPresent(IotRdDailyReportDO::getRemark, reqVO.getRemark())
+                .eqIfPresent(IotRdDailyReportDO::getStatus, reqVO.getStatus())
+                .eqIfPresent(IotRdDailyReportDO::getProcessInstanceId, reqVO.getProcessInstanceId())
+                .eqIfPresent(IotRdDailyReportDO::getAuditStatus, reqVO.getAuditStatus())
+                .betweenIfPresent(IotRdDailyReportDO::getCreateTime, reqVO.getCreateTime())
+                .orderByDesc(IotRdDailyReportDO::getCreateTime);
+    }
+
     /**
      * 根据条件查询 瑞都 日报记录
      *