123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- package data_manage
- import (
- "errors"
- "hongze/hongze_task/utils"
- "strconv"
- "time"
- )
- func GetEdbDataTableName(source int) (tableName string) {
- switch source {
- case utils.DATA_SOURCE_THS:
- tableName = "edb_data_ths"
- case utils.DATA_SOURCE_WIND:
- tableName = "edb_data_wind"
- case utils.DATA_SOURCE_PB:
- tableName = "edb_data_pb"
- case utils.DATA_SOURCE_CALCULATE:
- tableName = "edb_data_calculate"
- case utils.DATA_SOURCE_CALCULATE_LJZZY:
- tableName = "edb_data_calculate_ljzzy"
- case utils.DATA_SOURCE_CALCULATE_TBZ:
- tableName = "edb_data_calculate_tbz"
- case utils.DATA_SOURCE_CALCULATE_TCZ:
- tableName = "edb_data_calculate_tcz"
- case utils.DATA_SOURCE_CALCULATE_NSZYDPJJS:
- tableName = "edb_data_calculate_nszydpjjs"
- case utils.DATA_SOURCE_MANUAL:
- tableName = "edb_data_manual"
- default:
- tableName = ""
- errors.New("无效的渠道:" + strconv.Itoa(source))
- return
- }
- return
- }
- func GetEdbInfoCalculateTableName(source int) (tableName string) {
- switch source {
- case utils.DATA_SOURCE_CALCULATE:
- tableName = "edb_info_calculate"
- case utils.DATA_SOURCE_CALCULATE_LJZZY:
- tableName = "edb_info_calculate_ljzzy"
- case utils.DATA_SOURCE_CALCULATE_TBZ:
- tableName = "edb_info_calculate_tbz"
- case utils.DATA_SOURCE_CALCULATE_TCZ:
- tableName = "edb_info_calculate_tcz"
- case utils.DATA_SOURCE_CALCULATE_NSZYDPJJS:
- tableName = "edb_info_calculate_nszydpjjs"
- default:
- tableName = ""
- errors.New("无效的渠道:" + strconv.Itoa(source))
- return
- }
- return
- }
- func GetAddSql(edbInfoId, edbCode, dataTime, timestampStr,value string) (addSql string) {
- nowStr := time.Now().Format(utils.FormatDateTime)
- addSql += "("
- addSql += edbInfoId + "," + "'" + edbCode + "'" + "," + "'" + dataTime + "'" + "," + value + "," + "'" + nowStr + "'" +
- "," + "'" + nowStr + "'" + "," + "1"
- addSql += "," + "'" + timestampStr + "'"
- addSql += "),"
- return
- }
|