From e84e67c8c3f868ace842f2cbca12e64e70d21c63 Mon Sep 17 00:00:00 2001 From: wangyinsheng <2310589501@qq.com> Date: Thu, 26 Sep 2024 14:22:24 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E6=9D=A1=E4=BB=B6=E5=A4=B1=E6=95=88=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../maintenance/controller/DataInstructController.java | 17 ++++++++++++++++- .../maintenance/controller/DataRecordController.java | 3 +++ .../bigmodel/maintenance/service/DataRecordService.java | 17 ++++++++++++++++- 3 files changed, 35 insertions(+), 2 deletions(-) diff --git a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/DataInstructController.java b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/DataInstructController.java index f588e6f..1d0dfa5 100644 --- a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/DataInstructController.java +++ b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/DataInstructController.java @@ -1,5 +1,6 @@ package com.hnac.gglm.bigmodel.maintenance.controller; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.hnac.gglm.bigmodel.maintenance.dto.DeviceFuncDTO; @@ -11,6 +12,7 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import lombok.AllArgsConstructor; +import org.apache.commons.lang3.StringUtils; import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Query; import org.springblade.core.tool.api.R; @@ -47,7 +49,20 @@ public class DataInstructController { @ApiOperation("控制指令列表查询") @ApiOperationSupport(order = 3) public R> listPage(Query query, DataInstructEntity req) { - return R.data(dataInstructService.page(Condition.getPage(query),Condition.getQueryWrapper(req).lambda())); + QueryWrapper wrapper = new QueryWrapper<>(); + if (StringUtils.isNotBlank(req.getItemId())) { + wrapper.lambda().eq(DataInstructEntity::getItemId, req.getItemId()); + } + if (StringUtils.isNotBlank(req.getStationId())) { + wrapper.lambda().eq(DataInstructEntity::getStationId, req.getStationId()); + } + if (StringUtils.isNotBlank(req.getDeviceId())) { + wrapper.lambda().eq(DataInstructEntity::getDeviceId, req.getDeviceId()); + } + if (StringUtils.isNotBlank(req.getYkName())) { + wrapper.lambda().like(DataInstructEntity::getYkName, req.getYkName()); + } + return R.data(dataInstructService.page(Condition.getPage(query), wrapper)); } @DeleteMapping("/removeByIds") diff --git a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/DataRecordController.java b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/DataRecordController.java index a7d5913..4276d45 100644 --- a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/DataRecordController.java +++ b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/DataRecordController.java @@ -1,8 +1,10 @@ package com.hnac.gglm.bigmodel.maintenance.controller; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.hnac.gglm.bigmodel.maintenance.dto.DeviceAttrDTO; +import com.hnac.gglm.bigmodel.maintenance.entity.DataInstructEntity; import com.hnac.gglm.bigmodel.maintenance.entity.DataRecordEntity; import com.hnac.gglm.bigmodel.maintenance.service.DataRecordService; import com.hnac.gglm.bigmodel.maintenance.vo.DataRecordVO; @@ -11,6 +13,7 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import lombok.AllArgsConstructor; +import org.apache.commons.lang3.StringUtils; import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Query; import org.springblade.core.tool.api.R; diff --git a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/DataRecordService.java b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/DataRecordService.java index 66eaac9..a34fd0a 100644 --- a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/DataRecordService.java +++ b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/DataRecordService.java @@ -1,6 +1,7 @@ package com.hnac.gglm.bigmodel.maintenance.service; import com.baomidou.dynamic.datasource.annotation.DS; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.google.common.collect.Lists; @@ -14,6 +15,7 @@ import com.hnac.gglm.bigmodel.maintenance.vo.DataRecordVO; import com.hnac.hzinfo.sdk.v5.device.dto.DeviceAttrInfoDTO; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Query; @@ -46,7 +48,20 @@ public class DataRecordService extends BaseServiceImpl page(Query query, DataRecordEntity req) { - IPage page = super.page(Condition.getPage(query), Condition.getQueryWrapper(req).lambda()); + QueryWrapper wrapper = new QueryWrapper<>(); + if (StringUtils.isNotBlank(req.getItemId())) { + wrapper.lambda().eq(DataRecordEntity::getItemId, req.getItemId()); + } + if (StringUtils.isNotBlank(req.getStationId())) { + wrapper.lambda().eq(DataRecordEntity::getStationId, req.getStationId()); + } + if (StringUtils.isNotBlank(req.getDeviceId())) { + wrapper.lambda().eq(DataRecordEntity::getDeviceId, req.getDeviceId()); + } + if (StringUtils.isNotBlank(req.getRecordName())) { + wrapper.lambda().like(DataRecordEntity::getRecordName, req.getRecordName()); + } + IPage page = super.page(Condition.getPage(query),wrapper); if (page.getSize() == 0) { return new Page<>(); }