Forráskód Böngészése

设备台账导出

lipenghui 9 órája
szülő
commit
05c483757a

+ 1 - 1
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/IotDeviceController.java

@@ -577,7 +577,7 @@ public class IotDeviceController {
     public void exportIotDeviceExcel(@Valid IotDevicePageReqVO pageReqVO,@Valid SortablePageParam pageParam,
               HttpServletResponse response) throws IOException {
         pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
-        List<IotDeviceDO> list = iotDeviceService.getIotDevicePage(pageReqVO, pageParam).getList();
+        List<IotDeviceDO> list = iotDeviceService.getAllDevices(pageReqVO);
         // 导出 Excel
         ExcelUtils.write(response, "设备台账.xls", "数据", IotDeviceRespVO.class,
                         BeanUtils.toBean(list, IotDeviceRespVO.class));

+ 2 - 1
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/mysql/IotDeviceMapper.java

@@ -18,6 +18,7 @@ import org.apache.ibatis.annotations.Update;
 
 import java.util.Collection;
 import java.util.List;
+import java.util.Objects;
 import java.util.Set;
 
 /**
@@ -71,7 +72,7 @@ public interface IotDeviceMapper extends BaseMapperX<IotDeviceDO> {
                 .or()
                 .like(StringUtils.isNotBlank(reqVO.getCommonParam()), IotDeviceDO::getDeviceCode, reqVO.getCommonParam())
                 .or()
-                .like(StringUtils.isNotBlank(reqVO.getCommonParam()), IotDeviceDO::getChargeName, reqVO.getCommonParam())
+                .eq(Objects.nonNull(reqVO.getDeptId()), IotDeviceDO::getDeptId, reqVO.getDeptId())
                 ;
         return selectPage(sortablePageParam, wrapper);
     }

+ 6 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/IotDeviceServiceImpl.java

@@ -495,6 +495,12 @@ public class IotDeviceServiceImpl implements IotDeviceService {
             ids = deptService.getChildDeptIdListFromCache(pageReqVO.getDeptId());
             ids.add(pageReqVO.getDeptId());
         }
+        if (StringUtils.isNotBlank(pageReqVO.getCommonParam())) {
+            List<DeptRespDTO> deptByName = deptApi.getDeptByName(pageReqVO.getCommonParam());
+            if (CollUtil.isNotEmpty(deptByName)) {
+                pageReqVO.setDeptId(deptByName.get(0).getId());
+            }
+        }
 
         return iotDeviceMapper.selectPageApp(pageReqVO,ids, sortablePageParam);
     }