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