<?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.yudao.module.course.mapper.SchoolCourseSchemeMapper">

    <select id="getCourseDeduct" resultType="java.math.BigDecimal">
        select dscd.deduct from drive_school_course_scheme dscs
        LEFT JOIN drive_school_course_deduct dscd on dscs.id = dscd.scheme_id
        where
            dscs.course_id = #{courseId}
          AND dscs.is_default = 1
          AND dscs.deleted = 0
          AND dscd.deleted = 0
          AND dscd.course_subject = #{subject}
    </select>

    <select id="getSchemeById" resultType="java.math.BigDecimal" parameterType="cn.iocoder.yudao.module.course.vo.SchoolCourseSchemeVO">
        select dscd.deduct, dscd.course_subject from drive_school_course_scheme dscs
        LEFT JOIN drive_school_course_deduct dscd on dscs.id = dscd.scheme_id
        WHERE dscs.id = #{id}
          AND dscd.course_subject = #{subject}
          AND dscs.deleted = 0
          AND dscd.deleted = 0
    </select>

    <select id="getOrderCountBySchemeId" resultType="java.lang.Integer">
        SELECT COUNT(*) FROM drive_school_course_order
        WHERE scheme_id=#{schemeId}
    </select>
</mapper>
