64 lines
1.8 KiB
MySQL
64 lines
1.8 KiB
MySQL
![]() |
INSERT INTO cont_vlog (
|
|||
|
id,
|
|||
|
member_id,
|
|||
|
url,
|
|||
|
cover,
|
|||
|
title,
|
|||
|
width,
|
|||
|
height,
|
|||
|
like_counts,
|
|||
|
comments_counts,
|
|||
|
is_private,
|
|||
|
create_time,
|
|||
|
update_time,
|
|||
|
status,
|
|||
|
reason,
|
|||
|
city_code,
|
|||
|
file_id,
|
|||
|
first_frame_img,
|
|||
|
create_by,
|
|||
|
update_by,
|
|||
|
del_flag
|
|||
|
)
|
|||
|
SELECT
|
|||
|
-- 核心字段映射(t_vlog -> cont_vlog)
|
|||
|
id,
|
|||
|
vloger_id, -- 视频发布者ID映射为会员ID
|
|||
|
url,
|
|||
|
cover,
|
|||
|
title,
|
|||
|
width,
|
|||
|
height,
|
|||
|
like_counts,
|
|||
|
comments_counts,
|
|||
|
is_private,
|
|||
|
created_time, -- 创建时间字段名转换
|
|||
|
updated_time, -- 更新时间字段名转换
|
|||
|
status,
|
|||
|
reason,
|
|||
|
city_code,
|
|||
|
file_id,
|
|||
|
first_frame_img,
|
|||
|
vloger_id, -- 假设创建者为视频发布者
|
|||
|
vloger_id, -- 假设更新者为视频发布者(可根据实际业务调整)
|
|||
|
0 -- 删除标志默认为0(未删除)
|
|||
|
FROM t_vlog
|
|||
|
-- 处理重复数据:若id已存在则更新指定字段
|
|||
|
ON DUPLICATE KEY UPDATE
|
|||
|
member_id = VALUES(member_id),
|
|||
|
url = VALUES(url),
|
|||
|
cover = VALUES(cover),
|
|||
|
title = VALUES(title),
|
|||
|
width = VALUES(width),
|
|||
|
height = VALUES(height),
|
|||
|
like_counts = VALUES(like_counts),
|
|||
|
comments_counts = VALUES(comments_counts),
|
|||
|
is_private = VALUES(is_private),
|
|||
|
update_time = VALUES(update_time),
|
|||
|
status = VALUES(status),
|
|||
|
reason = VALUES(reason),
|
|||
|
city_code = VALUES(city_code),
|
|||
|
file_id = VALUES(file_id),
|
|||
|
first_frame_img = VALUES(first_frame_img),
|
|||
|
update_by = VALUES(update_by);
|