<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hc.business.mapper.ZccmUserTestHistoryMapper">

    <resultMap type="zccmuserTestHistory" id="UserTestHistoryMap">
        <result property="testId" column="test_id" jdbcType="INTEGER"/>
        <result property="userId" column="user_id" jdbcType="INTEGER"/>
        <result property="paperId" column="paper_id" jdbcType="INTEGER"/>
        <result property="classId" column="class_id" jdbcType="INTEGER"/>
        <result property="score" column="score" jdbcType="INTEGER"/>
        <result property="answer" column="answer" jdbcType="VARCHAR"/>
        <result property="createTime" column="create_time" jdbcType="INTEGER"/>
        <result property="totalScore" column="total_score" jdbcType="INTEGER"/>
        <result property="testTime" column="test_time" jdbcType="VARCHAR"/>
    </resultMap>

    <sql id="Base_Column_List">
        test_id,
           user_id,
           paper_id,
           class_id,
           score,
           answer,
           create_time,
           total_score,
           test_time
    </sql>

    <select id="queryMaxScore" resultMap="UserTestHistoryMap">
        SELECT
        <include refid="Base_Column_List"/>
        FROM zccm_user_test_history
        WHERE user_id = #{param1}
        AND class_id = #{param2}
        ORDER BY score DESC
        LIMIT 1
    </select>

</mapper>