使用MD5(UUID())可以批量生成腳本中的uuid, 如下
select
concat(
'db.getCollection("test_record_stu_question_sgyz").insert( {
_id: "', MD5(UUID()) ,'",
"test_id": "fd15ef87e3dd46bd4e8d1e0df03a93b8",
"week_id": "fd15ef87e3dd46bd4e8d1e0df03a93b8",
"week_code": "20220629007",
"week_name": "升級考試全真模擬(6月30日)",
"paper_id": "e721f80b4164421291992968bf9effd1",
"paper_code": "20220629030",
"paper_name": "高一升級模擬物理試題",
"paper_type": NumberInt("1"),
"subject_code": "WL",
"subject_name": "物理",
"school_level_code": "5f1c3ff076154d57866dac83eddc60bf",
"school_level_name": "壽光一中",
"grade_id": "ce926ddc3614ad25f742e0d9ab3fb99d",
"grade_name": "高一2部",
"class_id": "df160d35545f0d2171d0e08ca64560a1",
"class_name": "2113",
"stu_id": "', s.id,'",
"stu_code": "', s.stu_code, '",
"stu_name": "', s.stu_name, '",
"question_id": "5099b6acee2f880a3b8565faca7c5034",
"question_code": NumberInt("13"),
"question_code_show": NumberInt("13"),
"question_type": NumberInt("1"),
answer: "",
"commit_answer": "",
score: "6.00",
"sub_score": "0.00",
"get_score": "0",
"is_entry_score": NumberInt("2"),
_class: "com.xinkao.admin.domain.test.mongo.AdminTestRecordStuQuestionEntity"
} );'
)
from admin_edu_student_sgyz s
left join admin_edu_student_class_sgyz c on s.id = c.stu_id
where c.class_id = 'df160d35545f0d2171d0e08ca64560a1' and s.delete_status = 0