蓄电池监控管理平台数据库初始化程序
Administrator
2022-06-10 e8af6b013b057f7fc96e8cd0b55ed9ded2a190ed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
package com.dev.fbs9100;
 
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;
 
import javax.net.ssl.HandshakeCompletedEvent;
 
import com.sql.MysqlConnPool;
import com.sql.Sql_Mysql;
 
public class FBS9100_Task_Thread_SQL {
    
    /**
     *     ´´½¨ tb_fbs9100_state ±í²¢ÇÒ½«É豸idºÍÉ豸hip²åÈëµ½±íÖÐ
     * @param con_pool
     * @param al_param
     */
    public static void createFBS9100StateTableOnRam(MysqlConnPool con_pool,boolean recreate_tb)
    {
        String str1 = "DROP TABLE IF EXISTS " + Sql_Mysql.FBS9100State_Table;
        String str2 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.FBS9100State_Table
                    + " ( `num` BIGINT NOT NULL AUTO_INCREMENT, "
                    + "`dev_ip` varchar(20) NOT NULL DEFAULT '127.0.0.0', "
                    + "`dev_version` varchar(64) NOT NULL DEFAULT '0', "
                    + "`dev_id` BIGINT NOT NULL DEFAULT 0, "
                    + "`op_cmd` INT NOT NULL DEFAULT 0, "
                    + "`record_datetime` varchar(20) NOT NULL DEFAULT '2015-12-02 12:10:00', "
                    + "`dev_datetime` varchar(20) NOT NULL DEFAULT '2015-12-02 12:10:00', "
                    + "`dev_testtype` INT NOT NULL DEFAULT 0, "
                    + "`dev_testgroupnum` INT NOT NULL DEFAULT 0, "
                    + "`dev_workstate` INT NOT NULL DEFAULT 0, "
                    + "`dev_alarmstate` INT NOT NULL DEFAULT 0, "
                    + "`dev_temp` float NOT NULL DEFAULT 0, "                //É豸ζÈ
                    + "`dev_res_test_state` INT NOT NULL DEFAULT 0, "        //ÄÚ×è²âÊÔ״̬
                    + "`dev_onlinevollow` BOOLEAN NOT NULL DEFAULT false, "
                    + "`dev_eachgroup_battsum` INT NOT NULL DEFAULT 0, "
                    + "`dev_captest_onlinevol` float NOT NULL DEFAULT 0, "
                    + "`dev_captest_groupvol` float NOT NULL DEFAULT 0, "
                    + "`dev_captest_curr` float NOT NULL DEFAULT 0, "
                    + "`dev_captest_cap` float NOT NULL DEFAULT 0, "
                    + "`dev_captest_timelong` INT NOT NULL DEFAULT 0, "
                    + "`dev_restest_count` INT NOT NULL DEFAULT 0, "
                    + "`dev_restest_moncount` INT NOT NULL DEFAULT 0, "
                    + "`dev_restest_monindex` INT NOT NULL DEFAULT 0, "
                    + "`dev_commcount` INT NOT NULL DEFAULT 0, "
                    + "`dev_errcommcount` INT NOT NULL DEFAULT 0, "
                    + "`dev_rxnullerrcount` INT NOT NULL DEFAULT 0, "
                    
                    + "`dev_last_captest_stop_type` INT NOT NULL DEFAULT 0, "
                    + "`dev_concurr`  float NOT NULL DEFAULT 0, "
                    + "`dev_condvoldp`  float NOT NULL DEFAULT 0, "
                    + "`dev_conresist`  float NOT NULL DEFAULT 0, "
                    + "`dev_condcurr`  float NOT NULL DEFAULT 0, "
                    + "`dev_61850alarms`  varchar(64) NOT NULL DEFAULT '', "
                    
                    + "`dev_batt_xuhang_tlong` INT NOT NULL DEFAULT 0, "                //Ðøº½Ê±³¤
                    + "`dev_station_poff_tlong` INT NOT NULL DEFAULT 0, "                //Í£µçʱ³¤
                    + "`dev_station_poff_cnt` INT NOT NULL DEFAULT 0, "                    //Í£µç´ÎÊý
                    + "`dev_data_flowsum` BIGINT NOT NULL DEFAULT 0, "                    //»ú·¿Á÷Á¿
                    + "`batt_online_state` INT NOT NULL DEFAULT 0, "                    //µç³Ø×´Ì¬(0:±ÕºÏ,1£º¶Ï¿ª)                
                    
                    + " UNIQUE INDEX index_dev_id_uniq (`dev_id`), "
                    + " PRIMARY KEY (`num`) ) "
                    + " ENGINE=InnoDB DEFAULT CHARSET=utf8";
        /*
        String str3 = "INSERT INTO " + Sql_Mysql.FBS9100State_Table + " (dev_ip, dev_id) ";
        str3 += " SELECT dev_ip, dev_id FROM " + Sql_Mysql.BattInf_Table;
        */
        Sql_Mysql sql = new Sql_Mysql(con_pool.getConn());
        ResultSet res = null;
        try {
            if(recreate_tb) {
                sql.sqlMysqlExecute(str1);
            }
            sql.sqlMysqlExecute(str2);
            //ÐÞ¸´É豸É豸°æ±¾ºÅ¹ý³¤bug
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_ram_db'"
                    + " AND table_name='tb_fbs9100_state'"
                    + " AND column_name='dev_version'");
            if(true == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " +Sql_Mysql.FBS9100State_Table + " MODIFY COLUMN dev_version varchar(64) NOT NULL DEFAULT '';");
            }
            
            //Ìí¼ÓÉ豸ζÈÁÐ
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_ram_db'"
                    + " AND table_name='tb_fbs9100_state'"
                    + " AND column_name='dev_temp'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100State_Table 
                                + " ADD COLUMN `dev_temp` float NOT NULL DEFAULT 0;");
            }
            //Ìí¼ÓÄÚ×è²âÊÔ״̬ÁÐ
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_ram_db'"
                    + " AND table_name='tb_fbs9100_state'"
                    + " AND column_name='dev_res_test_state'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100State_Table 
                        + " ADD COLUMN `dev_res_test_state` INT NOT NULL DEFAULT 0;");
            }
            //Ìí¼Ódev_restest_count
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_ram_db'"
                    + " AND table_name='tb_fbs9100_state'"
                    + " AND column_name='dev_restest_count'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100State_Table 
                        + " ADD COLUMN `dev_restest_count` INT NOT NULL DEFAULT 0;");
            }
            //Ìí¼Ódev_last_captest_stop_type
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_ram_db'"
                    + " AND table_name='tb_fbs9100_state'"
                    + " AND column_name='dev_last_captest_stop_type'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100State_Table 
                        + " ADD COLUMN `dev_last_captest_stop_type` INT NOT NULL DEFAULT 0;");
            }
            
            //Ìí¼Ódev_concurr
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_ram_db'"
                    + " AND table_name='tb_fbs9100_state'"
                    + " AND column_name='dev_concurr'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100State_Table 
                        + " ADD COLUMN `dev_concurr`  float NOT NULL DEFAULT 0;");
            }
            
            //Ìí¼Ódev_condvoldp    ×é1µ¼Í¨Ñ¹½µ
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_ram_db'"
                    + " AND table_name='tb_fbs9100_state'"
                    + " AND column_name='dev_condvoldp'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100State_Table 
                        + " ADD COLUMN `dev_condvoldp`  float NOT NULL DEFAULT 0;");
            }
            //Ìí¼Ódev_condvoldp1    ×é2µ¼Í¨Ñ¹½µ
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_ram_db'"
                    + " AND table_name='tb_fbs9100_state'"
                    + " AND column_name='dev_condvoldp1'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100State_Table 
                        + " ADD COLUMN `dev_condvoldp1`  float NOT NULL DEFAULT 0;");
            }
            //Ìí¼Ódev_conresist    ×é1½Ó´¥Æ÷µ¼Í¨×迹        
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_ram_db'"
                    + " AND table_name='tb_fbs9100_state'"
                    + " AND column_name='dev_conresist'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100State_Table 
                        + " ADD COLUMN `dev_conresist`  float NOT NULL DEFAULT 0;");
            }
            //Ìí¼Ódev_conresist    ×é2½Ó´¥Æ÷µ¼Í¨×迹        
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_ram_db'"
                    + " AND table_name='tb_fbs9100_state'"
                    + " AND column_name='dev_conresist1'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100State_Table 
                        + " ADD COLUMN `dev_conresist1`  float NOT NULL DEFAULT 0 after dev_conresist;");
            }
            //Ìí¼Ódev_condcurr
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_ram_db'"
                    + " AND table_name='tb_fbs9100_state'"
                    + " AND column_name='dev_condcurr'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100State_Table 
                        + " ADD COLUMN `dev_condcurr`  float NOT NULL DEFAULT 0;");
            }
            
            //Ìí¼Ódev_61850alarms
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_ram_db'"
                    + " AND table_name='tb_fbs9100_state'"
                    + " AND column_name='dev_61850alarms'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100State_Table 
                        + " ADD COLUMN `dev_61850alarms`  varchar(64) NOT NULL DEFAULT '';");
            }
            //Ìí¼Ódev_batt_xuhang_tlong
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_ram_db'"
                    + " AND table_name='tb_fbs9100_state'"
                    + " AND column_name='dev_batt_xuhang_tlong'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100State_Table 
                        + " ADD COLUMN `dev_batt_xuhang_tlong` INT NOT NULL DEFAULT 0;");
            }
            
            //Ìí¼Ódev_station_poff_tlong
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_ram_db'"
                    + " AND table_name='tb_fbs9100_state'"
                    + " AND column_name='dev_station_poff_tlong'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100State_Table 
                        + " ADD COLUMN `dev_station_poff_tlong` INT NOT NULL DEFAULT 0;");
            }
            
            //Ìí¼Ódev_station_poff_cnt(Í£µç´ÎÊý)
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_ram_db'"
                    + " AND table_name='tb_fbs9100_state'"
                    + " AND column_name='dev_station_poff_cnt'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100State_Table 
                        + " ADD COLUMN `dev_station_poff_cnt` INT NOT NULL DEFAULT 0;");
            }
            
            
            //Ìí¼Ódev_data_flowsum(Á÷Á¿Í³¼Æ)
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_ram_db'"
                    + " AND table_name='tb_fbs9100_state'"
                    + " AND column_name='dev_data_flowsum'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100State_Table 
                        + " ADD COLUMN `dev_data_flowsum` BIGINT NOT NULL DEFAULT 0;");
            }
            //Ìí¼Óbatt_online_state(µç³Ø¿ª¹Ø×´Ì¬)
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_ram_db'"
                    + " AND table_name='tb_fbs9100_state'"
                    + " AND column_name='batt_online_state'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100State_Table 
                        + " ADD COLUMN `batt_online_state` INT NOT NULL DEFAULT 0;");
            }
            
            
            
            //sql.sqlMysqlExecute(str3);
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } finally {
            sql.close_con();
        }
    }
    
    /**
     * ´´½¨ tb_fbs9100s_dcdc_data ±í²¢ÇÒ½«É豸idºÍÉ豸ip²åÈëµ½±íÖÐ
     * @param con_pool
     * @param al_param
     */
    public static void createFBS9100S_DCDC_DataTableOnRam(MysqlConnPool con_pool)
    {
        String str1 = "DROP TABLE IF EXISTS " + Sql_Mysql.FBS9100S_DcDcState_Table;
        String str2 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.FBS9100S_DcDcState_Table
                    + " ( `num` BIGINT NOT NULL AUTO_INCREMENT, "
                    + "`dev_id` BIGINT NOT NULL DEFAULT 0, "
                    + "`dcdc_num` BIGINT NOT NULL DEFAULT 0, "
                    + "`dcdc_Vsys` float NOT NULL DEFAULT 0, "
                    + "`dcdc_Vout` float NOT NULL DEFAULT 0, "
                    + "`dcdc_Vbat` float NOT NULL DEFAULT 0, "
                    + "`dcdc_Iout` float NOT NULL DEFAULT 0, "
                    + "`dcdc_Ibuck` float NOT NULL DEFAULT 0, "
                    + "`dcdc_Tmp_Dis` float NOT NULL DEFAULT 0, "
                    + "`dcdc_Tmp_Chr` float NOT NULL DEFAULT 0, "
                    + "`dcdc_SMR_Alarm1` INT NOT NULL DEFAULT 0, "
                    + "`dcdc_SMR_Alarm2` INT NOT NULL DEFAULT 0, "
                    + "`dcdc_version` INT NOT NULL DEFAULT 0, "
                    + "`dcdc_ModeSetComm` INT NOT NULL DEFAULT 0, "
                    + "`dcdc_RunSetComm` INT NOT NULL DEFAULT 0, "
                    + "`dcdc_BuckISet` float NOT NULL DEFAULT 0, "
                    + "`dcdc_DisVolSet` float NOT NULL DEFAULT 0, "
                    + "`dcdc_DisCurrSet` float NOT NULL DEFAULT 0, "
                    + "`dcdc_CommTxCnt` INT NOT NULL DEFAULT 0, "
                    + "`dcdc_CommRxCnt` INT NOT NULL DEFAULT 0, "
                    + " UNIQUE INDEX index_dcdc_num_uniq (`dcdc_num`), "
                    + " PRIMARY KEY (`num`) ) "
                    + " ENGINE=MEMORY DEFAULT CHARSET=utf8";
        
        Sql_Mysql sql = new Sql_Mysql(con_pool.getConn());
        try {
            sql.sqlMysqlExecute(str1);
            sql.sqlMysqlExecute(str2);
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } finally {
            sql.close_con();
        }
    }
    
    /**
     * ´´½¨ tb_fbs9100_setparam ±í£¬²¢ÇÒ½«É豸idºÍÉ豸ip²åÈëµ½±íÖÐ
     * @param con_pool
     * @param al_param
     */
    public static void createFBS9100SetTestParamTableOnRam(MysqlConnPool con_pool,boolean recreate_tb)
    {
        String str1 = "DROP TABLE IF EXISTS " + Sql_Mysql.FBS9100SetParam_Table;
        String str2 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.FBS9100SetParam_Table
                    + " ( `num` BIGINT NOT NULL AUTO_INCREMENT, "
                    + "`dev_ip` varchar(20) NOT NULL DEFAULT '127.0.0.0', "
                    + "`dev_id` BIGINT NOT NULL DEFAULT 0, "
                    + "`op_cmd` INT NOT NULL DEFAULT 0, "
                    + "`TestCmd` INT NOT NULL DEFAULT 0, "
                    + "`HourRate` INT NOT NULL DEFAULT 0, "
                    + "`DisCurr` FLOAT NOT NULL DEFAULT 0, "
                    + "`DisCap` FLOAT NOT NULL DEFAULT 0, "
                    + "`DisTime` INT NOT NULL DEFAULT 0, "
                    + "`GroupVol_LOW` FLOAT NOT NULL DEFAULT 0, "
                    + "`MonomerVol_LOW` FLOAT NOT NULL DEFAULT 0, "
                    + "`MonomerLowCount` INT NOT NULL DEFAULT 0, "
                    + "`BattGroupNum` INT NOT NULL DEFAULT 0, "
                    + "`OnlineVolLowAction` INT NOT NULL DEFAULT 0, "
                    + "`DCVolHighLimit` FLOAT NOT NULL DEFAULT 0, "
                    + "`ChargeCurrSet` FLOAT NOT NULL DEFAULT 0, "
                    + "`MonomerTmp_High` FLOAT NOT NULL DEFAULT 0, "
                    + "`AutoTestStartVol`  float NOT NULL DEFAULT 0, "                //Æðʼµçѹ
                    + "`MonCount` int(11) NOT NULL DEFAULT '0' COMMENT 'ÿ×éµ¥ÌåÊý'," 
                    + "`MonVol` float NOT NULL DEFAULT '0' COMMENT 'µ¥Ìåµçѹ'," 
                    + "`DisPower` float NOT NULL DEFAULT '0' COMMENT 'Ô¤·Å¹¦ÂÊ£¨0.1kw£©'," 
                    + "`DisPreRes` float(11,0) NOT NULL DEFAULT '0' COMMENT '·Åµç×èÖµ(m¦¸)   '," 
                    + "`CharCap` int(11) NOT NULL DEFAULT '0' COMMENT '³äµçÈÝÁ¿(AH)'," 
                    + "`CharTimeLong` int(11) NOT NULL DEFAULT '0' COMMENT '³äµçʱ³¤(min)'," 
                    + "`FloatCharTimeLong` int(11) NOT NULL DEFAULT '0' COMMENT '¸¡³äʱ³¤'," 
                    + "`CharSotpCurr` float NOT NULL DEFAULT '0' COMMENT '½ØÖ¹µçÁ÷(0.1A)    ',"  
                    + "`MonVolHightLimit` float NOT NULL DEFAULT '0' COMMENT 'µ¥ÌåÉÏÏÞ(0.01V)',"  
                    + "`MonVolHightLimitCount` int(11) NOT NULL DEFAULT '0' COMMENT 'µ¥ÌåÉÏÏÞÊýÁ¿',"  
                    + "`CharHighTmp` int(11) NOT NULL DEFAULT '0' COMMENT '³äµç¹ýÎÂ'," 
                    + "`DisWaitTime` int(11) NOT NULL DEFAULT '0' COMMENT '·ÅÍê¾²ÖÃ(0-500·ÖÖÓ)',"  
                    + "`CharWaitTime` int(11) NOT NULL DEFAULT '0' COMMENT '³äÍê¾²ÖÃ(0-500·ÖÖÓ)',"
                    + "`FlowOver_Count` int(11) NOT NULL DEFAULT '1' COMMENT 'ºãÁ÷×ܽ׶ÎÊý[1-3]',"  
                    + "`FlowOver_CharCurr_1` float NOT NULL DEFAULT '0' COMMENT 'ºãÁ÷1½×¶Î³äµçµçÁ÷',"  
                    + "`FlowOver_CharCurr_2` float NOT NULL DEFAULT '0' COMMENT 'ºãÁ÷2½×¶Î³äµçµçÁ÷',"  
                    + "`FlowOver_CharCurr_3` float NOT NULL DEFAULT '0' COMMENT 'ºãÁ÷3½×¶Î³äµçµçÁ÷',"  
                    + "`FlowOver_CharTime_1` int(11) NOT NULL DEFAULT '0' COMMENT 'ºãÁ÷1½×¶Î³äµçʱ³¤'," 
                    + "`FlowOver_CharTime_2` int(11) NOT NULL DEFAULT '0' COMMENT 'ºãÁ÷2½×¶Î³äµçʱ³¤',"  
                    + "`FlowOver_CharTime_3` int(11) NOT NULL DEFAULT '0' COMMENT 'ºãÁ÷3½×¶Î³äµçʱ³¤',"            
                    + " UNIQUE INDEX index_dev_id_uniq (`dev_id`), "
                    + " PRIMARY KEY (`num`) ) "
                    + " ENGINE=MEMORY DEFAULT CHARSET=utf8";
        
        Sql_Mysql sql = new Sql_Mysql(con_pool.getConn());
        ResultSet res = null;
        try {
            if(true == recreate_tb) {
                sql.sqlMysqlExecute(str1);                                        //ÖØ½¨±í            
            }
            sql.sqlMysqlExecute(str2);
            //Ìí¼ÓÖ¸¶¨µÄBattGroupNumÁÐ
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_ram_db'"
                    + " AND table_name='tb_fbs9100_setparam'"
                    + " AND column_name='BattGroupNum'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SetParam_Table 
                                + " ADD COLUMN `BattGroupNum` INT NOT NULL DEFAULT 0;");
            }
            //Ìí¼ÓÖ¸¶¨µÄOnlineVolLowActionÁÐ
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_ram_db'"
                    + " AND table_name='tb_fbs9100_setparam'"
                    + " AND column_name='OnlineVolLowAction'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SetParam_Table 
                                + " ADD COLUMN `OnlineVolLowAction` INT NOT NULL DEFAULT 0;");
            }
            //Ìí¼ÓÖ¸¶¨µÄ DCVolHighLimit ÁÐ
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_ram_db'"
                    + " AND table_name='tb_fbs9100_setparam'"
                    + " AND column_name='DCVolHighLimit'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SetParam_Table 
                                + " ADD COLUMN `DCVolHighLimit` FLOAT NOT NULL DEFAULT 0;");
            }
            //Ìí¼ÓÖ¸¶¨µÄ ChargeCurrSet ÁÐ
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_ram_db'"
                    + " AND table_name='tb_fbs9100_setparam'"
                    + " AND column_name='ChargeCurrSet'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SetParam_Table 
                                + " ADD COLUMN `ChargeCurrSet` FLOAT NOT NULL DEFAULT 0;");
            }
            //Ìí¼ÓÖ¸¶¨µÄ MonomerTmp_High ÁÐ
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_ram_db'"
                    + " AND table_name='tb_fbs9100_setparam'"
                    + " AND column_name='MonomerTmp_High'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SetParam_Table 
                                + " ADD COLUMN `MonomerTmp_High` FLOAT NOT NULL DEFAULT 0;");
            }
            //Ìí¼ÓÖ¸¶¨µÄ AutoTestStartVol ÁÐ
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_ram_db'"
                    + " AND table_name='tb_fbs9100_setparam'"
                    + " AND column_name='AutoTestStartVol'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SetParam_Table 
                                + " ADD COLUMN `AutoTestStartVol`  float NOT NULL DEFAULT 0;");
            }
            
            //Ìí¼ÓÖ¸¶¨µÄ OnLineVol_Low ÁÐ(ÔÚÏßµçѹµÍ·§Öµ)
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_ram_db'"
                    + " AND table_name='tb_fbs9100_setparam'"
                    + " AND column_name='OnLineVol_Low'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SetParam_Table 
                                + " ADD COLUMN `OnLineVol_Low`  float NOT NULL DEFAULT 0;");
            }
            
            //Ìí¼ÓÖ¸¶¨µÄ OffLineYH_Cycle ÁÐ(ÀëÏßÑø»¤ÖÜÆÚ)
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_ram_db'"
                    + " AND table_name='tb_fbs9100_setparam'"
                    + " AND column_name='OffLineYH_Cycle'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SetParam_Table 
                                + " ADD COLUMN `OffLineYH_Cycle`  int NOT NULL DEFAULT 0;");
            }
            //Ìí¼ÓÖ¸¶¨µÄOffLineYHstarttimeÁÐ(Ñø»¤¼Æ»®¿ªÊ¼Ê±¼ä)
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_ram_db'"
                    + " AND table_name='tb_fbs9100_setparam'"
                    + " AND column_name='OffLineYHstarttime'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SetParam_Table 
                                + " ADD COLUMN `OffLineYHstarttime` datetime NOT NULL DEFAULT '2000-01-01 00:00:00';");
            }
            //Ìí¼ÓÖ¸¶¨µÄOffLineYHTimesÁÐ(ÀëÏßÑø»¤Ö´ÐдÎÊý)
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_ram_db'"
                    + " AND table_name='tb_fbs9100_setparam'"
                    + " AND column_name='OffLineYHTimes'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SetParam_Table 
                                + " ADD COLUMN `OffLineYHTimes` int(11) NOT NULL DEFAULT '1';");
            }
            //Ìí¼ÓÖ¸¶¨µÄOffLineYHOnceCycleÁÐ(ÀëÏßÑø»¤Ã¿´ÎÖ´ÐÐÖÜÆÚ)
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_ram_db'"
                    + " AND table_name='tb_fbs9100_setparam'"
                    + " AND column_name='OffLineYHOnceCycle'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SetParam_Table 
                                + " ADD COLUMN `OffLineYHOnceCycle` int(11) NOT NULL DEFAULT '1';");
            }
            
            /*     2021-07-19 edit by lijun 
             *  FGCD_A059É豸ÐÂÔö²ÎÊý
             */
            //Ìí¼ÓÖ¸¶¨µÄMonCountÁÐ(ÿ×éµ¥ÌåÊý)
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_ram_db'"
                    + " AND table_name='tb_fbs9100_setparam'"
                    + " AND column_name='MonCount'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SetParam_Table 
                                + " ADD COLUMN `MonCount` int(11) NOT NULL DEFAULT '0' COMMENT 'ÿ×éµ¥ÌåÊý';");
            }
            
            //Ìí¼ÓÖ¸¶¨µÄMonVolÁÐ(µ¥Ìåµçѹ)
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_ram_db'"
                    + " AND table_name='tb_fbs9100_setparam'"
                    + " AND column_name='MonVol'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SetParam_Table 
                                + " ADD COLUMN `MonVol` float NOT NULL DEFAULT '0' COMMENT 'µ¥Ìåµçѹ';");
            }
            
            //Ìí¼ÓÖ¸¶¨µÄDisPowerÁÐ(Ô¤·Å¹¦ÂÊ£¨0.1kw£©)
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_ram_db'"
                    + " AND table_name='tb_fbs9100_setparam'"
                    + " AND column_name='DisPower'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SetParam_Table 
                                + " ADD COLUMN `DisPower` float(11,0) NOT NULL DEFAULT '0' COMMENT 'Ô¤·Å¹¦ÂÊ£¨0.1kw£©';");
            }
            
            //Ìí¼ÓÖ¸¶¨µÄDisPreResÁÐ(·Åµç×èÖµ(m¦¸))
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_ram_db'"
                    + " AND table_name='tb_fbs9100_setparam'"
                    + " AND column_name='DisPreRes'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SetParam_Table 
                                + " ADD COLUMN `DisPreRes` float(11,0) NOT NULL DEFAULT '0' COMMENT '·Åµç×èÖµ(m¦¸)';");
            }
            
            //Ìí¼ÓÖ¸¶¨µÄCharCapÁÐ(³äµçÈÝÁ¿(AH))
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_ram_db'"
                    + " AND table_name='tb_fbs9100_setparam'"
                    + " AND column_name='CharCap'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SetParam_Table 
                                + " ADD COLUMN `CharCap` int(11) NOT NULL DEFAULT '0' COMMENT '³äµçÈÝÁ¿(AH)';");
            }
            
            //Ìí¼ÓÖ¸¶¨µÄCharTimeLongÁÐ(³äµçʱ³¤(min))
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_ram_db'"
                    + " AND table_name='tb_fbs9100_setparam'"
                    + " AND column_name='CharTimeLong'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SetParam_Table 
                                + " ADD COLUMN `CharTimeLong` int(11) NOT NULL DEFAULT '0' COMMENT '³äµçʱ³¤(min)';");
            }
            
            //Ìí¼ÓÖ¸¶¨µÄFloatCharTimeLongÁÐ(¸¡³äʱ³¤)
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_ram_db'"
                    + " AND table_name='tb_fbs9100_setparam'"
                    + " AND column_name='FloatCharTimeLong'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SetParam_Table 
                                + " ADD COLUMN `FloatCharTimeLong` int(11) NOT NULL DEFAULT '0' COMMENT '¸¡³äʱ³¤';");
            }
            
            //Ìí¼ÓÖ¸¶¨µÄCharSotpCurrÁÐ(½ØÖ¹µçÁ÷(0.1A))
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_ram_db'"
                    + " AND table_name='tb_fbs9100_setparam'"
                    + " AND column_name='CharSotpCurr'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SetParam_Table 
                                + " ADD COLUMN `CharSotpCurr` float(11,0) NOT NULL DEFAULT '0' COMMENT '½ØÖ¹µçÁ÷(0.1A)';");
            }
            
            //Ìí¼ÓÖ¸¶¨µÄMonVolHightLimitÁÐ(µ¥ÌåÉÏÏÞ(0.01V))
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_ram_db'"
                    + " AND table_name='tb_fbs9100_setparam'"
                    + " AND column_name='MonVolHightLimit'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SetParam_Table 
                                + " ADD COLUMN `MonVolHightLimit` float(11,0) NOT NULL DEFAULT '0' COMMENT 'µ¥ÌåÉÏÏÞ(0.01V)';");
            }
            
            //Ìí¼ÓÖ¸¶¨µÄMonVolHightLimitCountÁÐ(µ¥ÌåÉÏÏÞÊýÁ¿)
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_ram_db'"
                    + " AND table_name='tb_fbs9100_setparam'"
                    + " AND column_name='MonVolHightLimitCount'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SetParam_Table 
                                + " ADD COLUMN `MonVolHightLimitCount` int(11) NOT NULL DEFAULT '0' COMMENT 'µ¥ÌåÉÏÏÞÊýÁ¿';");
            }
            
            //Ìí¼ÓÖ¸¶¨µÄCharHighTmpÁÐ(³äµç¹ýÎÂ)
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_ram_db'"
                    + " AND table_name='tb_fbs9100_setparam'"
                    + " AND column_name='CharHighTmp'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SetParam_Table 
                                + " ADD COLUMN `CharHighTmp` int(11) NOT NULL DEFAULT '0' COMMENT '³äµç¹ýÎÂ';");
            }
            //ÐÞ¸ÄÖ¸¶¨µÄCharHighTmpÁÐ(³äµç¹ýÎÂ)×Ö¶Îint ->double
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_ram_db'"
                    + " AND table_name='tb_fbs9100_setparam'"
                    + " AND column_name='CharHighTmp'");
            if(res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SetParam_Table 
                                + " modify  column `CharHighTmp` float(11,0) NOT NULL DEFAULT '45' COMMENT '³äµç¹ýÎÂ';");
            }
            
            //Ìí¼ÓÖ¸¶¨µÄDisWaitTimeÁÐ(·ÅÍê¾²ÖÃ(0-500·ÖÖÓ))
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_ram_db'"
                    + " AND table_name='tb_fbs9100_setparam'"
                    + " AND column_name='DisWaitTime'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SetParam_Table 
                                + " ADD COLUMN `DisWaitTime` int(11) NOT NULL DEFAULT '0' COMMENT '·ÅÍê¾²ÖÃ(0-500·ÖÖÓ)';");
            }
            
            //Ìí¼ÓÖ¸¶¨µÄCharWaitTimeÁÐ(³äÍê¾²ÖÃ(0-500·ÖÖÓ))
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_ram_db'"
                    + " AND table_name='tb_fbs9100_setparam'"
                    + " AND column_name='CharWaitTime'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SetParam_Table 
                                + " ADD COLUMN `CharWaitTime` int(11) NOT NULL DEFAULT '0' COMMENT '³äÍê¾²ÖÃ(0-500·ÖÖÓ)';");
            }
            
            //Ìí¼ÓÖ¸¶¨µÄFlowOver_CountÁÐ(ºãÁ÷×ܽ׶ÎÊý[1-3])
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_ram_db'"
                    + " AND table_name='tb_fbs9100_setparam'"
                    + " AND column_name='FlowOver_Count'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SetParam_Table 
                                + " ADD COLUMN `FlowOver_Count` int(11) NOT NULL DEFAULT '1' COMMENT 'ºãÁ÷×ܽ׶ÎÊý[1-3]';");
            }
            
            //Ìí¼ÓÖ¸¶¨µÄFlowOver_CharCurr_1ÁÐ(ºãÁ÷1½×¶Î³äµçµçÁ÷)
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_ram_db'"
                    + " AND table_name='tb_fbs9100_setparam'"
                    + " AND column_name='FlowOver_CharCurr_1'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SetParam_Table 
                                + " ADD COLUMN `FlowOver_CharCurr_1` float(11,0) NOT NULL DEFAULT '0' COMMENT 'ºãÁ÷1½×¶Î³äµçµçÁ÷';");
            }
            
            //Ìí¼ÓÖ¸¶¨µÄFlowOver_CharCurr_2ÁÐ(ºãÁ÷2½×¶Î³äµçµçÁ÷)
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_ram_db'"
                    + " AND table_name='tb_fbs9100_setparam'"
                    + " AND column_name='FlowOver_CharCurr_2'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SetParam_Table 
                                + " ADD COLUMN `FlowOver_CharCurr_2` float(11,0) NOT NULL DEFAULT '0' COMMENT 'ºãÁ÷2½×¶Î³äµçµçÁ÷';");
            }
            
            //Ìí¼ÓÖ¸¶¨µÄFlowOver_CharCurr_3ÁÐ(ºãÁ÷3½×¶Î³äµçµçÁ÷)
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_ram_db'"
                    + " AND table_name='tb_fbs9100_setparam'"
                    + " AND column_name='FlowOver_CharCurr_3'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SetParam_Table 
                                + " ADD COLUMN `FlowOver_CharCurr_3` float(11,0) NOT NULL DEFAULT '0' COMMENT 'ºãÁ÷3½×¶Î³äµçµçÁ÷';");
            }
            
            //Ìí¼ÓÖ¸¶¨µÄFlowOver_CharTime_1ÁÐ(ºãÁ÷1½×¶Î³äµçʱ³¤)
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_ram_db'"
                    + " AND table_name='tb_fbs9100_setparam'"
                    + " AND column_name='FlowOver_CharTime_1'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SetParam_Table 
                                + " ADD COLUMN `FlowOver_CharTime_1` int(11) NOT NULL DEFAULT '0' COMMENT 'ºãÁ÷1½×¶Î³äµçʱ³¤';");
            }
            
            //Ìí¼ÓÖ¸¶¨µÄFlowOver_CharTime_2ÁÐ(ºãÁ÷2½×¶Î³äµçʱ³¤)
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_ram_db'"
                    + " AND table_name='tb_fbs9100_setparam'"
                    + " AND column_name='FlowOver_CharTime_2'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SetParam_Table 
                                + " ADD COLUMN `FlowOver_CharTime_2` int(11) NOT NULL DEFAULT '0' COMMENT 'ºãÁ÷2½×¶Î³äµçʱ³¤';");
            }
            
            //Ìí¼ÓÖ¸¶¨µÄFlowOver_CharTime_3ÁÐ(ºãÁ÷3½×¶Î³äµçʱ³¤)
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_ram_db'"
                    + " AND table_name='tb_fbs9100_setparam'"
                    + " AND column_name='FlowOver_CharTime_3'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SetParam_Table 
                                + " ADD COLUMN `FlowOver_CharTime_3` int(11) NOT NULL DEFAULT '0' COMMENT 'ºãÁ÷3½×¶Î³äµçʱ³¤';");
            }
            
            
            //2022-06-09Ìí¼ÓÖ¸¶¨µÄChargeVoltÁÐ(³äµçµçѹ(V))
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_ram_db'"
                    + " AND table_name='tb_fbs9100_setparam'"
                    + " AND column_name='ChargeVolt'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.FBS9100SetParam_Table 
                        + " ADD COLUMN `ChargeVolt` float NOT NULL DEFAULT '0' COMMENT '³äµçµçѹ(V)';");
            }
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            sql.close_con();
        }
    }
    
    /**
     * ´´½¨ Sql_Mysql.RamDB_CMCC_POWER_Data ±í²¢ÇÒ½«É豸id²åÈëµ½±íÖÐ
     * @param con_pool
     * @param al_param
     */
    public static void createFBS9100CmccPowerDataOnRam(MysqlConnPool con_pool)
    {
        String str1 = "DROP TABLE IF EXISTS " + Sql_Mysql.RamDB_CMCC_POWER_Data;
        String str2 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.RamDB_CMCC_POWER_Data
                    + " ( `num` BIGINT NOT NULL AUTO_INCREMENT, "
                    + "`dev_id` BIGINT NOT NULL DEFAULT 0, "
                    + "`vol1` float NOT NULL DEFAULT 0, "
                    + "`vol2` float NOT NULL DEFAULT 0, "
                    + "`vol3` float NOT NULL DEFAULT 0, "
                    + "`vol4` float NOT NULL DEFAULT 0, "
                    + "`vol5` float NOT NULL DEFAULT 0, "
                    + "`curr1` float NOT NULL DEFAULT 0, "
                    + "`curr2` float NOT NULL DEFAULT 0, "
                    + "`curr3` float NOT NULL DEFAULT 0, "
                    + "`curr4` float NOT NULL DEFAULT 0, "
                    + "`curr5` float NOT NULL DEFAULT 0, "
                    + " UNIQUE INDEX index_dev_id_uniq (`dev_id`), "
                    + " PRIMARY KEY (`num`) ) "
                    + " ENGINE=InnoDB DEFAULT CHARSET=utf8";
        
        Sql_Mysql sql = new Sql_Mysql(con_pool.getConn());
        try {
            sql.sqlMysqlExecute(str1);
            sql.sqlMysqlExecute(str2);
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            sql.close_con();
        }
    }
    /***********************************************************************************/
    
    /**
     * 
     * @param gB_MysqlConnPool
     */
    public static void createBTSStationState_TableOnRam(MysqlConnPool con_pool,boolean recreate_tb) {
        String str1 = "DROP TABLE IF EXISTS " + Sql_Mysql.BTSStationState_Table;
        String str2 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.BTSStationState_Table
                + " ( `num` BIGINT NOT NULL AUTO_INCREMENT, "
                + "`station_id` BIGINT NOT NULL DEFAULT 0, "
                + "`dev_id` BIGINT NOT NULL DEFAULT 0, "
                + "`record_datetime` varchar(20) NOT NULL DEFAULT '2015-12-02 12:10:00', "                
                + "`station_stat` INT NOT NULL DEFAULT 0, "                
                + "`station_poff_start_time` varchar(20) NOT NULL DEFAULT '2015-12-02 12:10:00', "
                //+ "`station_poff_tlong` INT NOT NULL DEFAULT 0, "                
                + "`station_fadian_start_time` varchar(20) NOT NULL DEFAULT '2015-12-02 12:10:00', "
                //+ "`station_fadian_tlong` INT NOT NULL DEFAULT 0, "                
                + "`station_diaozhan_start_time` varchar(20) NOT NULL DEFAULT '2015-12-02 12:10:00', "
                //+ "`station_diaozhan_tlong` INT NOT NULL DEFAULT 0, "                
                + "`station_temp` float NOT NULL DEFAULT 0, "    //ζÈ
                + "`station_damp` float NOT NULL DEFAULT 0, "    //ʪ¶È                
                + "`station_dooropen_start_time` varchar(20) NOT NULL DEFAULT '2015-12-02 12:10:00', "
                //+ "`station_dooropen_tlong` INT NOT NULL DEFAULT 0, "                
                + "`station_xuhang_start_time` varchar(20) NOT NULL DEFAULT '2015-12-02 12:10:00', "
                + "`station_xuhang_end_time` varchar(20) NOT NULL DEFAULT '2015-12-02 12:10:00', "
                + " UNIQUE INDEX index_station_id_uniq (`station_id`), "
                + " PRIMARY KEY (`num`) ) "
                + " ENGINE=InnoDB DEFAULT CHARSET=utf8";
        Sql_Mysql sql = new Sql_Mysql(con_pool.getConn());
        try {
            if(recreate_tb) {                
                sql.sqlMysqlExecute(str1);
            }
            sql.sqlMysqlExecute(str2);
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            sql.close_con();
        }
    }
 
    /**
     *     ²åÈëÔÚ»ú·¿×´Ì¬±íÖÐδÌí¼Ó»ú·¿×´Ì¬µÄ¼Ç¼
     * @param gB_MysqlConnPool
     */
    public static void insertBTSStationState_TableOnRam(MysqlConnPool con_pool) {
        //²éѯûÓÐÌí¼Ó»ú·¿×´Ì¬µÄ»ú·¿¼Ç¼
        String sql_str1 = " SELECT DISTINCT StationId,FBSDeviceId " + 
                          " FROM " + Sql_Mysql.BattInf_Table + 
                          "    WHERE StationId NOT IN( " + 
                          "        SELECT station_id " + 
                          "        FROM  "+ Sql_Mysql.BTSStationState_Table + 
                          ")";
        //Ìí¼Ó»ú·¿×´Ì¬µÄ¼Ç¼
        String sql_str2 = " INSERT INTO " + Sql_Mysql.BTSStationState_Table + "(dev_id,station_id) VALUES ";
        
        Sql_Mysql sql = new Sql_Mysql(con_pool.getConn());
        ResultSet rs = null;
        try {
            rs= sql.sqlMysqlQuery(sql_str1);
            //System.out.println(sql_str1);
            Map<Integer, String> station = new HashMap<>();
            while(rs.next()) {
                String dev_id = rs.getString("FBSDeviceId");
                int stationid = rs.getInt("StationId");
                if(stationid > 0 && null != dev_id) {
                    String fbs_dev_id = station.get(stationid);
                    if(null == fbs_dev_id) {
                        station.put(stationid, dev_id);
                    }                    
                }                
            }
            boolean hasInsertStation = false;
            if(!station.isEmpty()) {
                for(Map.Entry<Integer, String> entry : station.entrySet()){
                    Integer mapKey = entry.getKey();
                    String mapValue = entry.getValue();
                    
                    if( !hasInsertStation ) {
                        sql_str2 = sql_str2 + "(" + mapValue + "," + mapKey + ")";
                        hasInsertStation = true;
                    }else {
                        sql_str2 = sql_str2 + ",(" + mapValue + "," + mapKey + ")";
                    }                
                }
                //System.out.println(sql_str2);
                sql.sqlMysqlExecute(sql_str2);
            }
            station.clear();
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            sql.close_con();
        }        
    }
    
    /**
     *     ¼ì²é»ú·¿idÓëÉ豸id²»¶ÔÓ¦µÄ»ú·¿¼Ç¼²¢ÓèÒÔ¸ÄÕýÐÞ¸´
     * @param gB_MysqlConnPool
     */
    public static void checkBTSStationState_TableOnRam(MysqlConnPool gB_MysqlConnPool) {
        String sql_str1 = "SELECT DISTINCT StationName,dev_id,FBSDeviceId,StationId " + 
                " FROM " + Sql_Mysql.BattInf_Table + "," + Sql_Mysql.BTSStationState_Table +
                " WHERE tb_battinf.StationId = tb_bts_station_state.station_id " + 
                " AND tb_battinf.FBSDeviceId != tb_bts_station_state.dev_id ";
        Sql_Mysql sql = new Sql_Mysql(gB_MysqlConnPool.getConn());
        ResultSet rs = null;
        try {
            rs = sql.sqlMysqlQuery(sql_str1);
            while(rs.next()) {
                String stationId = rs.getString("StationId");
                String FBSDeviceId = rs.getString("FBSDeviceId");
                sql.sqlMysqlExecute("UPDATE " + Sql_Mysql.BTSStationState_Table + " SET dev_id = " + FBSDeviceId + " WHERE Station_Id = " + stationId);
            }
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            if(rs != null) {
                try {
                    rs.close();
                } catch (SQLException e) {
                    e.printStackTrace();
                }
            }
            sql.close_con();
        }        
    }
 
    /**
     *        ´´½¨É豸µÄϵͳ²ÎÊý±í
     * @param con_pool
     * @param recreate_tb
     */
    public static void createFBS9100SysParam_TableOnRam(MysqlConnPool con_pool,boolean recreate_tb) {
        String sql_str0 = "DROP TABLE IF EXISTS " + Sql_Mysql.FBS9100SysParam_Table + "; ";
        String sql_str1 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.FBS9100SysParam_Table
                + " ( `num` BIGINT NOT NULL AUTO_INCREMENT, "
                + "`dev_ip` varchar(20) NOT NULL DEFAULT '127.0.0.0', "
                + "`dev_id` BIGINT NOT NULL DEFAULT 0, "
                + "`op_cmd` INT NOT NULL DEFAULT 0, "
                + "`IPADDR` varchar(20) NOT NULL DEFAULT '127.0.0.0', "
                + "`SubIPADDR` varchar(20) NOT NULL DEFAULT '127.0.0.0', "
                + "`NetGateADDR` varchar(20) NOT NULL DEFAULT '127.0.0.0', "
                + "`GroupVolRange` INT NOT NULL DEFAULT 0, "
                + "`GroupVolSorce` INT NOT NULL DEFAULT 0, "
                + "`CurrentRange` INT NOT NULL DEFAULT 0, "
                + "`CurrentTyte` INT NOT NULL DEFAULT 0, "
                + "`MonomerOrder` INT NOT NULL DEFAULT 0, "
                + "`BackLightTime` INT NOT NULL DEFAULT 0, "
                + "`MACADDR` varchar(30) NOT NULL DEFAULT '0.0.0.0.0.0', "
                + "`LoaderCount` INT NOT NULL DEFAULT 0, "
                + "`DtCardCount` INT NOT NULL DEFAULT 0, "
                + "`PowerBreakChargeCurr` FLOAT NOT NULL DEFAULT 0, "
                + "`MajorBattGroupNum` INT NOT NULL DEFAULT 0, "
                + "`POF_BG_Boost_Cnt` INT NOT NULL DEFAULT 0, "
                + "`POF_BG_Boost_VolStop` FLOAT NOT NULL DEFAULT 0, "
                + "`POF_BG_Boost_VolStart` FLOAT NOT NULL DEFAULT 0, "
                + " UNIQUE INDEX index_dev_id_uniq (`dev_id`), "
                + " PRIMARY KEY (`num`) ) "
                + " ENGINE=MEMORY DEFAULT CHARSET=utf8";
        Sql_Mysql sql = new Sql_Mysql(con_pool.getConn());
        try {
            if(true == recreate_tb) {
                sql.sqlMysqlExecute(sql_str0);
            } else {
                //sql.sqlMysqlExecute("DELETE FROM " + Sql_Mysql.FBS9100SysParam_Table);
            }
            sql.sqlMysqlExecute(sql_str1);
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            sql.close_con();
        }
    }
 
    /**
     *     ´´½¨61850¾ùºâ¹©µçÄ£¿éÐÅÏ¢±í
     * @param pool
     * @param recreate_tb
     */
    public static void createTB_61850_JHState_TableOnRam(MysqlConnPool pool, boolean recreate_tb) {
        String sql_str0 = "DROP TABLE IF EXISTS " + Sql_Mysql.TB_61850_JHState_Table + "; ";
        
        String sql_str1 = "CREATE TABLE IF NOT EXISTS  "+Sql_Mysql.TB_61850_JHState_Table+" (" + 
                "  `num` bigint(20) NOT NULL AUTO_INCREMENT," + 
                "  `dev_id` int(11) NOT NULL DEFAULT '0'," + 
                "  `dev_version` varchar(255) NOT NULL DEFAULT ''," + 
                "  `input_vol_total` double NOT NULL DEFAULT '0'," + 
                "  `output_vol_total` double NOT NULL DEFAULT '0'," + 
                "  `input_curr_total` double NOT NULL DEFAULT '0'," + 
                "  `output_curr_total` double NOT NULL DEFAULT '0'," + 
                "  `output_vol_one` double NOT NULL DEFAULT '0'," + 
                "  `output_vol_two` double NOT NULL DEFAULT '0'," + 
                "  `output_vol_three` double NOT NULL DEFAULT '0'," + 
                "  `output_vol_four` double NOT NULL DEFAULT '0'," + 
                "  `output_vol_five` double NOT NULL DEFAULT '0'," + 
                "  `output_vol_six` double NOT NULL DEFAULT '0'," + 
                "  `output_vol_seven` double NOT NULL DEFAULT '0'," + 
                "  `output_vol_eight` double NOT NULL DEFAULT '0'," + 
                "  `output_vol_nine` double NOT NULL DEFAULT '0'," + 
                "  `output_vol_ten` double NOT NULL DEFAULT '0'," + 
                "  `dev_temp` double NOT NULL DEFAULT '0'," + 
                "  PRIMARY KEY (`num`)," + 
                "  UNIQUE KEY `index_dev_id_unique` (`dev_id`) USING BTREE" + 
                ") ENGINE=InnoDB DEFAULT CHARSET=utf8;";
                
        Sql_Mysql sql = new Sql_Mysql(pool.getConn());
        try {
            if(true == recreate_tb) {
                sql.sqlMysqlExecute(sql_str0);
            } else {
                
            }
            sql.sqlMysqlExecute(sql_str1);
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            sql.close_con();
        }        
    }
 
    
    /**
     *     ´´½¨61850ÀëÏßÑø»¤¼Æ»®²ÎÊý±í
     * @param pool
     * @param recreate_tb
     */
    public static void createFBS9100_offlineyhplanOnRam(MysqlConnPool pool, boolean recreate_tb) {
        String sql_str0 = "DROP TABLE IF EXISTS " + Sql_Mysql.FBS9100_offlineyhplan + "; ";
        
        String sql_str1 = "CREATE TABLE IF NOT EXISTS  "+Sql_Mysql.FBS9100_offlineyhplan+" (" + 
                "  num bigint(20) NOT NULL AUTO_INCREMENT," + 
                "  dev_id int(11) NOT NULL DEFAULT '1'," + 
                "  OffLineYH_Cycle int(11) NOT NULL DEFAULT '1'," + 
                "  OffLineYHstarttime datetime NOT NULL DEFAULT '2000-01-01 00:00:00'," + 
                "  OffLineYHTimes int(11) NOT NULL DEFAULT '0'," + 
                "  OffLineYHOnceCycle int(11) NOT NULL DEFAULT '0'," + 
                "  note varchar(255) NOT NULL DEFAULT ''," + 
                "  PRIMARY KEY (`num`)" + 
                ") ENGINE=InnoDB DEFAULT CHARSET=utf8; ";
                
        Sql_Mysql sql = new Sql_Mysql(pool.getConn());
        try {
            if(true == recreate_tb) {
                sql.sqlMysqlExecute(sql_str0);
            } else {
                
            }
            sql.sqlMysqlExecute(sql_str1);
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            sql.close_con();
        }        
    }
    
    public static void main(String[] args) {
        MysqlConnPool pool = new MysqlConnPool("127.0.0.1", 3360, 100);
        FBS9100_Task_Thread_SQL thread = new FBS9100_Task_Thread_SQL();
        //thread.createFBS9100SetTestParamTableOnRam(pool, false);
        thread.createFBS9100StateTableOnRam(pool, false);
        
    }
    
}