| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143 | <?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.yonge.cooleshow.biz.dal.dao.CourseScheduleStudentPaymentDao">    <resultMap id="BaseResultMap" type="com.yonge.cooleshow.biz.dal.entity.CourseScheduleStudentPayment">        <id column="id_" jdbcType="INTEGER" property="id"/>        <result column="user_id_" jdbcType="INTEGER" property="userId"/>        <result column="course_group_id_" jdbcType="INTEGER" property="courseGroupId"/>        <result column="course_id_" jdbcType="INTEGER" property="courseId"/>        <result column="order_no_" jdbcType="VARCHAR" property="orderNo"/>        <result column="original_price_" jdbcType="VARCHAR" property="originalPrice"/>        <result column="expect_price_" jdbcType="VARCHAR" property="expectPrice"/>        <result column="actual_price_" jdbcType="VARCHAR" property="actualPrice"/>        <result column="created_time_" jdbcType="TIMESTAMP" property="createdTime"/>        <result column="updated_time_" jdbcType="TIMESTAMP" property="updatedTime"/>        <result column="course_type_" jdbcType="VARCHAR" property="courseType"/>    </resultMap>    <sql id="Base_Column_List">        id_        , user_id_, course_group_id_, course_id_, order_no_, original_price_, expect_price_,        actual_price_, created_time_, updated_time_, course_type_    </sql>    <insert id="insertBatch" keyColumn="id_" keyProperty="id" useGeneratedKeys="true"            parameterType="com.yonge.cooleshow.biz.dal.entity.CourseScheduleStudentPayment">        insert into course_schedule_student_payment(user_id_, course_group_id_, course_id_, order_no_, original_price_,        expect_price_, actual_price_, created_time_, updated_time_, course_type_)        values        <foreach collection="entities" item="entity" separator=",">            (#{entity.userId}, #{entity.courseGroupId}, #{entity.courseId}, #{entity.orderNo}, #{entity.originalPrice},            #{entity.expectPrice}, #{entity.actualPrice}, #{entity.createdTime}, #{entity.updatedTime},            #{entity.courseType})        </foreach>    </insert>    <update id="cleanPlayMidi">        UPDATE course_schedule_student_payment SET play_midi_ = NULL WHERE course_id_ = #{courseScheduleId}    </update>    <update id="adjustPlayMidi">        UPDATE course_schedule_student_payment cssp        <set>            <if test="content == null or content == ''">                cssp.play_midi_ = NULL,cssp.update_time_ = NOW()            </if>            <if test="content != null and content != ''">                cssp.play_midi_ = #{content},cssp.update_time_ = NOW()            </if>        </set>        <where>            cssp.course_id_ = #{courseScheduleId}            <if test="userId != null and userId != ''">                AND FIND_IN_SET(cssp.user_id_,#{userId})            </if>        </where>    </update>    <update id="adjustExamSong">        UPDATE course_schedule_student_payment SET music_sheet_download_json_ = #{examSongJson}        WHERE course_id_ = #{roomId}        <if test="userId != null">            AND user_id_ = #{userId}        </if>    </update>    <update id="adjustPlayMidiAndMusicSheet">        UPDATE course_schedule_student_payment cssp        <set>            <if test="content == null or content == ''">                cssp.open_play_midi_ = NULL,cssp.update_time_ = NOW()            </if>            <if test="content != null and content != ''">                cssp.open_play_midi_ = #{content},cssp.update_time_ = NOW()            </if>            <if test="examSongJson != null">                cssp.exam_song_download_json_ = #{examSongJson}            </if>        </set>        <where>            cssp.course_schedule_id_ = #{courseScheduleId}            <if test="userId != null and userId != ''">                AND FIND_IN_SET(cssp.user_id_,#{userId})            </if>        </where>    </update>    <select id="queryStudentIds" resultType="java.lang.Long">        SELECT DISTINCT user_id_ FROM course_schedule_student_payment        <where>            <if test="courseGroupId != null">                AND course_group_id_ = #{courseGroupId}            </if>            <if test="courseGroupType != null and courseGroupType != ''">                AND course_type_ = #{courseGroupType}            </if>        </where>    </select>    <select id="getMidiByCourseIdAndUserId" resultType="java.lang.String">        SELECT play_midi_ FROM course_schedule_student_payment        WHERE user_id_ = #{userId} AND course_id_ = #{courseScheduleId} LIMIT 1    </select>    <select id="getMusicSheetByCourseIdAndUserId" resultType="java.lang.String">        SELECT music_sheet_download_json_ FROM course_schedule_student_payment        WHERE user_id_ = #{userId} AND course_id_ = #{courseScheduleId} LIMIT 1    </select>    <select id="queryByCourseId" resultMap="BaseResultMap">        SELECT <include refid="Base_Column_List"/> FROM course_schedule_student_payment        WHERE course_id_ = #{courseScheduleId}    </select>    <select id="queryStudentInfoByGroupId" parameterType="map" resultType="com.yonge.cooleshow.biz.dal.vo.LiveCourseInfoVo$CourseBuyStudentVo">        select distinct a.user_id_      as studentId,               b.real_name_    as studentName,               b.username_    as userName,               b.avatar_ as avatar,               a.created_time_ as createTime        from course_schedule_student_payment as a                 left join sys_user as b on a.user_id_ = b.id_                 left join user_order as o on a.order_no_ = o.order_no_        where a.course_group_id_ = #{param.groupId}        <if test="param.orderState != null and param.orderState != ''">            AND o.status_ = #{param.orderState}        </if>        <if test="param.userId != null and param.userId != ''">            AND a.user_id_ = #{param.userId}        </if>    </select>    <select id="selectAll" resultType="java.lang.Long">        SELECT user_id_ FROM course_schedule_student_payment WHERE course_type_ = 'PRACTICE'    </select>    <select id="selectPaymentList" resultType="com.yonge.cooleshow.biz.dal.vo.CourseScheduleStudentPaymentVo"            parameterType="java.lang.String">        SELECT            p.user_id_ AS userId,            p.course_group_id_ AS courseGroupId,            p.course_id_ AS courseId,            p.course_type_ AS courseType,            p.expect_price_ AS expectPrice,            p.actual_price_ AS actualPrice,            g.teacher_id_ AS teacherId,            s.class_num_ AS classNum        FROM course_schedule_student_payment p        LEFT JOIN course_group g ON p.course_group_id_ = g.id_        LEFT JOIN course_schedule s ON p.course_id_ = s.id_        WHERE p.order_no_=#{orderNo}    </select></mapper>
 |