id, exam_paper_id, paper_name, paper_type, subject_id, system_score, user_score, paper_score, question_correct, question_count, do_time, status, create_user, create_time, task_exam_id id, exam_paper_id, paper_name, paper_type, subject_id, system_score, TRUNCATE(user_score/10,0) as user_score, TRUNCATE(paper_score/10,0) as paper_score, question_correct, question_count, do_time, status, create_user, create_time, task_exam_id id, exam_paper_id, paper_name, paper_type, subject_id, system_score, user_score, paper_score, question_correct, question_count, do_time, status, create_user, create_time, task_exam_id,counts id, exam_paper_id, paper_name, paper_type, subject_id, system_score, user_score, paper_score, question_correct, question_count, do_time, status, create_user, create_time, task_exam_id,DATE_FORMAT(create_time, '%Y-%m-%d %H:%i:%s') AS formattedTime id, exam_paper_id, paper_name, paper_type, subject_id, system_score, TRUNCATE(user_score/10,0) as user_score, TRUNCATE(paper_score/10,0) as paper_score, question_correct, question_count, do_time, status, create_user, create_time, task_exam_id,DATE_FORMAT(create_time, '%Y-%m-%d %H:%i:%s') AS formattedTime delete from t_exam_paper_answer where id = #{id,jdbcType=INTEGER} insert into t_exam_paper_answer (id, exam_paper_id, paper_name, paper_type, subject_id, system_score, user_score, paper_score, question_correct, question_count, do_time, status, create_user, create_time, task_exam_id ) values (#{id,jdbcType=INTEGER}, #{examPaperId,jdbcType=INTEGER}, #{paperName,jdbcType=VARCHAR}, #{paperType,jdbcType=INTEGER}, #{subjectId,jdbcType=INTEGER}, #{systemScore,jdbcType=INTEGER}, #{userScore,jdbcType=INTEGER}, #{paperScore,jdbcType=INTEGER}, #{questionCorrect,jdbcType=INTEGER}, #{questionCount,jdbcType=INTEGER}, #{doTime,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}, #{createUser,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{taskExamId,jdbcType=INTEGER} ) insert into t_exam_paper_answer id, exam_paper_id, paper_name, paper_type, subject_id, system_score, user_score, paper_score, question_correct, question_count, do_time, status, create_user, create_time, task_exam_id, #{id,jdbcType=INTEGER}, #{examPaperId,jdbcType=INTEGER}, #{paperName,jdbcType=VARCHAR}, #{paperType,jdbcType=INTEGER}, #{subjectId,jdbcType=INTEGER}, #{systemScore,jdbcType=INTEGER}, #{userScore,jdbcType=INTEGER}, #{paperScore,jdbcType=INTEGER}, #{questionCorrect,jdbcType=INTEGER}, #{questionCount,jdbcType=INTEGER}, #{doTime,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}, #{createUser,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{taskExamId,jdbcType=INTEGER}, update t_exam_paper_answer exam_paper_id = #{examPaperId,jdbcType=INTEGER}, paper_name = #{paperName,jdbcType=VARCHAR}, paper_type = #{paperType,jdbcType=INTEGER}, subject_id = #{subjectId,jdbcType=INTEGER}, system_score = #{systemScore,jdbcType=INTEGER}, user_score = #{userScore,jdbcType=INTEGER}, paper_score = #{paperScore,jdbcType=INTEGER}, question_correct = #{questionCorrect,jdbcType=INTEGER}, question_count = #{questionCount,jdbcType=INTEGER}, do_time = #{doTime,jdbcType=INTEGER}, status = #{status,jdbcType=INTEGER}, create_user = #{createUser,jdbcType=INTEGER}, create_time = #{createTime,jdbcType=TIMESTAMP}, task_exam_id = #{taskExamId,jdbcType=INTEGER}, where id = #{id,jdbcType=INTEGER} update t_exam_paper_answer set exam_paper_id = #{examPaperId,jdbcType=INTEGER}, paper_name = #{paperName,jdbcType=VARCHAR}, paper_type = #{paperType,jdbcType=INTEGER}, subject_id = #{subjectId,jdbcType=INTEGER}, system_score = #{systemScore,jdbcType=INTEGER}, user_score = #{userScore,jdbcType=INTEGER}, paper_score = #{paperScore,jdbcType=INTEGER}, question_correct = #{questionCorrect,jdbcType=INTEGER}, question_count = #{questionCount,jdbcType=INTEGER}, do_time = #{doTime,jdbcType=INTEGER}, status = #{status,jdbcType=INTEGER}, create_user = #{createUser,jdbcType=INTEGER}, create_time = #{createTime,jdbcType=TIMESTAMP}, task_exam_id = #{taskExamId,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER} update t_exam_paper_answer set invalid = 1 where exam_paper_id = #{examPaperId} and create_user in ( #{item} ) INSERT INTO t_exam_paper_answer(exam_paper_id, paper_name, paper_type, system_score, user_score, paper_score, question_correct, question_count, do_time, status, create_user, create_time, invalid) SELECT a.id, a.name, a.paper_type, 0, 0, a.score, 0, a.question_count, 0, 2, b.user_id, NOW(), 0 FROM t_exam_paper a left join t_exam_paper_user b on a.id = b.exam_paper_id and b.deleted = 0 left join t_exam_paper_answer c on a.id = c.exam_paper_id and c.create_user = b.user_id WHERE a.id = #{examPaperId} and c.id is null and b.user_id not in #{item}