<?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.qmth.distributed.print.business.mapper.TPMatrixMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.qmth.distributed.print.business.entity.TPMatrix">
        <id column="id" property="id" />
        <result column="professional_id" property="professionalId" />
        <result column="course_id" property="courseId" />
        <result column="requirement_id" property="requirementId" />
        <result column="sub_name" property="subName" />
        <result column="content" property="content" />
        <result column="create_id" property="createId" />
        <result column="create_time" property="createTime" />
        <result column="update_id" property="updateId" />
        <result column="update_time" property="updateTime" />
    </resultMap>
    <select id="listMatrix" resultType="com.qmth.distributed.print.business.entity.TPMatrix">
        SELECT
            tpm.*,
            tpc.sort_num courseSortNum,
            tpr.sort_num requirementSortNum
        FROM
            t_p_matrix tpm
                LEFT JOIN
            t_p_course tpc ON tpm.course_id = tpc.id
                LEFT JOIN
            t_p_requirement tpr ON tpm.requirement_id = tpr.id
        WHERE
            tpm.professional_id = #{professionalId}
        ORDER BY tpc.sort_num , tpr.sort_num
    </select>

</mapper>
