package com.zksy.WaterSupply.WaterPipeInfo.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zksy.WaterSupply.WaterPipeInfo.domain.WaterPipeInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

@Mapper
public interface WaterPipeInfoMapper extends BaseMapper<WaterPipeInfo> {

    /**
     * 分页条件查询
     */
    List<WaterPipeInfo> selectPipeList(@Param("pipeCode") String pipeCode,
                                       @Param("pipeName") String pipeName,
                                       @Param("pipeMaterial") String pipeMaterial,
                                       @Param("status") String status,
                                       @Param("startTime") LocalDateTime startTime,
                                       @Param("endTime") LocalDateTime endTime);

    /**
     * 按状态统计管网
     */
    List<Map<String, Object>> statPipeByStatus();

    /**
     * 按材质统计管网
     */
    List<Map<String, Object>> statPipeByMaterial();

    /**
     * 获取最新管网
     */
    WaterPipeInfo getLatestPipe();

    /**
     * 整体统计
     */
    Map<String, Object> getPipeOverallStatistics();

    /**
     * 查询已删除的管网数据
     */
    List<WaterPipeInfo> selectDeletedList(@Param("pipeCode") String pipeCode,
                                          @Param("pipeName") String pipeName,
                                          @Param("pipeMaterial") String pipeMaterial,
                                          @Param("startTime") LocalDateTime startTime,
                                          @Param("endTime") LocalDateTime endTime);
    /**
     * 批量恢复已删除数据
     */
    int restoreByIds(@Param("ids") List<Long> ids, @Param("updateBy") String updateBy);

    /**
     * 批量彻底物理删除数据
     */
    int deleteByIdsPhysically(@Param("ids") List<Long> ids);
}