123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- package data_manage
- import (
- "eta_gn/eta_api/global"
- "eta_gn/eta_api/utils"
- "fmt"
- )
- func EdbInfoUpdateStatusByEdbInfoId(edbInfoIds []int, isStop int, calculateEdbInfoIds []int) (err error) {
- o := global.DmSQL["data"].Begin()
- defer func() {
- if err != nil {
- _ = o.Rollback()
- return
- }
- _ = o.Commit()
- }()
- if len(edbInfoIds) == 1 {
- sql := ` UPDATE edb_info SET no_update = ? WHERE edb_info_id=? `
- err = o.Exec(sql, isStop, edbInfoIds[0]).Error
- if err != nil {
- return
- }
- } else {
- sql := ` UPDATE edb_info SET no_update = ? WHERE edb_info_id IN (` + utils.GetOrmInReplace(len(edbInfoIds)) + `) `
- err = o.Exec(sql, isStop, edbInfoIds).Error
- if err != nil {
- return
- }
- }
- if len(calculateEdbInfoIds) > 0 {
- sql := ` UPDATE edb_info SET no_update = ? WHERE edb_info_id IN (` + utils.GetOrmInReplace(len(calculateEdbInfoIds)) + `) `
- err = o.Exec(sql, isStop, calculateEdbInfoIds).Error
- if err != nil {
- return
- }
- }
- return
- }
- func ModifyEdbInfoWindWsdDataStatus(source, subSource int, edbInfoId int64, edbCode string) (err error) {
- tableName := GetEdbDataTableNameAndSubSource(source, subSource)
- sql := ` UPDATE %s SET edb_info_id=?,modify_time=NOW() WHERE edb_code=? `
- sql = fmt.Sprintf(sql, tableName)
- err = global.DmSQL["data"].Exec(sql, edbInfoId, edbCode).Error
- return
- }
|