|
@@ -2,8 +2,10 @@ package com.usky.fire.service.impl;
|
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.usky.common.core.bean.CommonPage;
|
|
|
import com.usky.common.mybatis.core.AbstractCrudService;
|
|
|
import com.usky.common.security.utils.SecurityUtils;
|
|
@@ -11,7 +13,6 @@ import com.usky.fire.domain.*;
|
|
|
import com.usky.fire.mapper.PatrolInspectionPlanMapper;
|
|
|
import com.usky.fire.mapper.PatrolInspectionRecordMapper;
|
|
|
import com.usky.fire.service.*;
|
|
|
-import com.usky.fire.service.util.OnlineMethod;
|
|
|
import com.usky.fire.service.vo.*;
|
|
|
import com.usky.system.model.LoginUser;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -60,42 +61,23 @@ public class PatrolInspectionRecordServiceImpl extends AbstractCrudService<Patro
|
|
|
public CommonPage<PatrolInspectionRecord> patrolInspectionRecordLsit(String areaName, String siteName, String name,
|
|
|
Integer planType, String startDateTime, String endDateTime,
|
|
|
Integer pageNum, Integer pageSize) {
|
|
|
+ IPage<PatrolInspectionRecord> page = new Page<>(pageNum, pageSize);
|
|
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
|
|
String userType = null;
|
|
|
if (loginUser != null && !"".equals(loginUser)) {
|
|
|
userType = loginUser.getUserType();
|
|
|
}
|
|
|
LambdaQueryWrapper<PatrolInspectionRecord> queryWrapper = Wrappers.lambdaQuery();
|
|
|
- queryWrapper.eq(PatrolInspectionRecord::getTenantId, SecurityUtils.getTenantId());
|
|
|
- if ("00".equals(userType)) {
|
|
|
- queryWrapper.eq(PatrolInspectionRecord::getCreator, SecurityUtils.getUsername());
|
|
|
- }
|
|
|
- if (areaName != null && "".equals(areaName)) {
|
|
|
- queryWrapper.like(PatrolInspectionRecord::getAreaName, areaName);
|
|
|
- }
|
|
|
- if (siteName != null && "".equals(siteName)) {
|
|
|
- queryWrapper.like(PatrolInspectionRecord::getSiteName, siteName);
|
|
|
- }
|
|
|
- if (name != null && "".equals(name)) {
|
|
|
- queryWrapper.like(PatrolInspectionRecord::getName, name);
|
|
|
- }
|
|
|
- if (planType != null && planType != 0) {
|
|
|
- queryWrapper.eq(PatrolInspectionRecord::getPlanType, planType);
|
|
|
- }
|
|
|
- if (startDateTime != null && "".equals(startDateTime) && endDateTime != null && "".equals(endDateTime)) {
|
|
|
- queryWrapper.between(PatrolInspectionRecord::getCreateTime, startDateTime, endDateTime);
|
|
|
- }
|
|
|
-
|
|
|
- Integer total = this.count(queryWrapper);
|
|
|
+ queryWrapper.eq(PatrolInspectionRecord::getTenantId, SecurityUtils.getTenantId())
|
|
|
+ .like(StringUtils.isNotBlank(areaName), PatrolInspectionRecord::getAreaName, areaName)
|
|
|
+ .like(StringUtils.isNotBlank(siteName), PatrolInspectionRecord::getSiteName, siteName)
|
|
|
+ .like(StringUtils.isNotBlank(name), PatrolInspectionRecord::getName, name)
|
|
|
+ .eq(planType != null && planType != 0, PatrolInspectionRecord::getPlanType, planType)
|
|
|
+ .between(StringUtils.isNotBlank(startDateTime) && StringUtils.isNotBlank(endDateTime), PatrolInspectionRecord::getCreateTime, startDateTime, endDateTime)
|
|
|
+ .eq("00".equals(userType), PatrolInspectionRecord::getCreator, SecurityUtils.getUsername());
|
|
|
queryWrapper.orderByDesc(PatrolInspectionRecord::getId);
|
|
|
- if (pageNum != null && pageNum != 0 && pageSize != null && pageSize != 0) {
|
|
|
- Integer startFate = OnlineMethod.getStartFate(pageNum, pageSize);
|
|
|
- queryWrapper.last("limit " + startFate + "," + pageSize);
|
|
|
- }
|
|
|
-
|
|
|
- List<PatrolInspectionRecord> patrolInspectionRecordList = this.list(queryWrapper);
|
|
|
-// List<PatrolInspectionRecord> list = patrolInspectionRecordList.stream().skip((pageNum - 1) * pageSize).limit(pageSize).collect(Collectors.toList());
|
|
|
- return new CommonPage<>(patrolInspectionRecordList, total, pageSize, pageNum);
|
|
|
+ page = this.page(page, queryWrapper);
|
|
|
+ return new CommonPage<>(page.getRecords(), page.getTotal(), pageSize, pageNum);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -347,25 +329,13 @@ public class PatrolInspectionRecordServiceImpl extends AbstractCrudService<Patro
|
|
|
userType = loginUser.getUserType();
|
|
|
}
|
|
|
LambdaQueryWrapper<PatrolInspectionRecord> queryWrapper = Wrappers.lambdaQuery();
|
|
|
- queryWrapper.eq(PatrolInspectionRecord::getTenantId, SecurityUtils.getTenantId());
|
|
|
- if ("00".equals(userType)) {
|
|
|
- queryWrapper.eq(PatrolInspectionRecord::getCreator, SecurityUtils.getUsername());
|
|
|
- }
|
|
|
- if (StringUtils.isNotBlank(areaName)) {
|
|
|
- queryWrapper.like(PatrolInspectionRecord::getAreaName, areaName);
|
|
|
- }
|
|
|
- if (StringUtils.isNotBlank(siteName)) {
|
|
|
- queryWrapper.like(PatrolInspectionRecord::getSiteName, siteName);
|
|
|
- }
|
|
|
- if (StringUtils.isNotBlank(name)) {
|
|
|
- queryWrapper.like(PatrolInspectionRecord::getName, name);
|
|
|
- }
|
|
|
- if (planType != null && planType != 0) {
|
|
|
- queryWrapper.eq(PatrolInspectionRecord::getPlanType, planType);
|
|
|
- }
|
|
|
- if (StringUtils.isNotBlank(startDateTime) && StringUtils.isNotBlank(endDateTime)) {
|
|
|
- queryWrapper.between(PatrolInspectionRecord::getCreateTime, startDateTime, endDateTime);
|
|
|
- }
|
|
|
+ queryWrapper.eq(PatrolInspectionRecord::getTenantId, SecurityUtils.getTenantId())
|
|
|
+ .like(StringUtils.isNotBlank(areaName), PatrolInspectionRecord::getAreaName, areaName)
|
|
|
+ .like(StringUtils.isNotBlank(siteName), PatrolInspectionRecord::getSiteName, siteName)
|
|
|
+ .like(StringUtils.isNotBlank(name), PatrolInspectionRecord::getName, name)
|
|
|
+ .eq(planType != null && planType != 0, PatrolInspectionRecord::getPlanType, planType)
|
|
|
+ .between(StringUtils.isNotBlank(startDateTime) && StringUtils.isNotBlank(endDateTime), PatrolInspectionRecord::getCreateTime, startDateTime, endDateTime)
|
|
|
+ .eq("00".equals(userType), PatrolInspectionRecord::getCreator, SecurityUtils.getUsername());
|
|
|
if (StringUtils.isNotBlank(idList)) {
|
|
|
List<Integer> listId = new ArrayList<>();
|
|
|
String[] idArray = idList.split(",");
|