From 989e4c338055aacaf6ec217c79a96d95f85e50e1 Mon Sep 17 00:00:00 2001 From: liwen Date: Tue, 23 Jan 2024 14:06:04 +0800 Subject: [PATCH] =?UTF-8?q?update:=20=E6=BC=94=E7=BB=83=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E5=A2=9E=E5=8A=A0=E6=97=B6=E9=97=B4=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/RehearsalController.java | 7 +++--- .../service/IRehearsalRecordService.java | 11 ++++++++++ .../service/impl/RehearsalRecordServiceImpl.java | 25 ++++++++++++++++++++++ 3 files changed, 40 insertions(+), 3 deletions(-) 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); + } }