<?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.ObeCourseWeightMapper">

    <select id="findCourseWeightForm"
            resultType="com.qmth.distributed.print.business.bean.dto.CourseWeightFormDto">
        SELECT
            oct.id AS targetId,
            oct.target_name AS targetName,
            oct.create_time AS targetCreateTime,
            ocw.target_score AS targetScore,
            oce.id AS evaluationId,
            oce.evaluation AS evaluation,
            oce.evaluation_desc AS evaluationDesc,
            oce.create_time AS evaluationCreateTime,
            oce.type AS type
        FROM
            obe_course_weight ocw
                LEFT JOIN
            obe_course_target oct ON ocw.target_id = oct.id
                LEFT JOIN
            obe_course_evaluation oce ON ocw.evaluation_id = oce.id
        <where>
            AND ocw.enable
            <if test="obeCourseOutlineId != null">
                AND ocw.obe_course_outline_id = #{obeCourseOutlineId}
            </if>
        </where>
        ORDER BY oct.id,oce.id
    </select>
</mapper>
