SwitchOnOff.sql 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #查询发射机计划
  2. SELECT *
  3. FROM tExecPlan;
  4. #删除发射机计划
  5. DELETE
  6. FROM tExecPlan
  7. WHERE PTTypeCode = 955;
  8. DELETE
  9. FROM tExecPlan
  10. WHERE PTTypeCode = :PTTypeCode;
  11. #===============================================
  12. # 发射机计划模版表格-tExecPlanTemplate
  13. #===============================================
  14. #删除表格
  15. DROP TABLE IF EXISTS "EQM_CESHI"."tExecPlanTemplate";
  16. #创建模版表格
  17. CREATE TABLE IF NOT EXISTS "EQM_CESHI"."tExecPlanTemplate"
  18. (
  19. "TemplateName" VARCHAR(255),
  20. "ExecDate" VARCHAR(255),
  21. "ExecTime" VARCHAR(255),
  22. "DeviceName" VARCHAR(255),
  23. "ActionName" VARCHAR(255),
  24. "ActionID" INT
  25. )
  26. #查询模版
  27. SELECT *
  28. FROM tExecPlanTemplate;
  29. #获取模板名称,去掉重复的
  30. SELECT "TemplateName"
  31. FROM tExecPlanTemplate
  32. GROUP BY "TemplateName";
  33. #通过模板名称获取模板数据
  34. SELECT *
  35. FROM tExecPlanTemplate
  36. WHERE "TemplateName" = :templateName;
  37. #插入数据
  38. INSERT INTO tExecPlanTemplate (TemplateName, ExecDate, ExecTime, DeviceName, ActionName, ActionID)
  39. VALUES ('模版1', '2025-02-09', '09:00:00', '发射机1', '开机', 1);
  40. #插入数据,使用参数
  41. INSERT INTO tExecPlanTemplate ("TemplateName", "ExecDate", "ExecTime", "DeviceName", "ActionName", "ActionID")
  42. VALUES (:templateName, :execDate, :execTime, :deviceName, :actionName, :actionID);
  43. #删除模版
  44. DELETE
  45. FROM tExecPlanTemplate
  46. WHERE TemplateName = '模版3';
  47. DELETE
  48. FROM tExecPlanTemplate
  49. WHERE TemplateName = :templateName;