id, user_id, argument_id, topic, position, total_rounds,
debate_content, review_result, create_time
dh.id, dh.user_id, dh.argument_id, dh.topic, dh.position,
dh.total_rounds, dh.debate_content, dh.review_result, dh.create_time,
ah.id as arg_id, ah.user_id as arg_user_id, ah.topic as arg_topic,
ah.argument_content as arg_content, ah.position as arg_position,
ah.create_time as arg_create_time
INSERT INTO debate_history (
user_id, argument_id, topic, position,
total_rounds, debate_content, create_time
) VALUES (
#{userId}, #{argumentId}, #{topic},
#{position,typeHandler=org.apache.ibatis.type.EnumTypeHandler},
#{totalRounds}, #{debateContent}, NOW()
)
DELETE FROM debate_history
WHERE user_id = #{userId}
AND id NOT IN (
SELECT id FROM (
SELECT id FROM debate_history
WHERE user_id = #{userId}
ORDER BY create_time DESC
LIMIT 10
) t
)