Просмотр исходного кода

- 添加WaterPlantInfo供水水厂信息数据接口

Kazerin 1 месяц назад
Родитель
Сommit
e3c2e963a4

+ 222 - 0
pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/WaterSupply/WaterPlantInfo/WaterPlantInfoController.java

@@ -0,0 +1,222 @@
+package com.zksy.web.controller.WaterSupply.WaterPlantInfo;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.zksy.WaterSupply.WaterPlantInfo.domain.WaterPlantInfo;
+import com.zksy.WaterSupply.WaterPlantInfo.service.IWaterPlantInfoService;
+import com.zksy.common.core.domain.AjaxResult;
+import com.zksy.common.utils.SecurityUtils;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import io.swagger.annotations.ApiResponse;
+import io.swagger.annotations.ApiResponses;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.time.LocalDateTime;
+import java.util.List;
+
+/**
+ * 水厂信息管理接口
+ */
+@RestController
+@RequestMapping("/api/water/plantInfo")
+@Api(tags = "供水管网-水厂信息数据接口")
+public class WaterPlantInfoController {
+
+    private static final Logger log = LoggerFactory.getLogger(WaterPlantInfoController.class);
+
+    @Autowired
+    private IWaterPlantInfoService waterPlantInfoService;
+
+    // -------------------------- 基础CRUD接口 --------------------------
+    @GetMapping("/page")
+    @ApiOperation(value = "分页查询水厂数据", notes = "支持按水厂编号、名称、状态、负责人模糊查询")
+    @ApiResponses({
+            @ApiResponse(code = 200, message = "查询成功", response = AjaxResult.class),
+            @ApiResponse(code = 500, message = "服务器内部错误,查询失败", response = AjaxResult.class)
+    })
+    public AjaxResult queryPage(
+            @ApiParam(value = "页码", defaultValue = "1") @RequestParam(defaultValue = "1") Integer pageNum,
+            @ApiParam(value = "每页大小", defaultValue = "10") @RequestParam(defaultValue = "10") Integer pageSize,
+            @ApiParam(value = "水厂编号") @RequestParam(required = false) String plantCode,
+            @ApiParam(value = "水厂名称") @RequestParam(required = false) String plantName,
+            @ApiParam(value = "运行状态(0正常 1停产)") @RequestParam(required = false) String status,
+            @ApiParam(value = "负责人") @RequestParam(required = false) String principal) {
+        try {
+            Page<WaterPlantInfo> page = new Page<>(pageNum, pageSize);
+            IPage<WaterPlantInfo> resultPage = waterPlantInfoService.queryPage(page, plantCode, plantName, status, principal);
+            return AjaxResult.success("查询成功", resultPage);
+        } catch (Exception e) {
+            log.error("分页查询水厂数据异常", e);
+            return AjaxResult.error("查询失败:" + e.getMessage());
+        }
+    }
+
+    @GetMapping("/{id}")
+    @ApiOperation(value = "根据ID查询水厂详情", notes = "传入水厂ID获取完整信息")
+    @ApiResponses({
+            @ApiResponse(code = 200, message = "查询成功", response = AjaxResult.class),
+            @ApiResponse(code = 404, message = "未找到指定ID的水厂信息", response = AjaxResult.class),
+            @ApiResponse(code = 500, message = "服务器内部错误,查询失败", response = AjaxResult.class)
+    })
+    public AjaxResult getById(
+            @ApiParam(value = "水厂ID", required = true, example = "1") @PathVariable Long id) {
+        try {
+            WaterPlantInfo data = waterPlantInfoService.getById(id);
+            return data == null ? AjaxResult.warn("未找到该水厂信息") : AjaxResult.success("查询成功", data);
+        } catch (Exception e) {
+            log.error("查询水厂详情异常", e);
+            return AjaxResult.error("查询失败:" + e.getMessage());
+        }
+    }
+
+    @PostMapping
+    @ApiOperation(value = "新增水厂信息", notes = "传入水厂实体对象进行新增")
+    @ApiResponses({
+            @ApiResponse(code = 200, message = "新增成功", response = AjaxResult.class),
+            @ApiResponse(code = 400, message = "请求参数错误", response = AjaxResult.class),
+            @ApiResponse(code = 500, message = "服务器内部错误,新增失败", response = AjaxResult.class)
+    })
+    public AjaxResult add(@RequestBody WaterPlantInfo waterPlantInfo) {
+        try {
+            waterPlantInfo.setDelFlag("0");
+            try {
+                waterPlantInfo.setCreateBy(SecurityUtils.getUsername());
+            } catch (Exception e) {
+                waterPlantInfo.setCreateBy("system");
+            }
+            waterPlantInfo.setCreateTime(LocalDateTime.now());
+            boolean result = waterPlantInfoService.save(waterPlantInfo);
+            return result ? AjaxResult.success("新增成功") : AjaxResult.error("新增失败");
+        } catch (Exception e) {
+            log.error("新增水厂信息异常", e);
+            return AjaxResult.error("新增失败:" + e.getMessage());
+        }
+    }
+
+    @PutMapping
+    @ApiOperation(value = "修改水厂信息", notes = "传入水厂实体对象进行修改,仅更新非空字段")
+    @ApiResponses({
+            @ApiResponse(code = 200, message = "修改成功", response = AjaxResult.class),
+            @ApiResponse(code = 400, message = "请求参数错误", response = AjaxResult.class),
+            @ApiResponse(code = 500, message = "服务器内部错误,修改失败", response = AjaxResult.class)
+    })
+    public AjaxResult update(@RequestBody WaterPlantInfo waterPlantInfo) {
+        try {
+            // 禁止修改关键字段
+            waterPlantInfo.setDelFlag(null);
+            waterPlantInfo.setCreateBy(null);
+            waterPlantInfo.setCreateTime(null);
+
+            try {
+                waterPlantInfo.setUpdateBy(SecurityUtils.getUsername());
+            } catch (Exception e) {
+                waterPlantInfo.setUpdateBy("system");
+            }
+            waterPlantInfo.setUpdateTime(LocalDateTime.now());
+
+            boolean result = waterPlantInfoService.updateById(waterPlantInfo);
+            return result ? AjaxResult.success("修改成功") : AjaxResult.error("修改失败");
+        } catch (Exception e) {
+            log.error("修改水厂信息异常", e);
+            return AjaxResult.error("修改失败:" + e.getMessage());
+        }
+    }
+
+    @DeleteMapping("/{ids}")
+    @ApiOperation(value = "批量逻辑删除水厂信息", notes = "多个ID用逗号分隔,逻辑删除(移入回收站),不物理删除数据")
+    @ApiResponses({
+            @ApiResponse(code = 200, message = "修改成功", response = AjaxResult.class),
+            @ApiResponse(code = 400, message = "请求参数错误", response = AjaxResult.class),
+            @ApiResponse(code = 500, message = "服务器内部错误,修改失败", response = AjaxResult.class)
+    })
+    public AjaxResult remove(
+            @ApiParam(value = "水厂ID数组,多个用逗号分隔", required = true, example = "1,2,3") @PathVariable Long[] ids) {
+        try {
+            log.info("开始删除水厂数据,ids: {}", (Object) ids);
+            boolean result = waterPlantInfoService.removeByIds(List.of(ids));
+            return result
+                    ? AjaxResult.success("删除成功,已移入回收站,共删除 " + ids.length + " 条数据")
+                    : AjaxResult.error("删除失败");
+        } catch (Exception e) {
+            log.error("删除水厂数据异常", e);
+            return AjaxResult.error("删除失败:" + e.getMessage());
+        }
+    }
+
+    // -------------------------- 回收站接口 --------------------------
+    @GetMapping("/recycle/list")
+    @ApiOperation(value = "查询回收站数据", notes = "分页查询已删除的水厂数据,支持筛选")
+    @ApiResponses({
+            @ApiResponse(code = 200, message = "查询成功", response = AjaxResult.class),
+            @ApiResponse(code = 500, message = "服务器内部错误,查询失败", response = AjaxResult.class)
+    })
+    public AjaxResult recycleList(
+            @ApiParam(value = "页码", defaultValue = "1") @RequestParam(defaultValue = "1") Integer pageNum,
+            @ApiParam(value = "每页大小", defaultValue = "10") @RequestParam(defaultValue = "10") Integer pageSize,
+            @ApiParam(value = "水厂编号") @RequestParam(required = false) String plantCode,
+            @ApiParam(value = "水厂名称") @RequestParam(required = false) String plantName,
+            @ApiParam(value = "运行状态(0正常 1停产)") @RequestParam(required = false) String status) {
+        try {
+            Page<WaterPlantInfo> page = new Page<>(pageNum, pageSize);
+            IPage<WaterPlantInfo> resultPage = waterPlantInfoService.queryDeletedPage(page, plantCode, plantName, status);
+            return AjaxResult.success("查询成功", resultPage);
+        } catch (Exception e) {
+            log.error("查询回收站数据异常", e);
+            return AjaxResult.error("查询失败:" + e.getMessage());
+        }
+    }
+
+    @PostMapping("/recycle/restore/{ids}")
+    @ApiOperation(value = "批量恢复已删除数据", notes = "多个ID用逗号分隔,将数据从回收站恢复为正常状态")
+    @ApiResponses({
+            @ApiResponse(code = 200, message = "恢复成功", response = AjaxResult.class),
+            @ApiResponse(code = 400, message = "请选择要恢复的数据", response = AjaxResult.class),
+            @ApiResponse(code = 500, message = "服务器内部错误,恢复失败", response = AjaxResult.class)
+    })
+    public AjaxResult restore(
+            @ApiParam(value = "水厂ID数组,多个用逗号分隔", required = true, example = "3,4") @PathVariable Long[] ids) {
+        try {
+            log.info("开始恢复水厂数据,ids: {}", (Object) ids);
+            String updateBy = "system";
+            try {
+                updateBy = SecurityUtils.getUsername();
+            } catch (Exception e) {
+                log.warn("未获取到登录用户,使用默认值system");
+            }
+
+            boolean result = waterPlantInfoService.restoreByIds(List.of(ids), updateBy);
+            return result
+                    ? AjaxResult.success("恢复成功,共恢复 " + ids.length + " 条数据")
+                    : AjaxResult.error("恢复失败");
+        } catch (Exception e) {
+            log.error("恢复数据异常", e);
+            return AjaxResult.error("恢复失败:" + e.getMessage());
+        }
+    }
+
+    @DeleteMapping("/recycle/delete/{ids}")
+    @ApiOperation(value = "批量彻底删除数据(不可恢复)", notes = "多个ID用逗号分隔,物理删除数据库中的数据,谨慎使用")
+    @ApiResponses({
+            @ApiResponse(code = 200, message = "恢复成功", response = AjaxResult.class),
+            @ApiResponse(code = 400, message = "请选择要恢复的数据", response = AjaxResult.class),
+            @ApiResponse(code = 500, message = "服务器内部错误,恢复失败", response = AjaxResult.class)
+    })
+    public AjaxResult deletePhysically(
+            @ApiParam(value = "水厂ID数组,多个用逗号分隔", required = true, example = "5") @PathVariable Long[] ids) {
+        try {
+            log.info("开始彻底删除水厂数据,ids: {}", (Object) ids);
+            boolean result = waterPlantInfoService.deleteByIdsPhysically(List.of(ids));
+            return result
+                    ? AjaxResult.success("彻底删除成功,共删除 " + ids.length + " 条数据")
+                    : AjaxResult.error("彻底删除失败");
+        } catch (Exception e) {
+            log.error("彻底删除数据异常", e);
+            return AjaxResult.error("彻底删除失败:" + e.getMessage());
+        }
+    }
+}

+ 197 - 0
pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/WaterPlantInfo/domain/WaterPlantInfo.java

@@ -0,0 +1,197 @@
+package com.zksy.WaterSupply.WaterPlantInfo.domain;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+
+/**
+ * 水厂信息实体
+ */
+@Data
+@TableName("water_plant_info")
+@ApiModel(
+        value = "WaterPlantInfo",
+        description = "水厂信息对象,包含供水水厂的所有基础属性"
+)
+public class WaterPlantInfo {
+
+    @ApiModelProperty(
+            value = "主键ID",
+            example = "0",
+            position = 1,
+            notes = "数据库自增主键,新增时不需要传入"
+    )
+    @TableId(type = IdType.AUTO)
+    private Long id;
+
+    @ApiModelProperty(
+            value = "水厂编号",
+            example = "WP001",
+            required = true,
+            position = 2,
+            notes = "水厂唯一标识,系统内唯一"
+    )
+    private String plantCode;
+
+    @ApiModelProperty(
+            value = "水厂名称",
+            example = "XX自来水厂",
+            required = true,
+            position = 3,
+            notes = "水厂的中文名称,用于显示"
+    )
+    private String plantName;
+
+    @ApiModelProperty(
+            value = "水厂地址",
+            example = "XX大道88号",
+            position = 4,
+            notes = "水厂的详细地理位置"
+    )
+    private String location;
+
+    @ApiModelProperty(
+            value = "水源类型",
+            example = "地表水",
+            position = 5,
+            notes = "水源类型"
+    )
+    private String waterSourceType;
+
+    @ApiModelProperty(
+            value = "设计日供水能力",
+            example = "10.00",
+            position = 6,
+            notes = "水厂设计日供水能力,单位:万立方米/天(万m³/d)"
+    )
+    private BigDecimal designCapacity;
+
+    @ApiModelProperty(
+            value = "实际日供水能力",
+            example = "8.50",
+            position = 7,
+            notes = "水厂实际日供水能力,单位:万立方米/天(万m³/d)"
+    )
+    private BigDecimal currentCapacity;
+
+    @ApiModelProperty(
+            value = "处理工艺",
+            example = "混凝-沉淀-过滤-消毒",
+            position = 8,
+            notes = "水厂采用的水处理工艺流程"
+    )
+    private String treatmentProcess;
+
+    @ApiModelProperty(
+            value = "投运日期",
+            example = "2026-06-20",
+            position = 9,
+            notes = "水厂正式投入运行的日期"
+    )
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private LocalDate commissionDate;
+
+    @ApiModelProperty(
+            value = "水质执行标准",
+            example = "GB5749-2022",
+            position = 10,
+            notes = "水厂出水水质执行的国家标准"
+    )
+    private String waterQualityStandard;
+
+    @ApiModelProperty(
+            value = "运行状态",
+            example = "0",
+            allowableValues = "0,1",
+            position = 11,
+            notes = "0-正常运行,1-停产"
+    )
+    private String status;
+
+    @ApiModelProperty(
+            value = "负责人",
+            example = "李四",
+            position = 12,
+            notes = "水厂日常运维负责人姓名"
+    )
+    private String principal;
+
+    @ApiModelProperty(
+            value = "联系电话",
+            example = "13800000000",
+            position = 13,
+            notes = "负责人联系电话"
+    )
+    private String contactPhone;
+
+    @ApiModelProperty(
+            value = "备注",
+            example = "主要供水水厂",
+            position = 14,
+            notes = "其他补充说明信息"
+    )
+    private String remark;
+
+    @ApiModelProperty(
+            value = "删除标志",
+            example = "0",
+            allowableValues = "0,2",
+            hidden = true,
+            position = 15,
+            notes = "0-正常存在,2-已删除(逻辑删除)"
+    )
+    @TableLogic
+    private String delFlag;
+
+    @ApiModelProperty(
+            value = "创建者",
+            example = "admin",
+            hidden = true,
+            position = 16,
+            notes = "创建该记录的用户账号"
+    )
+    @TableField(fill = com.baomidou.mybatisplus.annotation.FieldFill.INSERT)
+    private String createBy;
+
+    @ApiModelProperty(
+            value = "创建时间",
+            example = "2026-05-25 09:00:00",
+            hidden = true,
+            position = 17,
+            notes = "记录创建的时间"
+    )
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField(fill = com.baomidou.mybatisplus.annotation.FieldFill.INSERT)
+    private LocalDateTime createTime;
+
+    @ApiModelProperty(
+            value = "更新者",
+            example = "admin",
+            hidden = true,
+            position = 18,
+            notes = "最后修改该记录的用户账号"
+    )
+    @TableField(fill = com.baomidou.mybatisplus.annotation.FieldFill.UPDATE)
+    private String updateBy;
+
+    @ApiModelProperty(
+            value = "更新时间",
+            example = "2026-05-25 10:00:00",
+            hidden = true,
+            position = 19,
+            notes = "记录最后修改的时间"
+    )
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField(fill = com.baomidou.mybatisplus.annotation.FieldFill.UPDATE)
+    private LocalDateTime updateTime;
+}

+ 37 - 0
pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/WaterPlantInfo/mapper/WaterPlantInfoMapper.java

@@ -0,0 +1,37 @@
+package com.zksy.WaterSupply.WaterPlantInfo.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.zksy.WaterSupply.WaterPlantInfo.domain.WaterPlantInfo;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+public interface WaterPlantInfoMapper extends BaseMapper<WaterPlantInfo> {
+
+    /**
+     * 条件查询水厂列表
+     */
+    List<WaterPlantInfo> selectPlantList(
+            @Param("plantCode") String plantCode,
+            @Param("plantName") String plantName,
+            @Param("status") String status,
+            @Param("principal") String principal);
+
+    /**
+     * 查询已删除的水厂数据
+     */
+    List<WaterPlantInfo> selectDeletedList(
+            @Param("plantCode") String plantCode,
+            @Param("plantName") String plantName,
+            @Param("status") String status);
+
+    /**
+     * 批量恢复已删除数据
+     */
+    int restoreByIds(@Param("ids") List<Long> ids, @Param("updateBy") String updateBy);
+
+    /**
+     * 批量彻底物理删除数据
+     */
+    int deleteByIdsPhysically(@Param("ids") List<Long> ids);
+}

+ 38 - 0
pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/WaterPlantInfo/service/IWaterPlantInfoService.java

@@ -0,0 +1,38 @@
+package com.zksy.WaterSupply.WaterPlantInfo.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.zksy.WaterSupply.WaterPlantInfo.domain.WaterPlantInfo;
+
+import java.util.List;
+
+public interface IWaterPlantInfoService extends IService<WaterPlantInfo> {
+
+    /**
+     * 分页查询水厂数据
+     */
+    IPage<WaterPlantInfo> queryPage(Page<WaterPlantInfo> page,
+                                    String plantCode,
+                                    String plantName,
+                                    String status,
+                                    String principal);
+
+    /**
+     * 分页查询回收站数据
+     */
+    IPage<WaterPlantInfo> queryDeletedPage(Page<WaterPlantInfo> page,
+                                           String plantCode,
+                                           String plantName,
+                                           String status);
+
+    /**
+     * 批量恢复已删除数据
+     */
+    boolean restoreByIds(List<Long> ids, String updateBy);
+
+    /**
+     * 批量彻底物理删除数据
+     */
+    boolean deleteByIdsPhysically(List<Long> ids);
+}

+ 55 - 0
pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/WaterPlantInfo/service/impl/WaterPlantInfoServiceImpl.java

@@ -0,0 +1,55 @@
+package com.zksy.WaterSupply.WaterPlantInfo.service.impl;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.zksy.WaterSupply.WaterPlantInfo.domain.WaterPlantInfo;
+import com.zksy.WaterSupply.WaterPlantInfo.mapper.WaterPlantInfoMapper;
+import com.zksy.WaterSupply.WaterPlantInfo.service.IWaterPlantInfoService;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class WaterPlantInfoServiceImpl extends ServiceImpl<WaterPlantInfoMapper, WaterPlantInfo>
+        implements IWaterPlantInfoService {
+
+    @Override
+    public IPage<WaterPlantInfo> queryPage(Page<WaterPlantInfo> page,
+                                           String plantCode,
+                                           String plantName,
+                                           String status,
+                                           String principal) {
+        List<WaterPlantInfo> list = baseMapper.selectPlantList(plantCode, plantName, status, principal);
+        page.setRecords(list);
+        page.setTotal(list.size());
+        return page;
+    }
+
+    @Override
+    public IPage<WaterPlantInfo> queryDeletedPage(Page<WaterPlantInfo> page,
+                                                  String plantCode,
+                                                  String plantName,
+                                                  String status) {
+        List<WaterPlantInfo> list = baseMapper.selectDeletedList(plantCode, plantName, status);
+        page.setRecords(list);
+        page.setTotal(list.size());
+        return page;
+    }
+
+    @Override
+    public boolean restoreByIds(List<Long> ids, String updateBy) {
+        if (ids == null || ids.isEmpty()) {
+            return false;
+        }
+        return baseMapper.restoreByIds(ids, updateBy) > 0;
+    }
+
+    @Override
+    public boolean deleteByIdsPhysically(List<Long> ids) {
+        if (ids == null || ids.isEmpty()) {
+            return false;
+        }
+        return baseMapper.deleteByIdsPhysically(ids) > 0;
+    }
+}

+ 88 - 0
pipe-network-service/zksy-system/src/main/resources/mapper/WaterSupply/WaterPlantInfo/WaterPlantInfoMapper.xml

@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.zksy.WaterSupply.WaterPlantInfo.mapper.WaterPlantInfoMapper">
+
+    <resultMap id="BaseResultMap" type="com.zksy.WaterSupply.WaterPlantInfo.domain.WaterPlantInfo">
+        <id column="id" property="id" />
+        <result column="plant_code" property="plantCode" />
+        <result column="plant_name" property="plantName" />
+        <result column="location" property="location" />
+        <result column="water_source_type" property="waterSourceType" />
+        <result column="design_capacity" property="designCapacity" />
+        <result column="current_capacity" property="currentCapacity" />
+        <result column="treatment_process" property="treatmentProcess" />
+        <result column="commission_date" property="commissionDate" />
+        <result column="water_quality_standard" property="waterQualityStandard" />
+        <result column="status" property="status" />
+        <result column="principal" property="principal" />
+        <result column="contact_phone" property="contactPhone" />
+        <result column="remark" property="remark" />
+        <result column="del_flag" property="delFlag" />
+        <result column="create_by" property="createBy" />
+        <result column="create_time" property="createTime" />
+        <result column="update_by" property="updateBy" />
+        <result column="update_time" property="updateTime" />
+    </resultMap>
+
+    <sql id="Base_Column_List">
+        id, plant_code, plant_name, location, water_source_type, design_capacity,
+        current_capacity, treatment_process, commission_date, water_quality_standard,
+        status, principal, contact_phone, remark, del_flag, create_by, create_time,
+        update_by, update_time
+    </sql>
+
+    <!-- 条件查询水厂列表 -->
+    <select id="selectPlantList" resultMap="BaseResultMap">
+        SELECT <include refid="Base_Column_List"/>
+        FROM water_plant_info
+        WHERE del_flag = '0'
+        <if test="plantCode != null and plantCode != ''">
+            AND plant_code LIKE CONCAT('%', #{plantCode}, '%')
+        </if>
+        <if test="plantName != null and plantName != ''">
+            AND plant_name LIKE CONCAT('%', #{plantName}, '%')
+        </if>
+        <if test="status != null and status != ''">
+            AND status = #{status}
+        </if>
+        <if test="principal != null and principal != ''">
+            AND principal LIKE CONCAT('%', #{principal}, '%')
+        </if>
+        ORDER BY create_time DESC
+    </select>
+
+    <select id="selectDeletedList" resultMap="BaseResultMap">
+        SELECT <include refid="Base_Column_List"/>
+        FROM water_plant_info
+        WHERE del_flag = '2'
+        <if test="plantCode != null and plantCode != ''">
+            AND plant_code LIKE CONCAT('%', #{plantCode}, '%')
+        </if>
+        <if test="plantName != null and plantName != ''">
+            AND plant_name LIKE CONCAT('%', #{plantName}, '%')
+        </if>
+        <if test="status != null and status != ''">
+            AND status = #{status}
+        </if>
+        ORDER BY update_time DESC
+    </select>
+
+    <update id="restoreByIds">
+        UPDATE water_plant_info
+        SET del_flag = '0',
+        update_by = #{updateBy},
+        update_time = NOW()
+        WHERE id IN
+        <foreach collection="ids" item="id" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </update>
+
+    <delete id="deleteByIdsPhysically">
+        DELETE FROM water_plant_info WHERE id IN
+        <foreach collection="ids" item="id" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+
+</mapper>