src/main/java/com/whyc/mapper/StationInfoMapper.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/whyc/service/StationInfoService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/resources/mapper/StationInfoMapper.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/main/java/com/whyc/mapper/StationInfoMapper.java
@@ -12,10 +12,10 @@ Integer selectIdByName(String stationName); //找出根节点是stationName1的所有机房id List<Integer> selectIdByName1(String stationName1); List<StationInfo> selectIdByName1(String stationName1); //找出根节点是stationName1,stationName2的所有机房id List<Integer> selectIdByName2(String stationName1, String stationName2); List<StationInfo> selectIdByName2(String stationName1, String stationName2); List<Integer> selectIdByName3(String stationName1, String stationName2, String stationName3); List<StationInfo> selectIdByName3(String stationName1, String stationName2, String stationName3); } src/main/java/com/whyc/service/StationInfoService.java
@@ -216,21 +216,17 @@ //删除台站 @Transactional public Response deleteStation(String stationName1, String stationName2, String stationName3) { String stationName=""; int stationFlag=0; if(stationName1!=null&&!stationName1.isEmpty()){ stationName=stationName+stationName1; stationFlag=1; } if(stationName2!=null&&!stationName2.isEmpty()){ stationName=stationName+"-"+stationName2; stationFlag=2; } if(stationName3!=null&&!stationName3.isEmpty()){ stationName=stationName+"-"+stationName3; stationFlag=3; } List<Integer> idStations=new ArrayList<>(); List<StationInfo> idStations=new ArrayList<>(); if(stationFlag==1){ //找出根节点是stationName1的所有机房id idStations=mapper.selectIdByName1(stationName1); @@ -244,7 +240,9 @@ idStations=mapper.selectIdByName3(stationName1,stationName2,stationName3); } if(idStations!=null&&idStations.size()>0){ for (int stationId:idStations) { for (StationInfo stationInfo:idStations) { String stationName=stationInfo.getStationName(); Integer stationId=Integer.valueOf(stationInfo.getStationId()); //3.删除所有文件数据 dataMapper.deleteDataAndInfoByStationId(stationId); //4.删除所有文件参数 src/main/resources/mapper/StationInfoMapper.xml
@@ -15,13 +15,13 @@ <select id="selectIdByName" resultType="java.lang.Integer"> select ifnull(station_id,0) from db_res_meter.tb_station_info where station_name=#{stationName} limit 1 </select> <select id="selectIdByName2" resultType="java.lang.Integer"> select distinct station_id from db_res_meter.tb_station_info where station_name1=#{stationName1} and station_name2=#{stationName2} <select id="selectIdByName2" resultType="StationInfo"> select distinct station_id,station_name from db_res_meter.tb_station_info where station_name1=#{stationName1} and station_name2=#{stationName2} </select> <select id="selectIdByName3" resultType="java.lang.Integer"> select distinct station_id from db_res_meter.tb_station_info where station_name1=#{stationName1} and station_name2=#{stationName2} and station_name3=#{stationName3} <select id="selectIdByName3" resultType="StationInfo"> select distinct station_id,station_name from db_res_meter.tb_station_info where station_name1=#{stationName1} and station_name2=#{stationName2} and station_name3=#{stationName3} </select> <select id="selectIdByName1" resultType="java.lang.Integer"> select distinct station_id from db_res_meter.tb_station_info where station_name1=#{stationName1} <select id="selectIdByName1" resultType="StationInfo"> select distinct station_id,station_name from db_res_meter.tb_station_info where station_name1=#{stationName1} </select> </mapper>