edb_data_wind.go 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. package data_manage
  2. import (
  3. "eta_gn/eta_api/global"
  4. "eta_gn/eta_api/utils"
  5. "fmt"
  6. )
  7. func EdbInfoUpdateStatusByEdbInfoId(edbInfoIds []int, isStop int, calculateEdbInfoIds []int) (err error) {
  8. o := global.DmSQL["data"].Begin()
  9. defer func() {
  10. if err != nil {
  11. _ = o.Rollback()
  12. return
  13. }
  14. _ = o.Commit()
  15. }()
  16. if len(edbInfoIds) == 1 {
  17. sql := ` UPDATE edb_info SET no_update = ? WHERE edb_info_id=? `
  18. err = o.Exec(sql, isStop, edbInfoIds[0]).Error
  19. if err != nil {
  20. return
  21. }
  22. } else {
  23. sql := ` UPDATE edb_info SET no_update = ? WHERE edb_info_id IN (` + utils.GetOrmInReplace(len(edbInfoIds)) + `) `
  24. err = o.Exec(sql, isStop, edbInfoIds).Error
  25. if err != nil {
  26. return
  27. }
  28. }
  29. if len(calculateEdbInfoIds) > 0 {
  30. sql := ` UPDATE edb_info SET no_update = ? WHERE edb_info_id IN (` + utils.GetOrmInReplace(len(calculateEdbInfoIds)) + `) `
  31. err = o.Exec(sql, isStop, calculateEdbInfoIds).Error
  32. if err != nil {
  33. return
  34. }
  35. }
  36. return
  37. }
  38. func ModifyEdbInfoWindWsdDataStatus(source, subSource int, edbInfoId int64, edbCode string) (err error) {
  39. tableName := GetEdbDataTableNameAndSubSource(source, subSource)
  40. sql := ` UPDATE %s SET edb_info_id=?,modify_time=NOW() WHERE edb_code=? `
  41. sql = fmt.Sprintf(sql, tableName)
  42. err = global.DmSQL["data"].Exec(sql, edbInfoId, edbCode).Error
  43. return
  44. }