<?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="cn.iocoder.byzs.module.web.dal.mysql.reportprogress.WebReportProgressMapper">

    <select id="selectProgres" parameterType="cn.iocoder.byzs.module.web.controller.admin.reportprogress.vo.WebReportProgressDO"
            resultType="cn.iocoder.byzs.module.web.controller.admin.reportprogress.vo.WebReportProgressDTO">
        SELECT
            u.nickname as userName,
            CONCAT(LPAD(fl.ct_type_sort, 2, '0'), ' ', fl.ct_type) as kcflName,
            c.course_name as courseName,
            rp.brp_progress as progress,
            rp.brp_type as progressType
        FROM bjdx_report_progress rp
        LEFT JOIN bjdx_course_type fl ON rp.brp_ct_id =fl.id
        LEFT JOIN bjdx_course c ON rp.brp_course_id = c.id
        LEFT JOIN system_users u ON rp.brp_user_id = u.id
        <where>
            <if test="brpUserId != null">
                and rp.brp_user_id = #{brpUserId}
            </if>
            <if test="brpNjId != null">
                AND rp.brp_nj_id = #{brpNjId}
            </if>
        </where>
    </select>
</mapper>