Explorar el Código

add pipe diameter and laying year filters

Kazerin hace 1 semana
padre
commit
ffc04855d7

+ 2 - 2
pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/WaterSupply/WaterFacilityExportController.java

@@ -63,8 +63,8 @@ public class WaterFacilityExportController {
     @GetMapping("/pipe/export")
     @Log(title = "导出管网信息", businessType = BusinessType.EXPORT)
     @PreAuthorize("@ss.hasPermi('waterSupply:waterPipe:export')")
-    public void pipeExport(HttpServletResponse response, @RequestParam(required = false) String pipeCode, @RequestParam(required = false) String pipeName, @RequestParam(required = false) String pipeMaterial, @RequestParam(required = false) String status, @RequestParam(required = false) LocalDateTime startTime, @RequestParam(required = false) LocalDateTime endTime) {
-        var page = pipeService.queryPage(new Page<WaterPipeInfo>(1, Integer.MAX_VALUE), pipeCode, pipeName, pipeMaterial, status, startTime, endTime);
+    public void pipeExport(HttpServletResponse response, @RequestParam(required = false) String pipeCode, @RequestParam(required = false) String pipeName, @RequestParam(required = false) String pipeMaterial, @RequestParam(required = false) String status, @RequestParam(required = false) Integer pipeDiameter, @RequestParam(required = false) Integer layingYear, @RequestParam(required = false) LocalDateTime startTime, @RequestParam(required = false) LocalDateTime endTime) {
+        var page = pipeService.queryPage(new Page<WaterPipeInfo>(1, Integer.MAX_VALUE), pipeCode, pipeName, pipeMaterial, status, pipeDiameter, layingYear, startTime, endTime);
         new ExcelUtil<>(WaterPipeExportDTO.class).exportExcel(response, page.getRecords().stream().map(WaterPipeExportDTO::from).collect(Collectors.toList()), "管网信息");
     }
 

+ 4 - 2
pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/WaterSupply/WaterPipeInfo/WaterPipeInfoController.java

@@ -48,11 +48,13 @@ public class WaterPipeInfoController {
             @ApiParam(value = "管网名称") @RequestParam(required = false) String pipeName,
             @ApiParam(value = "管网材质") @RequestParam(required = false) String pipeMaterial,
             @ApiParam(value = "状态(0正常 1停用)") @RequestParam(required = false) String status,
+            @ApiParam(value = "管径(毫米)") @RequestParam(required = false) Integer pipeDiameter,
+            @ApiParam(value = "铺设年份") @RequestParam(required = false) Integer layingYear,
             @ApiParam(value = "开始时间(格式:yyyy-MM-dd HH:mm:ss)", example = "2026-01-01 00:00:00") @RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime startTime,
             @ApiParam(value = "结束时间(格式:yyyy-MM-dd HH:mm:ss)", example = "2026-12-31 23:59:59") @RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime endTime) {
         try {
             Page<WaterPipeInfo> page = new Page<>(pageNum, pageSize);
-            IPage<WaterPipeInfo> resultPage = waterPipeInfoService.queryPage(page, pipeCode, pipeName, pipeMaterial, status, startTime, endTime);
+            IPage<WaterPipeInfo> resultPage = waterPipeInfoService.queryPage(page, pipeCode, pipeName, pipeMaterial, status, pipeDiameter, layingYear, startTime, endTime);
             return AjaxResult.success("查询成功", resultPage);
         } catch (Exception e) {
             log.error("分页查询管网数据异常", e);
@@ -287,4 +289,4 @@ public class WaterPipeInfoController {
             return AjaxResult.error("彻底删除失败:" + e.getMessage());
         }
     }
-}
+}

+ 3 - 1
pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/WaterPipeInfo/service/IWaterPipeInfoService.java

@@ -22,6 +22,8 @@ public interface IWaterPipeInfoService extends IService<WaterPipeInfo> {
                                    String pipeName,
                                    String pipeMaterial,
                                    String status,
+                                   Integer pipeDiameter,
+                                   Integer layingYear,
                                    LocalDateTime startTime,
                                    LocalDateTime endTime);
 
@@ -64,4 +66,4 @@ public interface IWaterPipeInfoService extends IService<WaterPipeInfo> {
      * 批量彻底物理删除数据
      */
     boolean deleteByIdsPhysically(List<Long> ids);
-}
+}

+ 4 - 0
pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/WaterPipeInfo/service/impl/WaterPipeInfoServiceImpl.java

@@ -23,6 +23,8 @@ public class WaterPipeInfoServiceImpl extends ServiceImpl<WaterPipeInfoMapper, W
                                           String pipeName,
                                           String pipeMaterial,
                                           String status,
+                                          Integer pipeDiameter,
+                                          Integer layingYear,
                                           LocalDateTime startTime,
                                           LocalDateTime endTime) {
         LambdaQueryWrapper<WaterPipeInfo> query = new LambdaQueryWrapper<WaterPipeInfo>()
@@ -30,6 +32,8 @@ public class WaterPipeInfoServiceImpl extends ServiceImpl<WaterPipeInfoMapper, W
                 .like(pipeName != null && !pipeName.isEmpty(), WaterPipeInfo::getPipeName, pipeName)
                 .eq(pipeMaterial != null && !pipeMaterial.isEmpty(), WaterPipeInfo::getPipeMaterial, pipeMaterial)
                 .eq(status != null && !status.isEmpty(), WaterPipeInfo::getStatus, status)
+                .eq(pipeDiameter != null, WaterPipeInfo::getPipeDiameter, pipeDiameter)
+                .eq(layingYear != null, WaterPipeInfo::getLayingYear, layingYear)
                 .ge(startTime != null, WaterPipeInfo::getCreateTime, startTime)
                 .le(endTime != null, WaterPipeInfo::getCreateTime, endTime)
                 .orderByDesc(WaterPipeInfo::getCreateTime);

+ 1 - 1
pipe-network-service/zksy-system/src/test/java/com/zksy/WaterSupply/WaterFacilityQueryServiceTest.java

@@ -40,7 +40,7 @@ class WaterFacilityQueryServiceTest {
         WaterPipeInfoServiceImpl service = new WaterPipeInfoServiceImpl();
         ReflectionTestUtils.setField(service, "baseMapper", mapper);
 
-        IPage<WaterPipeInfo> actual = service.queryPage(new Page<>(2, 20), "P-1", "主干", "PE", "0", null, null);
+        IPage<WaterPipeInfo> actual = service.queryPage(new Page<>(2, 20), "P-1", "主干", "PE", "0", 300, 2020, null, null);
 
         assertEquals(expected, actual);
         verify(mapper).selectPage(ArgumentMatchers.any(), ArgumentMatchers.any());