-- 收支明细(订单类型)
update tb_cloud_income_expenditure a LEFT JOIN tb_cloud_order_app b on a.order_id = b.order_id
set a.order_type = b.order_type
WHERE a.order_type is null;

-- 收支明细(应用名称)
update tb_cloud_income_expenditure a LEFT JOIN tb_cloud_order_app b on a.order_id = b.order_id
set a.app_name = b.product_app_name
WHERE a.app_name is null;

-- 收支明细(收支对象 开通)
update tb_cloud_income_expenditure a LEFT JOIN tb_cloud_order_app b on a.order_id = b.order_id
set a.obj_name = if(LENGTH(b.buyer_name)>0, b.buyer_name, b.buyer_username)
WHERE a.settle_type = 0 and a.obj_name is null;

-- 收支明细(收支对象 开发者结算)
update tb_cloud_income_expenditure a LEFT JOIN tb_cloud_order_settle b on a.order_id = b.order_id
LEFT JOIN sys_user c on b.user_id = c.id
LEFT JOIN tb_company_authentication_info d on c.authentication_sn = d.authentication_sn
set a.obj_name = d.company_name
WHERE a.settle_type = 10 and a.obj_name is null;

-- 收支明细(收支对象 渠道商结算)
update tb_cloud_income_expenditure a LEFT JOIN tb_cloud_order_settle b on a.order_id = b.order_id
LEFT JOIN tb_cloud_channel c on b.user_id = c.user_id
set a.obj_name = c.`name`
WHERE a.settle_type = 20 and a.obj_name is null;

-- 收支明细(收支对象 手续费)
update tb_cloud_income_expenditure a LEFT JOIN tb_cloud_order_settle b on a.order_id = b.order_id
LEFT JOIN tb_cloud_channel c on b.user_id = c.user_id
set a.obj_name = '易宝'
WHERE a.settle_type in (30,40) and a.obj_name is null;

-- 新增字段后初始化
update tb_user_login_record a left JOIN sys_user b on a.user_sn = b.usersn set a.phone = b.phone;

-- 初始化中台关系表过期时间
UPDATE tb_cloud_relation_centerstage a LEFT JOIN ( SELECT max(end_time) end_time, relation_id, app_type
FROM tb_cloud_charge_reation WHERE app_type = 10 GROUP BY relation_id ) b ON a.id = b.relation_id SET a.due_time = b.endTime
WHERE b.app_type = 10

-- 初始化应用关系表过期时间
UPDATE tb_app_relations AS a LEFT JOIN ( SELECT MAX(end_time) AS end_time, relation_id FROM tb_cloud_charge_reation
WHERE app_type = 0 GROUP BY relation_id ) AS b ON a.id = b.relation_id SET a.due_time = b.end_time

相关文章:

  • 2022-12-23
  • 2021-12-09
  • 2021-11-15
  • 2021-09-04
  • 2021-11-26
  • 2021-12-05
  • 2022-01-02
猜你喜欢
  • 2021-07-15
  • 2022-12-23
  • 2022-12-23
  • 2022-01-07
  • 2022-12-23
  • 2021-11-11
  • 2022-12-23
相关资源
相似解决方案