<?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.base.mapper.DriveSchoolCourseDeductMapper">

    <select id="queryPage" resultType="cn.iocoder.yudao.module.base.vo.DriveSchoolCourseDeductVO">
        SELECT main.*, dsc.name AS courseName
        FROM drive_school_course_deduct main
        LEFT JOIN drive_school_course dsc ON main.course_id = dsc.id
    </select>

    <update id="deleteBySchemeId" parameterType="string">
        UPDATE drive_school_course_deduct
        SET deleted = 1
        WHERE scheme_id = #{schemeId}
    </update>

    <insert id="insertBatch" parameterType="list">
        INSERT INTO drive_school_course_deduct
        (deduct, course_id, scheme_id, course_subject, tenant_id, creator, create_time)
        VALUES
        <foreach collection="list" item="item" separator=",">
            (#{item.deduct}, #{item.courseId}, #{item.schemeId}, #{item.courseSubject},
            #{item.tenantId}, #{item.creator}, #{item.createTime})
        </foreach>
    </insert>
</mapper>
