<?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="jnpf.cultivate.mapper.FtbCultivateMyLearnTaskInfoMapper">
    <!--任务课程列表-->
    <select id="queryCourseList" resultType="jnpf.model.cultivate.vo.course.app.FtbGlobalCurriculumAppVO">
        SELECT
        a.F_CourseId as courseId,
        b.F_Name as courseName,
        b.F_Highlights as courseHighlights,
        c.F_state as learnState,
        a.F_IsRequired as isRequired
        FROM ftb_cultivate_learn_task_course a
        JOIN ftb_cultivate_course b ON a.F_CourseId = b.F_Id
        JOIN ftb_cultivate_position_cource_learning c ON a.F_CourseId=c.F_CourceId
        <where>
         b.F_EnabledMark = 0
        and c.F_EnabledMark = 0
        and b.F_IsGrounding = 1
        and c.F_UserId = #{userId}
        and a.F_TaskId = #{taskId}
        <if test="compulsory != null ">
            and a.F_IsRequired = #{compulsory}
        </if>
        </where>
        GROUP BY a.F_CourseId
        order by c.F_state ASC
    </select>
</mapper>