diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/RehearsalController.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/RehearsalController.java index afb6c70..73c8b0a 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/RehearsalController.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/RehearsalController.java @@ -112,13 +112,14 @@ public class RehearsalController extends BladeController { @GetMapping("/rehearsalRecordPage") @ApiImplicitParams({ - @ApiImplicitParam(name = "rehearsalPlanId", value = "演练计划id", dataType = "query", paramType = "string") + @ApiImplicitParam(name = "rehearsalPlanId", value = "演练计划id", dataType = "query", paramType = "string"), + @ApiImplicitParam(name = "actualStartTime", value = "计划开始时间", dataType = "query", paramType = "string"), + @ApiImplicitParam(name = "actualEndTime", value = "计划结束时间", dataType = "query", paramType = "string") }) @ApiOperation(value = "演练记录分页") @ApiOperationSupport(order = 10) public R> rehearsalRecordPage(@ApiIgnore @RequestParam Map param, Query query) { - IPage page = rehearsalRecordService.page(Condition.getPage(query), Condition.getQueryWrapper( - param, RehearsalRecordEntity.class).lambda().orderByDesc(RehearsalRecordEntity::getCreateTime)); + IPage page = rehearsalRecordService.rehearsalRecordPage(param, query); return R.data(page); } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IRehearsalRecordService.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IRehearsalRecordService.java index 83dec8b..92b08c8 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IRehearsalRecordService.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IRehearsalRecordService.java @@ -1,10 +1,13 @@ package com.hnac.hzims.safeproduct.service; +import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.IService; import com.hnac.hzims.safeproduct.entity.RehearsalRecordEntity; import com.hnac.hzims.safeproduct.vo.RehearsalRecordDetailVO; +import org.springblade.core.mp.support.Query; import javax.servlet.http.HttpServletResponse; +import java.util.Map; /** * 演练记录服务类 @@ -48,4 +51,12 @@ public interface IRehearsalRecordService extends IService * @return 演练记录表VO类 */ RehearsalRecordDetailVO getRecordDetailVOById(Long id); + + /** + * 演练记录分页 + * @param param 入参 + * @param query 分页类 + * @return 演练记录数据 + */ + IPage rehearsalRecordPage(Map param, Query query); } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalRecordServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalRecordServiceImpl.java index bcc53ee..e172ce0 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalRecordServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalRecordServiceImpl.java @@ -4,8 +4,10 @@ import cn.afterturn.easypoi.entity.ImageEntity; import cn.hutool.core.date.DatePattern; import com.alibaba.excel.util.CollectionUtils; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.hnac.hzims.common.logs.utils.StringUtils; +import com.hnac.hzims.common.utils.Condition; import com.hnac.hzims.safeproduct.constants.SafeProductConstant; import com.hnac.hzims.safeproduct.entity.RehearsalPlanEntity; import com.hnac.hzims.safeproduct.entity.RehearsalRecordEntity; @@ -17,6 +19,7 @@ import com.hnac.hzims.safeproduct.service.IRehearsalRecordService; import com.hnac.hzims.safeproduct.utils.BaseUtil; import com.hnac.hzims.safeproduct.vo.RehearsalRecordDetailVO; import lombok.extern.slf4j.Slf4j; +import org.springblade.core.mp.support.Query; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -174,4 +177,26 @@ public class RehearsalRecordServiceImpl extends ServiceImpl rehearsalRecordPage(Map param, Query query) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + String rehearsalPlanId = String.valueOf(param.get("rehearsalPlanId")); + String actualStartTime = String.valueOf(param.get("actualStartTime")); + String actualEndTime = String.valueOf(param.get("actualEndTime")); + if (!rehearsalPlanId.equals("null") && !rehearsalPlanId.equals("")) { + queryWrapper.lambda().eq(RehearsalRecordEntity::getRehearsalPlanId, rehearsalPlanId); + } + if (!actualStartTime.equals("null") && !actualStartTime.equals("")) { + queryWrapper.lambda().ge(RehearsalRecordEntity::getActualStartTime, actualStartTime); + } + if (!actualEndTime.equals("null") && !actualEndTime.equals("")) { + queryWrapper.lambda().le(RehearsalRecordEntity::getActualEndTime, actualEndTime); + } + queryWrapper.lambda().orderByDesc(RehearsalRecordEntity::getCreateTime); + return this.page(Condition.getPage(query), queryWrapper); + } }