|
|
|
|
using log4net;
|
|
|
|
|
using SqlSugar;
|
|
|
|
|
|
|
|
|
|
namespace ConsoleStarter;
|
|
|
|
|
|
|
|
|
|
public class ExportDb
|
|
|
|
|
{
|
|
|
|
|
private static readonly ILog Log = LogManager.GetLogger(typeof(ExportDb));
|
|
|
|
|
|
|
|
|
|
private static readonly string[] UsedTable =
|
|
|
|
|
{
|
|
|
|
|
"t_bs_charging_bin_info",
|
|
|
|
|
"t_bs_cloud_charge_model_recv_record",
|
|
|
|
|
"t_bs_cloud_elec_price_recv_record",
|
|
|
|
|
"t_bs_eqm_fault_base_info",
|
|
|
|
|
"t_bs_net_cloud_param_info",
|
|
|
|
|
"t_bs_net_eqm_param_info",
|
|
|
|
|
"t_bs_station_config_info",
|
|
|
|
|
"t_bs_station_elec_price_info",
|
|
|
|
|
"t_bs_station_info",
|
|
|
|
|
"t_cb_amt_order_info",
|
|
|
|
|
"t_cb_station_order_batt_log_info",
|
|
|
|
|
"t_cb_station_order_sended_log",
|
|
|
|
|
"t_cb_station_order_state_log",
|
|
|
|
|
"t_fl_repaired_info",
|
|
|
|
|
"t_fl_un_repair_info",
|
|
|
|
|
"t_rm_charger_record_report",
|
|
|
|
|
"t_ss_authority_to_role",
|
|
|
|
|
"t_ss_button_info",
|
|
|
|
|
"t_ss_menu_info",
|
|
|
|
|
"t_ss_role_info",
|
|
|
|
|
"t_ss_user_info",
|
|
|
|
|
"t_ss_user_to_role"
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
private readonly SqlSugarClient Db = new(new ConnectionConfig
|
|
|
|
|
{
|
|
|
|
|
ConnectionString =
|
|
|
|
|
//"server=106.12.36.89;Database=chassis_track_swap0;Uid=remote_user;Pwd=Rszn123;Charset=utf8;",
|
|
|
|
|
"server=127.0.0.1;Port=3306;Database=huanneng_dev;Uid=root;Pwd=anyixing2023!@#;Charset=utf8;",
|
|
|
|
|
DbType = DbType.MySql,
|
|
|
|
|
IsAutoCloseConnection = true,
|
|
|
|
|
InitKeyType = InitKeyType.Attribute
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
public void Export()
|
|
|
|
|
{
|
|
|
|
|
List<DbTableInfo> tableInfoList = Db.DbMaintenance.GetTableInfoList(false);
|
|
|
|
|
foreach (var tableInfo in tableInfoList)
|
|
|
|
|
if (UsedTable.Contains(tableInfo.Name))
|
|
|
|
|
{
|
|
|
|
|
Log.Info($"{tableInfo.Name}:{tableInfo.Description}");
|
|
|
|
|
|
|
|
|
|
List<DbColumnInfo> columnInfos = Db.DbMaintenance.GetColumnInfosByTableName(tableInfo.Name, false);
|
|
|
|
|
foreach (var columnInfo in columnInfos)
|
|
|
|
|
Log.Info($" {columnInfo.DbColumnName}:{columnInfo.ColumnDescription}");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|