作者 tangxvhui

修复数据用脚本

  1 +-- 数据修复
  2 +WITH t_node_task AS (
  3 + SELECT
  4 + *
  5 + FROM (
  6 + SELECT
  7 + row_number() OVER (PARTITION BY project_id) AS row_id,
  8 + *
  9 + FROM
  10 + node_task
  11 + WHERE
  12 + cycle_id = 1653724699349225472
  13 + AND node_type = 1) AS t_node_task
  14 + WHERE
  15 + row_id = 1
  16 + ORDER BY
  17 + project_id)
  18 +UPDATE
  19 + node_task
  20 +SET
  21 + deleted_at = now()
  22 +WHERE
  23 + cycle_id = 1653724699349225472
  24 + AND node_task.id NOT IN (
  25 + SELECT
  26 + "id"
  27 + FROM
  28 + t_node_task);
  29 +
  30 +WITH t_staff_assess AS (
  31 + SELECT
  32 + row_number() OVER (PARTITION BY evaluation_project_id,
  33 + "types") AS row_id,
  34 + *
  35 + FROM
  36 + staff_assess
  37 + WHERE
  38 + 1 = 1
  39 + AND cycle_id = 1653724699349225472
  40 + AND NOT EXISTS (
  41 + SELECT
  42 + *
  43 + FROM
  44 + staff_assess_content
  45 + WHERE
  46 + staff_assess_content.staff_assess_id = staff_assess.id)
  47 +),
  48 +t_staff_assess_2 AS (
  49 + SELECT
  50 + *
  51 + FROM
  52 + t_staff_assess
  53 + WHERE
  54 + row_id = 1)
  55 +UPDATE
  56 + staff_assess
  57 +SET
  58 + deleted_at = now()
  59 +WHERE
  60 + 1 = 1
  61 + AND cycle_id = 1653724699349225472
  62 + AND staff_assess.id NOT IN (
  63 + SELECT
  64 + id
  65 + FROM
  66 + t_staff_assess_2);
  67 +
  68 +UPDATE
  69 + staff_assess_task
  70 +SET
  71 + step_list = '[{"sortBy":1,"endTime":"2023-05-04T08:30:00+08:00","beginTime":"2023-05-03T00:00:00+08:00","linkNodeId":1651883218342776833,"linkNodeName":"填写自评反馈","linkNodeType":1},{"sortBy":2,"endTime":"2023-05-04T08:30:00+08:00","beginTime":"2023-05-03T00:00:00+08:00","linkNodeId":1651883218342776834,"linkNodeName":"360°邀请","linkNodeType":2},{"sortBy":3,"endTime":"2023-05-04T08:30:00+08:00","beginTime":"2023-05-03T00:00:00+08:00","linkNodeId":1651883218342776835,"linkNodeName":"360°评估","linkNodeType":3},{"sortBy":4,"endTime":"2023-05-04T08:30:00+08:00","beginTime":"2023-05-03T00:00:00+08:00","linkNodeId":1651883218342776836,"linkNodeName":"上级评估","linkNodeType":4},{"sortBy":5,"endTime":"2023-05-04T08:30:00+08:00","beginTime":"2023-05-03T00:00:00+08:00","linkNodeId":1651883218342776837,"linkNodeName":"绩效结果查看","linkNodeType":5}]'
  72 +WHERE
  73 + 1 = 1
  74 + AND cycle_id = 1653724699349225472