insert_test_data_simple.sql 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. -- =====================================================
  2. -- 奖学金名额分配 - 简单测试数据插入脚本
  3. -- 创建时间: 2025-01-27
  4. -- 说明: 插入基础测试数据
  5. -- =====================================================
  6. -- 设置数据库
  7. USE hzdyjs_xg;
  8. -- =====================================================
  9. -- 1. 插入奖学金批次数据
  10. -- =====================================================
  11. INSERT IGNORE INTO jcbt_scholarship_batch (
  12. id, batch_code, batch_name, academic_year, semester, batch_type,
  13. start_time, end_time, apply_start_time, apply_end_time,
  14. review_start_time, review_end_time, status, description,
  15. create_by, create_time, update_by, update_time, tenant_id, deleted
  16. ) VALUES
  17. (1890000000000000001, 'BATCH_2024_1', '2024学年第一学期奖学金评定', '2024-2025', 1, 'REGULAR',
  18. '2024-09-01 00:00:00', '2024-12-31 23:59:59', '2024-10-01 00:00:00', '2024-10-31 23:59:59',
  19. '2024-11-01 00:00:00', '2024-11-30 23:59:59', 'ACTIVE', '2024学年第一学期常规奖学金评定批次',
  20. 1, NOW(), 1, NOW(), 1, 0);
  21. -- =====================================================
  22. -- 2. 插入奖学金类型数据
  23. -- =====================================================
  24. INSERT IGNORE INTO jcbt_scholarship_type (
  25. id, type_code, type_name, type_category, level_type, award_amount,
  26. description, application_guide, application_conditions, evaluation_criteria,
  27. compatibility_type, sort_order, status, is_system,
  28. create_by, create_time, update_by, update_time, tenant_id, deleted
  29. ) VALUES
  30. (1890000000000000101, 'GJZXJ', '国家奖学金', 'NATIONAL', 'FIRST_CLASS', 8000.00,
  31. '国家奖学金是为了激励普通本科高校、高等职业学校和高等专科学校学生勤奋学习、努力进取。',
  32. '学生本人提出申请,按学校规定程序推荐上报。', '品学兼优,学习成绩排名在评选范围内位于前10%',
  33. '学习成绩、综合测评、道德品质等综合评定', 'EXCLUSIVE', 1, 1, 1,
  34. 1, NOW(), 1, NOW(), 1, 0);
  35. -- =====================================================
  36. -- 3. 插入名额分配数据
  37. -- =====================================================
  38. INSERT IGNORE INTO jcbt_scholarship_quota (
  39. id, batch_id, scholarship_type_id, allocation_level, target_dept_id, parent_quota_id,
  40. total_quota, used_quota, reserved_quota, available_quota,
  41. allocation_rule, allocation_basis, allocation_method, is_adjustable, is_locked, status,
  42. remark, create_by, create_time, update_by, update_time, tenant_id, deleted
  43. ) VALUES
  44. (1890000000000000201, 1890000000000000001, 1890000000000000101, 'UNIVERSITY', NULL, NULL,
  45. 50, 0, 5, 45, '{"type":"university","rule":"total_allocation"}', '根据学校总体规模和历年获奖情况分配',
  46. 'MANUAL', 1, 0, 'ACTIVE', '全校国家奖学金总名额', 1, NOW(), 1, NOW(), 1, 0);
  47. -- =====================================================
  48. -- 4. 验证数据
  49. -- =====================================================
  50. SELECT '插入结果验证' as message;
  51. SELECT COUNT(*) as batch_count FROM jcbt_scholarship_batch WHERE deleted = 0;
  52. SELECT COUNT(*) as type_count FROM jcbt_scholarship_type WHERE deleted = 0;
  53. SELECT COUNT(*) as quota_count FROM jcbt_scholarship_quota WHERE deleted = 0;
  54. -- 验证关联查询
  55. SELECT
  56. q.id,
  57. b.batch_name,
  58. st.type_name as scholarship_type_name,
  59. q.allocation_level,
  60. q.total_quota,
  61. q.status
  62. FROM jcbt_scholarship_quota q
  63. LEFT JOIN jcbt_scholarship_batch b ON q.batch_id = b.id
  64. LEFT JOIN jcbt_scholarship_type st ON q.scholarship_type_id = st.id
  65. WHERE q.deleted = 0;