wuzhen 20250723提交
This commit is contained in:
1 parent
609371ed82
commit
cc03e81f49
117 files changed
+76654
-1889
No files matched your search
@@ -0,0 +1,84 @@
|
||||
-- 录取流程数据修复脚本
|
||||
-- 执行时间:2025-07-22
|
||||
-- 目标:确保所有录取流程记录的字段都有默认值,且状态统一为"录取处理中"
|
||||
|
||||
-- 1. 首先获取当前管理员用户ID和姓名,用于填充默认审核人信息
|
||||
SET @admin_id = 1; -- 默认管理员ID
|
||||
SET @admin_name = '系统管理员'; -- 默认管理员姓名
|
||||
|
||||
-- 2. 将所有状态更新为"录取处理中"
|
||||
UPDATE zsjy_enrollment_process
|
||||
SET current_status = '2',
|
||||
info_audit_status = '1',
|
||||
admission_status = '0',
|
||||
final_audit_status = '0'
|
||||
WHERE 1=1;
|
||||
|
||||
-- 3. 填充所有为NULL的基本信息字段
|
||||
UPDATE zsjy_enrollment_process
|
||||
SET
|
||||
-- 当前处理人信息
|
||||
current_handler = COALESCE(current_handler, @admin_id),
|
||||
current_handler_name = COALESCE(current_handler_name, @admin_name),
|
||||
|
||||
-- 信息审核相关字段
|
||||
info_audit_user = COALESCE(info_audit_user, @admin_id),
|
||||
info_audit_user_name = COALESCE(info_audit_user_name, @admin_name),
|
||||
info_audit_time = COALESCE(info_audit_time, NOW()),
|
||||
info_audit_opinion = COALESCE(info_audit_opinion, '系统默认审核通过'),
|
||||
|
||||
-- 录取处理相关字段
|
||||
admission_user = COALESCE(admission_user, NULL),
|
||||
admission_user_name = COALESCE(admission_user_name, NULL),
|
||||
admission_time = COALESCE(admission_time, NULL),
|
||||
admission_opinion = COALESCE(admission_opinion, NULL),
|
||||
|
||||
-- 最终确认相关字段
|
||||
final_audit_user = COALESCE(final_audit_user, NULL),
|
||||
final_audit_user_name = COALESCE(final_audit_user_name, NULL),
|
||||
final_audit_time = COALESCE(final_audit_time, NULL),
|
||||
final_audit_opinion = COALESCE(final_audit_opinion, NULL),
|
||||
|
||||
-- 其他状态字段
|
||||
payment_status = COALESCE(payment_status, '0'),
|
||||
is_completed = COALESCE(is_completed, 0),
|
||||
remark = COALESCE(remark, '系统自动修复的数据')
|
||||
WHERE 1=1;
|
||||
|
||||
-- 4. 确保报名信息审核通过同步到录取流程表
|
||||
-- 4.1 先找出所有已审核通过的报名信息
|
||||
INSERT INTO zsjy_enrollment_process (
|
||||
id, tenant_id, create_by, create_time, update_by, update_time, deleted,
|
||||
enrollment_id, student_name, id_card,
|
||||
current_status, current_handler, current_handler_name,
|
||||
info_audit_status, info_audit_user, info_audit_user_name, info_audit_time, info_audit_opinion,
|
||||
admission_status, final_audit_status, payment_status, is_completed
|
||||
)
|
||||
SELECT
|
||||
-- 生成雪花ID
|
||||
FLOOR(RAND() * 9000000000000000000) + 1000000000000000000 as id,
|
||||
a.tenant_id, @admin_id, NOW(), NULL, NULL, 0,
|
||||
-- 基本信息
|
||||
a.id, a.name, a.id_card,
|
||||
-- 流程状态信息
|
||||
'2' as current_status, @admin_id as current_handler, @admin_name as current_handler_name,
|
||||
'1' as info_audit_status, @admin_id as info_audit_user, @admin_name as info_audit_user_name,
|
||||
NOW() as info_audit_time, '系统自动审核通过' as info_audit_opinion,
|
||||
'0' as admission_status, '0' as final_audit_status, '0' as payment_status, 0 as is_completed
|
||||
FROM zsjy_enrollment_info a
|
||||
LEFT JOIN zsjy_enrollment_process b ON a.id = b.enrollment_id
|
||||
WHERE b.enrollment_id IS NULL
|
||||
AND a.enrollment_status = '2'; -- 只同步已审核通过的报名信息
|
||||
|
||||
-- 5. 确保数据库中的所有报名信息状态与录取流程状态一致
|
||||
UPDATE zsjy_enrollment_info a
|
||||
JOIN zsjy_enrollment_process b ON a.id = b.enrollment_id
|
||||
SET a.enrollment_status = b.current_status
|
||||
WHERE a.enrollment_status != b.current_status;
|
||||
|
||||
-- 6. 输出统计信息
|
||||
SELECT
|
||||
SUM(CASE WHEN current_status = '2' THEN 1 ELSE 0 END) AS '录取处理中数量',
|
||||
SUM(CASE WHEN info_audit_status = '1' THEN 1 ELSE 0 END) AS '信息已审核通过数量',
|
||||
COUNT(*) AS '总数据条数'
|
||||
FROM zsjy_enrollment_process;
|
||||
Reference in new issue
Block a user