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

- 添加WaterSourceInfo供水水源地信息数据接口

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

+ 220 - 0
pipe-network-service/zksy-admin/src/main/java/com/zksy/web/controller/WaterSupply/WaterSourceInfo/WaterSourceInfoController.java

@@ -0,0 +1,220 @@
+package com.zksy.web.controller.WaterSupply.WaterSourceInfo;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.zksy.WaterSupply.WaterSourceInfo.domain.WaterSourceInfo;
+import com.zksy.WaterSupply.WaterSourceInfo.service.IWaterSourceInfoService;
+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/sourceInfo")
+@Api(tags = "供水管网-水源地信息数据接口")
+public class WaterSourceInfoController {
+
+    private static final Logger log = LoggerFactory.getLogger(WaterSourceInfoController.class);
+
+    @Autowired
+    private IWaterSourceInfoService waterSourceInfoService;
+
+    // -------------------------- 基础CRUD接口 --------------------------
+    @GetMapping("/page")
+    @ApiOperation(value = "分页查询水源地数据", notes = "支持按水源地ID、名称、状态、所属单位模糊查询")
+    @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 = "水源地ID") @RequestParam(required = false) String sourceId,
+            @ApiParam(value = "水源地名称") @RequestParam(required = false) String sourceName,
+            @ApiParam(value = "状态(0正常 1异常)") @RequestParam(required = false) String status,
+            @ApiParam(value = "所属单位") @RequestParam(required = false) String unit) {
+        try {
+            Page<WaterSourceInfo> page = new Page<>(pageNum, pageSize);
+            IPage<WaterSourceInfo> resultPage = waterSourceInfoService.queryPage(page, sourceId, sourceName, status, unit);
+            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 = "0") @PathVariable Long id) {
+        try {
+            WaterSourceInfo data = waterSourceInfoService.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 WaterSourceInfo waterSourceInfo) {
+        try {
+            waterSourceInfo.setDelFlag("0");
+            try {
+                waterSourceInfo.setCreateBy(SecurityUtils.getUsername());
+            } catch (Exception e) {
+                waterSourceInfo.setCreateBy("system");
+            }
+            waterSourceInfo.setCreateTime(LocalDateTime.now());
+            boolean result = waterSourceInfoService.save(waterSourceInfo);
+            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 WaterSourceInfo waterSourceInfo) {
+        try {
+            waterSourceInfo.setDelFlag(null);
+            waterSourceInfo.setCreateBy(null);
+            waterSourceInfo.setCreateTime(null);
+
+            try {
+                waterSourceInfo.setUpdateBy(SecurityUtils.getUsername());
+            } catch (Exception e) {
+                waterSourceInfo.setUpdateBy("system");
+            }
+            waterSourceInfo.setUpdateTime(LocalDateTime.now());
+
+            boolean result = waterSourceInfoService.updateById(waterSourceInfo);
+            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 = waterSourceInfoService.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 = "水源地ID") @RequestParam(required = false) String sourceId,
+            @ApiParam(value = "水源地名称") @RequestParam(required = false) String sourceName,
+            @ApiParam(value = "状态(0正常 1异常)") @RequestParam(required = false) String status) {
+        try {
+            Page<WaterSourceInfo> page = new Page<>(pageNum, pageSize);
+            IPage<WaterSourceInfo> resultPage = waterSourceInfoService.queryDeletedPage(page, sourceId, sourceName, 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 = waterSourceInfoService.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 = waterSourceInfoService.deleteByIdsPhysically(List.of(ids));
+            return result
+                    ? AjaxResult.success("彻底删除成功,共删除 " + ids.length + " 条数据")
+                    : AjaxResult.error("彻底删除失败");
+        } catch (Exception e) {
+            log.error("彻底删除数据异常", e);
+            return AjaxResult.error("彻底删除失败:" + e.getMessage());
+        }
+    }
+}

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

@@ -0,0 +1,176 @@
+package com.zksy.WaterSupply.WaterSourceInfo.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.time.LocalDate;
+import java.time.LocalDateTime;
+
+/**
+ * 水源地信息实体
+ */
+@Data
+@TableName("water_source_info")
+@ApiModel(
+        value = "WaterSourceInfo",
+        description = "水源地信息对象,包含水源地基础属性"
+)
+public class WaterSourceInfo {
+
+    @ApiModelProperty(
+            value = "主键ID",
+            example = "0",
+            position = 1,
+            notes = "数据库自增主键,新增时不需要传入"
+    )
+    @TableId(type = IdType.AUTO)
+    private Long id;
+
+    @ApiModelProperty(
+            value = "水源地ID",
+            example = "SOURCE_XX",
+            required = true,
+            position = 2
+    )
+    private String sourceId;
+
+    @ApiModelProperty(
+            value = "水源地名称",
+            example = "XX水源地",
+            required = true,
+            position = 3
+    )
+    private String sourceName;
+
+    @ApiModelProperty(
+            value = "水源地类型",
+            example = "系统辨识",
+            position = 4,
+            notes = "系统辨识/企业上报/政府检查"
+    )
+    private String sourceType;
+
+    @ApiModelProperty(
+            value = "所属单位",
+            example = "XX供水公司",
+            position = 5
+    )
+    private String unit;
+
+    @ApiModelProperty(
+            value = "详细地址",
+            example = "XX大道XX号",
+            position = 6
+    )
+    private String address;
+
+    @ApiModelProperty(
+            value = "水源类型",
+            example = "地表水",
+            position = 7,
+            notes = "地表水/地下水"
+    )
+    private String waterType;
+
+    @ApiModelProperty(
+            value = "保护等级",
+            example = "一级",
+            position = 8,
+            notes = "一级/二级/准保护区"
+    )
+    private String protectionLevel;
+
+    @ApiModelProperty(
+            value = "水质等级",
+            example = "Ⅱ类",
+            position = 9,
+            notes = "Ⅰ-Ⅴ类"
+    )
+    private String waterQualityLevel;
+
+    @ApiModelProperty(
+            value = "保护范围描述",
+            example = "XX区域范围内水源保护区",
+            position = 10
+    )
+    private String protectionScope;
+
+    @ApiModelProperty(
+            value = "上报时间",
+            example = "2025-01-01",
+            position = 11
+    )
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private LocalDate reportTime;
+
+    @ApiModelProperty(
+            value = "状态",
+            example = "0",
+            allowableValues = "0,1",
+            position = 12,
+            notes = "0正常 1异常"
+    )
+    private String status;
+
+    @ApiModelProperty(
+            value = "备注",
+            example = "XX区域重要水源地",
+            position = 13
+    )
+    private String remark;
+
+    @ApiModelProperty(
+            value = "删除标志",
+            example = "0",
+            allowableValues = "0,2",
+            hidden = true,
+            position = 14
+    )
+    @TableLogic
+    private String delFlag;
+
+    @ApiModelProperty(
+            value = "创建者",
+            example = "admin",
+            hidden = true,
+            position = 15
+    )
+    @TableField(fill = com.baomidou.mybatisplus.annotation.FieldFill.INSERT)
+    private String createBy;
+
+    @ApiModelProperty(
+            value = "创建时间",
+            example = "2025-01-01 00:00:00",
+            hidden = true,
+            position = 16
+    )
+    @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 = 17
+    )
+    @TableField(fill = com.baomidou.mybatisplus.annotation.FieldFill.UPDATE)
+    private String updateBy;
+
+    @ApiModelProperty(
+            value = "更新时间",
+            example = "2025-01-01 00:00:00",
+            hidden = true,
+            position = 18
+    )
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField(fill = com.baomidou.mybatisplus.annotation.FieldFill.UPDATE)
+    private LocalDateTime updateTime;
+}

+ 24 - 0
pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/WaterSourceInfo/mapper/WaterSourceInfoMapper.java

@@ -0,0 +1,24 @@
+package com.zksy.WaterSupply.WaterSourceInfo.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.zksy.WaterSupply.WaterSourceInfo.domain.WaterSourceInfo;
+import org.apache.ibatis.annotations.Param;
+import java.util.List;
+
+public interface WaterSourceInfoMapper extends BaseMapper<WaterSourceInfo> {
+
+    List<WaterSourceInfo> selectSourceList(
+            @Param("sourceId") String sourceId,
+            @Param("sourceName") String sourceName,
+            @Param("status") String status,
+            @Param("unit") String unit);
+
+    List<WaterSourceInfo> selectDeletedList(
+            @Param("sourceId") String sourceId,
+            @Param("sourceName") String sourceName,
+            @Param("status") String status);
+
+    int restoreByIds(@Param("ids") List<Long> ids, @Param("updateBy") String updateBy);
+
+    int deleteByIdsPhysically(@Param("ids") List<Long> ids);
+}

+ 25 - 0
pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/WaterSourceInfo/service/IWaterSourceInfoService.java

@@ -0,0 +1,25 @@
+package com.zksy.WaterSupply.WaterSourceInfo.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.WaterSourceInfo.domain.WaterSourceInfo;
+import java.util.List;
+
+public interface IWaterSourceInfoService extends IService<WaterSourceInfo> {
+
+    IPage<WaterSourceInfo> queryPage(Page<WaterSourceInfo> page,
+                                     String sourceId,
+                                     String sourceName,
+                                     String status,
+                                     String unit);
+
+    IPage<WaterSourceInfo> queryDeletedPage(Page<WaterSourceInfo> page,
+                                            String sourceId,
+                                            String sourceName,
+                                            String status);
+
+    boolean restoreByIds(List<Long> ids, String updateBy);
+
+    boolean deleteByIdsPhysically(List<Long> ids);
+}

+ 50 - 0
pipe-network-service/zksy-system/src/main/java/com/zksy/WaterSupply/WaterSourceInfo/service/impl/WaterSourceInfoServiceImpl.java

@@ -0,0 +1,50 @@
+package com.zksy.WaterSupply.WaterSourceInfo.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.WaterSourceInfo.domain.WaterSourceInfo;
+import com.zksy.WaterSupply.WaterSourceInfo.mapper.WaterSourceInfoMapper;
+import com.zksy.WaterSupply.WaterSourceInfo.service.IWaterSourceInfoService;
+import org.springframework.stereotype.Service;
+import java.util.List;
+
+@Service
+public class WaterSourceInfoServiceImpl extends ServiceImpl<WaterSourceInfoMapper, WaterSourceInfo>
+        implements IWaterSourceInfoService {
+
+    @Override
+    public IPage<WaterSourceInfo> queryPage(Page<WaterSourceInfo> page,
+                                            String sourceId,
+                                            String sourceName,
+                                            String status,
+                                            String unit) {
+        List<WaterSourceInfo> list = baseMapper.selectSourceList(sourceId, sourceName, status, unit);
+        page.setRecords(list);
+        page.setTotal(list.size());
+        return page;
+    }
+
+    @Override
+    public IPage<WaterSourceInfo> queryDeletedPage(Page<WaterSourceInfo> page,
+                                                   String sourceId,
+                                                   String sourceName,
+                                                   String status) {
+        List<WaterSourceInfo> list = baseMapper.selectDeletedList(sourceId, sourceName, 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;
+    }
+}

+ 86 - 0
pipe-network-service/zksy-system/src/main/resources/mapper/WaterSupply/WaterSourceInfo/WaterSourceInfoMapper.xml

@@ -0,0 +1,86 @@
+<?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.WaterSourceInfo.mapper.WaterSourceInfoMapper">
+
+    <resultMap id="BaseResultMap" type="com.zksy.WaterSupply.WaterSourceInfo.domain.WaterSourceInfo">
+        <id column="id" property="id"/>
+        <result column="source_id" property="sourceId"/>
+        <result column="source_name" property="sourceName"/>
+        <result column="source_type" property="sourceType"/>
+        <result column="unit" property="unit"/>
+        <result column="address" property="address"/>
+        <result column="water_type" property="waterType"/>
+        <result column="protection_level" property="protectionLevel"/>
+        <result column="water_quality_level" property="waterQualityLevel"/>
+        <result column="protection_scope" property="protectionScope"/>
+        <result column="report_time" property="reportTime"/>
+        <result column="status" property="status"/>
+        <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, source_id, source_name, source_type, unit, address, water_type,
+        protection_level, water_quality_level, protection_scope, report_time,
+        status, remark, del_flag, create_by, create_time, update_by, update_time
+    </sql>
+
+    <select id="selectSourceList" resultMap="BaseResultMap">
+        SELECT <include refid="Base_Column_List"/>
+        FROM water_source_info
+        WHERE del_flag = '0'
+        <if test="sourceId != null and sourceId != ''">
+            AND source_id LIKE CONCAT('%', #{sourceId}, '%')
+        </if>
+        <if test="sourceName != null and sourceName != ''">
+            AND source_name LIKE CONCAT('%', #{sourceName}, '%')
+        </if>
+        <if test="status != null and status != ''">
+            AND status = #{status}
+        </if>
+        <if test="unit != null and unit != ''">
+            AND unit LIKE CONCAT('%', #{unit}, '%')
+        </if>
+        ORDER BY create_time DESC
+    </select>
+
+    <select id="selectDeletedList" resultMap="BaseResultMap">
+        SELECT <include refid="Base_Column_List"/>
+        FROM water_source_info
+        WHERE del_flag = '2'
+        <if test="sourceId != null and sourceId != ''">
+            AND source_id LIKE CONCAT('%', #{sourceId}, '%')
+        </if>
+        <if test="sourceName != null and sourceName != ''">
+            AND source_name LIKE CONCAT('%', #{sourceName}, '%')
+        </if>
+        <if test="status != null and status != ''">
+            AND status = #{status}
+        </if>
+        ORDER BY update_time DESC
+    </select>
+
+    <update id="restoreByIds">
+        UPDATE water_source_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_source_info WHERE id IN
+        <foreach collection="ids" item="id" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+
+</mapper>