From 489cc658a7f1a166058138bd4c57b6ce3e64ca72 Mon Sep 17 00:00:00 2001 From: whycxzp <perryhsu@163.com> Date: 星期五, 09 七月 2021 10:31:28 +0800 Subject: [PATCH] 完成清除/删除操作 --- src/main/java/com/whyc/service/ClearTableService.java | 139 +++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 135 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/whyc/service/ClearTableService.java b/src/main/java/com/whyc/service/ClearTableService.java index fc0e3e0..2e4efef 100644 --- a/src/main/java/com/whyc/service/ClearTableService.java +++ b/src/main/java/com/whyc/service/ClearTableService.java @@ -1,10 +1,11 @@ package com.whyc.service; +import com.whyc.dto.TableDTO; import com.whyc.mapper.ClearTableMapper; -import com.whyc.pojo.User_inf; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.util.LinkedList; import java.util.List; @Service @@ -14,9 +15,139 @@ private ClearTableMapper mapper; public void clearTable(){ - List<User_inf> userInfList = mapper.clearTable(); - System.out.println(userInfList); - System.out.println("娓呴櫎琛ㄥ畬鎴�"); + List<TableDTO> tableList = new LinkedList<>(); + //浼犲叆闇�瑕佹竻绌虹殑琛ㄥ搴旂殑搴撳悕,琛ㄥ悕 + tableList.add(new TableDTO("db_alarm","tb_battalarm_data")); + tableList.add(new TableDTO("db_alarm","tb_battalarm_data_history")); + tableList.add(new TableDTO("db_alarm","tb_bts_station_event")); + tableList.add(new TableDTO("db_alarm","tb_devalarm_data")); + tableList.add(new TableDTO("db_alarm","tb_devalarm_data_history")); + tableList.add(new TableDTO("db_app_sys","tb_app_bts_battgroup")); + tableList.add(new TableDTO("db_app_sys","tb_app_bts_comm_task")); + tableList.add(new TableDTO("db_app_sys","tb_dashboard_chart_type")); + tableList.add(new TableDTO("db_app_sys","tb_dashboard_module")); + tableList.add(new TableDTO("db_app_sys","tb_dashboard_module_chart")); + tableList.add(new TableDTO("db_app_sys","tb_fbsdev_statechange_inf")); + tableList.add(new TableDTO("db_batt_history","tb_btsstaechange_inf")); + tableList.add(new TableDTO("db_batt_testdata","tb_battresdata_inf")); + tableList.add(new TableDTO("db_batt_testdata","tb_batttestdata_inf")); + tableList.add(new TableDTO("db_battinf","tb_batt_alm_param")); + tableList.add(new TableDTO("db_battinf","tb_batt_maint_inf")); + tableList.add(new TableDTO("db_battinf","tb_batt_maint_process")); + tableList.add(new TableDTO("db_battinf","tb_battcurr_inf")); + tableList.add(new TableDTO("db_battinf","tb_battinf")); + tableList.add(new TableDTO("db_battinf","tb_battinf_apply")); + tableList.add(new TableDTO("db_battinf","tb_battinf_ex")); + tableList.add(new TableDTO("db_battinf","tb_battinf_rebuild")); + tableList.add(new TableDTO("db_battinf","tb_battmon_testcap")); + tableList.add(new TableDTO("db_battinf","tb_deverror_record")); + tableList.add(new TableDTO("db_ld9_testdata","tb_ld9testdata_inf")); + tableList.add(new TableDTO("db_param","tb_alarm_param")); + tableList.add(new TableDTO("db_param","tb_dev_param")); + tableList.add(new TableDTO("db_pwrdev_alarm","tb_pwrdev_alarm")); + tableList.add(new TableDTO("db_pwrdev_alarm","tb_pwrdev_alarm_history")); + tableList.add(new TableDTO("db_pwrdev_alarm","tb_pwrdev_alarm_param")); + tableList.add(new TableDTO("db_pwrdev_alarm","tb_pwrdev_time_adj_alarm")); + tableList.add(new TableDTO("db_pwrdev_alarm","tb_pwrdev_time_out_alarm")); + tableList.add(new TableDTO("db_pwrdev_data_history","tb_pwrdev_acdata")); + tableList.add(new TableDTO("db_pwrdev_data_rt","tb_pwrdev_acdcdata")); + tableList.add(new TableDTO("db_pwrdev_data_rt","tb_pwrdev_dcdata")); + tableList.add(new TableDTO("db_pwrdev_inf","tb_pwrdev_inf")); + tableList.add(new TableDTO("db_ram_db","cmcc_power_data")); + tableList.add(new TableDTO("db_ram_db","tb_61850_jhstate")); + tableList.add(new TableDTO("db_ram_db","tb_batt_rsalarm")); + tableList.add(new TableDTO("db_ram_db","tb_batt_rtalarm")); + tableList.add(new TableDTO("db_ram_db","tb_batt_rtdata")); + tableList.add(new TableDTO("db_ram_db","tb_batt_rtstate")); + tableList.add(new TableDTO("db_ram_db","tb_bpm7100_state")); + tableList.add(new TableDTO("db_ram_db","tb_bts_gprs_state")); + tableList.add(new TableDTO("db_ram_db","tb_bts_station_state")); + tableList.add(new TableDTO("db_ram_db","tb_fbs9100_battparam")); + tableList.add(new TableDTO("db_ram_db","tb_fbs9100_chargerstate")); + tableList.add(new TableDTO("db_ram_db","tb_fbs9100_collectionstate")); + tableList.add(new TableDTO("db_ram_db","tb_fbs9100_insulatstate")); + tableList.add(new TableDTO("db_ram_db","tb_fbs9100_offlineyhplan")); + tableList.add(new TableDTO("db_ram_db","tb_fbs9100_offlineyhplan")); + tableList.add(new TableDTO("db_ram_db","tb_fbs9100_state")); + tableList.add(new TableDTO("db_ram_db","tb_fbs9100_sysparam")); + tableList.add(new TableDTO("db_ram_db","tb_fbs9100s_dcdc_state")); + tableList.add(new TableDTO("db_ram_db","tb_fbs9100s_dfu_state")); + tableList.add(new TableDTO("db_ram_db","tb_fbs9100s_fod_param")); + tableList.add(new TableDTO("db_ram_db","tb_fbs9100s_fod_state")); + tableList.add(new TableDTO("db_ram_db","tb_fbs9100s_nibian_state")); + tableList.add(new TableDTO("db_ram_db","tb_fbs9600_state")); + tableList.add(new TableDTO("db_ram_db","tb_hard_dev_sms_state")); + tableList.add(new TableDTO("db_ram_db","tb_ld9_concentrateparam")); + tableList.add(new TableDTO("db_ram_db","tb_ld9_concentratestate")); + tableList.add(new TableDTO("db_ram_db","tb_ld9_setparam")); + tableList.add(new TableDTO("db_ram_db","tb_ld9_state")); + tableList.add(new TableDTO("db_ram_db","tb_ld9_updatestatue")); + tableList.add(new TableDTO("db_ram_db","tb_lithium_data")); + tableList.add(new TableDTO("db_ram_db","tb_socketclient_state")); + tableList.add(new TableDTO("db_user","tb_user_battgroup_baojigroup_battgroup")); + tableList.add(new TableDTO("db_user","tb_user_battmaint_check")); + tableList.add(new TableDTO("db_user","tb_user_battmaint_check_process")); + tableList.add(new TableDTO("db_user","tb_user_face")); + tableList.add(new TableDTO("db_user","tb_user_jiejiari")); + tableList.add(new TableDTO("db_user","tb_user_limit")); + tableList.add(new TableDTO("db_user","tb_user_log")); + tableList.add(new TableDTO("db_user","tb_user_paixiu")); + tableList.add(new TableDTO("db_user","tb_user_sms")); + tableList.add(new TableDTO("db_user","tb_user_sms_format")); + tableList.add(new TableDTO("db_user","tb_user_task")); + tableList.add(new TableDTO("db_user","tb_user_task_batt_check")); + tableList.add(new TableDTO("db_user","tb_user_task_batt_template")); + tableList.add(new TableDTO("db_user","tb_user_task_batt_test")); + tableList.add(new TableDTO("db_user","tb_user_task_change")); + tableList.add(new TableDTO("db_user","tb_user_task_param")); + tableList.add(new TableDTO("db_user","tb_user_task_template")); + tableList.add(new TableDTO("db_user","tb_user_task_user_list")); + tableList.add(new TableDTO("web_site","mac_license")); + tableList.add(new TableDTO("web_site","tb_3d_station")); + tableList.add(new TableDTO("web_site","tb_announce")); + tableList.add(new TableDTO("web_site","tb_avoid_plan")); + tableList.add(new TableDTO("web_site","tb_badbatt_mon")); + tableList.add(new TableDTO("web_site","tb_badbatt_mon_flag")); + tableList.add(new TableDTO("web_site","tb_batt_attention")); + tableList.add(new TableDTO("web_site","tb_batt_devdischarge_cm")); + tableList.add(new TableDTO("web_site","tb_batt_devdischarge_cm1")); + tableList.add(new TableDTO("web_site","tb_batt_devdischarge_ct")); + tableList.add(new TableDTO("web_site","tb_batt_devdischarge_ct1")); + tableList.add(new TableDTO("web_site","tb_batt_devdischarge_cu")); + tableList.add(new TableDTO("web_site","tb_batt_devdischarge_cu1")); + tableList.add(new TableDTO("web_site","tb_batt_discharge")); + tableList.add(new TableDTO("web_site","tb_batt_electricity")); + tableList.add(new TableDTO("web_site","tb_batt_electricity1")); + tableList.add(new TableDTO("web_site","tb_batt_electricity2")); + tableList.add(new TableDTO("web_site","tb_batt_endurance")); + tableList.add(new TableDTO("web_site","tb_batt_replace")); + tableList.add(new TableDTO("web_site","tb_battdischarge_plan")); + tableList.add(new TableDTO("web_site","tb_battinf_change")); + tableList.add(new TableDTO("web_site","tb_battmap_information")); + tableList.add(new TableDTO("web_site","tb_battpower_off")); + tableList.add(new TableDTO("web_site","tb_dev_restart_plan")); + tableList.add(new TableDTO("web_site","tb_devstate_usr")); + tableList.add(new TableDTO("web_site","tb_devtmp_record")); + tableList.add(new TableDTO("web_site","tb_stationtraffic")); + + mapper.clearTable(tableList); + } + + public void dropTable(){ + List<TableDTO> tableList = new LinkedList<>(); + tableList.add(new TableDTO("db_batt_history","tb_batt_realdata_")); + tableList.add(new TableDTO("db_pwrdev_alarm","tb_pwrdev_alarm_param_")); + tableList.add(new TableDTO("db_pwrdev_data_history","tb_pwrdev_historydata_")); + //鏌ヨ搴撲腑闇�瑕佸垹闄ょ殑琛ㄥ悕 + List<TableDTO> resTableList = findTableListLike(tableList); + //浼犲叆闇�瑕佸垹闄ょ殑琛ㄥ搴旂殑搴撳悕,琛ㄥ悕 + if(!resTableList.isEmpty()){ + mapper.dropTable(resTableList); + } + } + + private List<TableDTO> findTableListLike(List<TableDTO> tableList) { + return mapper.findTableListLike(tableList); } } -- Gitblit v1.9.1