Files
hzdyjs/🚀插入出国登记测试数据.sql
T
2025-10-14 16:41:19 +08:00

373 lines
11 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
-- ========================================
-- 出国登记测试数据插入脚本
-- ========================================
-- 目的:插入测试数据用于验证"出国登记"和"登记历史"选项卡功能
-- 时间:2025-10-11
-- ========================================
USE `ry-vue`;
-- ========================================
-- 状态定义说明(重要!)
-- ========================================
-- status = '0' : 草稿(初始创建状态,未提交审核)
-- status = '1' : 待审核(已提交,等待审批) ← "出国登记"选项卡显示
-- status = '2' : 已通过(审批通过,登记信息确认) ← "登记历史"选项卡显示
-- status = '3' : 已拒绝(审批拒绝)
-- ========================================
-- 第1步:清除旧的测试数据(可选)
-- ========================================
-- 如果需要清除之前的测试数据,取消下面这行的注释
-- DELETE FROM rs_overseas_registration WHERE name LIKE '测试%';
-- ========================================
-- 第2步:插入测试数据
-- ========================================
-- --------------------------------------------
-- 待审核状态数据(status='1')
-- 这些数据会显示在"出国登记"选项卡
-- --------------------------------------------
-- 测试数据1:待审核 - 张三
INSERT INTO rs_overseas_registration (
registration_id, application_id, name, gender, birth_date,
id_number, political_status, registered_address,
department, position, administrative_level, personnel_category,
status, registration_time, remarks,
tenant_id, create_by, create_time, update_by, update_time, deleted
) VALUES (
NULL,
NULL,
'测试张三',
'0', -- 男
'1985-06-15',
'330106198506151234',
'01', -- 中共党员
'浙江省杭州市西湖区文三路188号',
'信息技术部',
'高级工程师',
'1', -- 处级
'E', -- 专业技术人员
'1', -- ✅ 待审核
DATE_SUB(NOW(), INTERVAL 2 DAY),
'计划前往美国参加技术交流会议',
'000000',
1,
DATE_SUB(NOW(), INTERVAL 2 DAY),
1,
DATE_SUB(NOW(), INTERVAL 2 DAY),
'0'
);
-- 测试数据2:待审核 - 李四
INSERT INTO rs_overseas_registration (
registration_id, application_id, name, gender, birth_date,
id_number, political_status, registered_address,
department, position, administrative_level, personnel_category,
status, registration_time, remarks,
tenant_id, create_by, create_time, update_by, update_time, deleted
) VALUES (
NULL,
NULL,
'测试李四',
'1', -- 女
'1990-08-20',
'330106199008201234',
'02', -- 共青团员
'浙江省杭州市滨江区江南大道3588号',
'人力资源部',
'人事主管',
'2', -- 科级
'D', -- 一般干部
'1', -- ✅ 待审核
DATE_SUB(NOW(), INTERVAL 1 DAY),
'计划前往新加坡参加人力资源培训',
'000000',
1,
DATE_SUB(NOW(), INTERVAL 1 DAY),
1,
DATE_SUB(NOW(), INTERVAL 1 DAY),
'0'
);
-- 测试数据3:待审核 - 王五
INSERT INTO rs_overseas_registration (
registration_id, application_id, name, gender, birth_date,
id_number, political_status, registered_address,
department, position, administrative_level, personnel_category,
status, registration_time, remarks,
tenant_id, create_by, create_time, update_by, update_time, deleted
) VALUES (
NULL,
NULL,
'测试王五',
'0', -- 男
'1982-03-10',
'330106198203101234',
'01', -- 中共党员
'浙江省杭州市萧山区市心中路1165号',
'市场部',
'市场总监',
'0', -- 厅级
'B', -- 处级干部
'1', -- ✅ 待审核
NOW(),
'计划前往日本进行市场调研',
'000000',
1,
NOW(),
1,
NOW(),
'0'
);
-- --------------------------------------------
-- 已通过状态数据(status='2')
-- 这些数据会显示在"登记历史"选项卡
-- --------------------------------------------
-- 测试数据4:已通过 - 赵六
INSERT INTO rs_overseas_registration (
registration_id, application_id, name, gender, birth_date,
id_number, political_status, registered_address,
department, position, administrative_level, personnel_category,
status, registration_time, remarks,
tenant_id, create_by, create_time, update_by, update_time, deleted
) VALUES (
NULL,
NULL,
'测试赵六',
'0', -- 男
'1978-11-05',
'330106197811051234',
'01', -- 中共党员
'浙江省杭州市拱墅区莫干山路1418-50号',
'研发中心',
'研发总监',
'1', -- 处级
'E', -- 专业技术人员
'2', -- ✅ 已通过
DATE_SUB(NOW(), INTERVAL 15 DAY),
'已前往德国参加产品发布会',
'000000',
1,
DATE_SUB(NOW(), INTERVAL 15 DAY),
1,
DATE_SUB(NOW(), INTERVAL 10 DAY),
'0'
);
-- 测试数据5:已通过 - 孙七
INSERT INTO rs_overseas_registration (
registration_id, application_id, name, gender, birth_date,
id_number, political_status, registered_address,
department, position, administrative_level, personnel_category,
status, registration_time, remarks,
tenant_id, create_by, create_time, update_by, update_time, deleted
) VALUES (
NULL,
NULL,
'测试孙七',
'1', -- 女
'1988-05-25',
'330106198805251234',
'13', -- 群众
'浙江省杭州市江干区钱江路1366号',
'财务部',
'财务经理',
'2', -- 科级
'E', -- 专业技术人员
'2', -- ✅ 已通过
DATE_SUB(NOW(), INTERVAL 30 DAY),
'已前往英国参加财务管理培训',
'000000',
1,
DATE_SUB(NOW(), INTERVAL 30 DAY),
1,
DATE_SUB(NOW(), INTERVAL 25 DAY),
'0'
);
-- 测试数据6:已通过 - 周八
INSERT INTO rs_overseas_registration (
registration_id, application_id, name, gender, birth_date,
id_number, political_status, registered_address,
department, position, administrative_level, personnel_category,
status, registration_time, remarks,
tenant_id, create_by, create_time, update_by, update_time, deleted
) VALUES (
NULL,
NULL,
'测试周八',
'0', -- 男
'1992-09-18',
'330106199209181234',
'02', -- 共青团员
'浙江省杭州市余杭区五常街道文一西路969号',
'行政部',
'行政专员',
'3', -- 一般干部
'D', -- 一般干部
'2', -- ✅ 已通过
DATE_SUB(NOW(), INTERVAL 45 DAY),
'已前往韩国参加行政管理交流',
'000000',
1,
DATE_SUB(NOW(), INTERVAL 45 DAY),
1,
DATE_SUB(NOW(), INTERVAL 40 DAY),
'0'
);
-- --------------------------------------------
-- 其他状态数据(用于测试状态筛选)
-- --------------------------------------------
-- 测试数据7:草稿状态(status='0')
INSERT INTO rs_overseas_registration (
registration_id, application_id, name, gender, birth_date,
id_number, political_status, registered_address,
department, position, administrative_level, personnel_category,
status, registration_time, remarks,
tenant_id, create_by, create_time, update_by, update_time, deleted
) VALUES (
NULL,
NULL,
'测试吴九',
'1', -- 女
'1995-12-08',
'330106199512081234',
'13', -- 群众
'浙江省杭州市下城区体育场路218号',
'客服部',
'客服专员',
'3', -- 一般干部
'F', -- 工勤人员
'0', -- ✅ 草稿
NOW(),
'正在准备材料,尚未提交',
'000000',
1,
NOW(),
1,
NOW(),
'0'
);
-- 测试数据8:已拒绝状态(status='3')
INSERT INTO rs_overseas_registration (
registration_id, application_id, name, gender, birth_date,
id_number, political_status, registered_address,
department, position, administrative_level, personnel_category,
status, registration_time, remarks,
tenant_id, create_by, create_time, update_by, update_time, deleted
) VALUES (
NULL,
NULL,
'测试郑十',
'0', -- 男
'1987-04-22',
'330106198704221234',
'02', -- 共青团员
'浙江省杭州市西湖区天目山路398号',
'技术支持部',
'技术支持工程师',
'3', -- 一般干部
'E', -- 专业技术人员
'3', -- ✅ 已拒绝
DATE_SUB(NOW(), INTERVAL 5 DAY),
'因材料不齐全被拒绝',
'000000',
1,
DATE_SUB(NOW(), INTERVAL 5 DAY),
1,
DATE_SUB(NOW(), INTERVAL 5 DAY),
'0'
);
-- ========================================
-- 第3步:验证插入结果
-- ========================================
-- 查询所有测试数据
SELECT
registration_id,
name,
CASE gender
WHEN '0' THEN '男'
WHEN '1' THEN '女'
ELSE '未知'
END as gender_text,
department,
position,
status,
CASE status
WHEN '0' THEN '草稿'
WHEN '1' THEN '待审核'
WHEN '2' THEN '已通过'
WHEN '3' THEN '已拒绝'
ELSE '未知'
END as status_text,
registration_time,
create_time
FROM rs_overseas_registration
WHERE name LIKE '测试%'
ORDER BY registration_time DESC;
-- 统计各状态的数量
SELECT
status,
CASE status
WHEN '0' THEN '草稿'
WHEN '1' THEN '待审核 ← 应显示在出国登记选项卡'
WHEN '2' THEN '已通过 ← 应显示在登记历史选项卡'
WHEN '3' THEN '已拒绝'
ELSE '未知'
END as status_text,
COUNT(*) as count
FROM rs_overseas_registration
WHERE name LIKE '测试%'
GROUP BY status
ORDER BY CAST(status AS UNSIGNED);
-- ========================================
-- 预期结果:
-- ========================================
-- status | status_text | count
-- -------|----------------------------------|-------
-- 0 | 草稿 | 1
-- 1 | 待审核 ← 应显示在出国登记选项卡 | 3
-- 2 | 已通过 ← 应显示在登记历史选项卡 | 3
-- 3 | 已拒绝 | 1
-- ========================================
-- ========================================
-- 第4步:模拟前端查询
-- ========================================
-- 模拟"出国登记"选项卡查询(status='1')
SELECT
COUNT(*) as total_count,
'出国登记选项卡应显示的数据' as description
FROM rs_overseas_registration
WHERE deleted = '0'
AND status = '1'
AND name LIKE '测试%';
-- 模拟"登记历史"选项卡查询(status='2')
SELECT
COUNT(*) as total_count,
'登记历史选项卡应显示的数据' as description
FROM rs_overseas_registration
WHERE deleted = '0'
AND status = '2'
AND name LIKE '测试%';
-- ========================================
-- 清理测试数据(如需要时执行)
-- ========================================
-- DELETE FROM rs_overseas_registration WHERE name LIKE '测试%';