lxw
2022-09-20 40bf31c1dab5e79e9169dd3861cfdb2366c0a51a
删除台站
7个文件已修改
39 ■■■■■ 已修改文件
src/main/java/com/whyc/mapper/BattGroupDataMapper.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/mapper/FileInfoMapper.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/mapper/FileParamMapper.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/StationInfoService.java 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/BattgroupDataMapper.xml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/FileInfoMapper.xml 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/FileParamMapper.xml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/mapper/BattGroupDataMapper.java
@@ -10,4 +10,7 @@
    //删除fileid对应的数据(stationId,fileId)
    int deleteDataAndInfo(int stationId, int fileId);
    //3.删除所有文件数据
    void deleteDataAndInfoByStationId(int stationId);
}
src/main/java/com/whyc/mapper/FileInfoMapper.java
@@ -2,6 +2,8 @@
import com.whyc.pojo.FileInfo;
import java.util.List;
public interface FileInfoMapper extends CustomMapper<FileInfo>{
    //查询出最大文件id
@@ -12,4 +14,7 @@
    //删除机房下文件信息(stationId,fileId)
    int deleteFileInStation(int stationId, int fileId);
    //查询出机房下所有的文件fileIds
    List<Integer> selectListFiles(int stationId);
}
src/main/java/com/whyc/mapper/FileParamMapper.java
@@ -12,4 +12,6 @@
    List<FileParam> getDataByCondition(Date testTime1, Date testTime2, int battVol);
    //删除fileid对应的参数
    int deleteParamByFileId(int fileId);
    //删除所有文件参数
    void deleteParamByStationId(int stationId);
}
src/main/java/com/whyc/service/StationInfoService.java
@@ -227,9 +227,19 @@
            stationName=stationName+"-"+stationName3;
        }
        wrapper.eq("station_name",stationName);
        //先删除该基站挂载的所有文件
        //1.先查出机房的id
        int stationId=mapper.selectIdByName(stationName);
        if(stationId==0){
            return new Response().set(1,false,"机房不存在");
        }else {
            //3.删除所有文件数据
            dataMapper.deleteDataAndInfoByStationId(stationId);
            //4.删除所有文件参数
            paramMapper.deleteParamByStationId(stationId);
        }
        //最终删除基站
        int flag=mapper.delete(wrapper);
        return new Response().set(1,flag>0,"删除操作");
        return new Response().set(1,flag>0,"删除成功");
    }
    //移除台站下文件(单个文件)
    @Transactional
src/main/resources/mapper/BattgroupDataMapper.xml
@@ -7,6 +7,12 @@
        LEFT JOIN tb_battgroup_info c ON o.battGroup_id = c.battGroup_id
        WHERE c.station_id=#{stationId} and c.file_id=#{fileId}
    </delete>
    <delete id="deleteDataAndInfoByStationId">
        DELETE o,c
        FROM tb_battgroup_data o
        LEFT JOIN tb_battgroup_info c ON o.battGroup_id = c.battGroup_id
        WHERE c.station_id=#{stationId}
    </delete>
    <select id="getListWithTestTime" resultType="com.whyc.pojo.BattgroupData">
        SELECT data.*,info.test_time FROM db_res_meter.tb_battgroup_data data,db_res_meter.tb_battgroup_info info
src/main/resources/mapper/FileInfoMapper.xml
@@ -12,4 +12,7 @@
        select ifnull(max(file_id),0) from db_res_meter.tb_file_info
        where  station_id=#{stationId} and file_url=#{filePath}
    </select>
    <select id="selectListFiles" resultType="java.lang.Integer">
        select distinct file_id from  db_res_meter.tb_file_info where  station_id=#{stationId}
    </select>
</mapper>
src/main/resources/mapper/FileParamMapper.xml
@@ -4,6 +4,12 @@
    <delete id="deleteParamByFileId">
        delete from tb_file_param where  file_id=#{fileId}
    </delete>
    <delete id="deleteParamByStationId">
        DELETE o,c
        FROM  tb_file_param o
        LEFT JOIN tb_file_info c ON o.file_id = c.file_id
        WHERE c.station_id=#{stationId}
    </delete>
    <select id="getMonVolStd" resultType="Integer">