Browse Source

update: 演练记录查询增加时间查询条件

zhongwei
liwen 10 months ago
parent
commit
989e4c3380
  1. 7
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/RehearsalController.java
  2. 11
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IRehearsalRecordService.java
  3. 25
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalRecordServiceImpl.java

7
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<IPage<RehearsalRecordEntity>> rehearsalRecordPage(@ApiIgnore @RequestParam Map<String, Object> param, Query query) {
IPage<RehearsalRecordEntity> page = rehearsalRecordService.page(Condition.getPage(query), Condition.getQueryWrapper(
param, RehearsalRecordEntity.class).lambda().orderByDesc(RehearsalRecordEntity::getCreateTime));
IPage<RehearsalRecordEntity> page = rehearsalRecordService.rehearsalRecordPage(param, query);
return R.data(page);
}

11
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<RehearsalRecordEntity>
* @return 演练记录表VO类
*/
RehearsalRecordDetailVO getRecordDetailVOById(Long id);
/**
* 演练记录分页
* @param param 入参
* @param query 分页类
* @return 演练记录数据
*/
IPage<RehearsalRecordEntity> rehearsalRecordPage(Map<String, Object> param, Query query);
}

25
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<RehearsalRecordMappe
public RehearsalRecordDetailVO getRecordDetailVOById(Long id) {
return baseMapper.getRecordDetailVOById(id);
}
/**
* 演练记录分页
*/
@Override
public IPage<RehearsalRecordEntity> rehearsalRecordPage(Map<String, Object> param, Query query) {
QueryWrapper<RehearsalRecordEntity> 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);
}
}

Loading…
Cancel
Save