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
package com.dev.lock.history;
 
import com.base.Com;
import com.dev.lock.data.ElectLock_RecordState;
import com.dev.lock.data.ElectLock_Report;
import com.sql.Sql_Mysql;
 
public class InsertDataToMysql_Task_SQL {
 
    /**
     *     构造年度开锁记录表
     * @param sql
     * @param lock_id
     * @param report
     * @return
     */
    public static String getInsertLock_Report_TableDataStr(int lock_id,ElectLock_Report report) {
        String sql_str_upd = " UPDATE " + Sql_Mysql.Lock_Report_Table +
                            " SET month1 = " + report.month1 +
                            " ,month2 = " + report.month2 +
                            " ,month3 = " + report.month3 +
                            " ,month4 = " + report.month4 +
                            " ,month5 = " + report.month5 +
                            " ,month6 = " + report.month6 +
                            " ,month7 = " + report.month7 +
                            " ,month8 = " + report.month8 +
                            " ,month9 = " + report.month9 +
                            " ,month10 = " + report.month10 +
                            " ,month11 = " + report.month11 +
                            " ,month12 = " + report.month12 +
                            " ,quarter1 = " + report.quarter1 +
                            " ,quarter2 = " + report.quarter2 +
                            " ,quarter3 = " + report.quarter3 +
                            " ,quarter4 = " + report.quarter4 +
                            " ,year_count = " + report.year_count +
                            " WHERE lock_id = " + lock_id +
                            " AND record_year = " + report.record_year;
        return sql_str_upd;
    }
    
    
    /**
     *    构造锁具开关锁,记录表
     * @param sql
     * @param lock_id
     * @param report
     * @return
     */
    public static String getInsertLock_His_TableDataStr(int lock_id,ElectLock_RecordState state) {
        String sql_str_upd =  " INSERT INTO " + Sql_Mysql.Lock_His_Table + lock_id + "_" + Com.getDateTimeFormat(state.record_time, Com.DTF_Y) + " "
                + "             (lock_id,record_time,lock_state,unlock_type,unlock_id) "
            + "                VALUES(" 
                                + lock_id 
                                + ",'" + Com.getDateTimeFormat(state.record_time, Com.DTF_YMDhms) 
                                + "'," + state.lock_state  
                                + "," + state.unlock_type 
                                + "," + state.unlock_id + 
                            ");";
        return sql_str_upd;
    }
 
}