Browse Source

fix:修复查询条件失效的问题

zhongwei
wangyinsheng 2 months ago
parent
commit
e84e67c8c3
  1. 17
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/DataInstructController.java
  2. 3
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/controller/DataRecordController.java
  3. 17
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/DataRecordService.java

17
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<IPage<DataInstructEntity>> listPage(Query query, DataInstructEntity req) {
return R.data(dataInstructService.page(Condition.getPage(query),Condition.getQueryWrapper(req).lambda()));
QueryWrapper<DataInstructEntity> 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")

3
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;

17
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<DataRecordMapper, DataRec
}
public IPage<DataRecordVO> page(Query query, DataRecordEntity req) {
IPage<DataRecordEntity> page = super.page(Condition.getPage(query), Condition.getQueryWrapper(req).lambda());
QueryWrapper<DataRecordEntity> 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<DataRecordEntity> page = super.page(Condition.getPage(query),wrapper);
if (page.getSize() == 0) {
return new Page<>();
}

Loading…
Cancel
Save