123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138 |
- <?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.ym.mec.biz.dal.dao.CourseScheduleStudentMusicScoreDao">
- <resultMap type="com.ym.mec.biz.dal.entity.CourseScheduleStudentMusicScore" id="CourseScheduleStudentMusicScore">
- <result column="id_" property="id"/>
- <result column="course_schedule_id_" property="courseScheduleId"/>
- <result column="user_id_" property="userId"/>
- <result column="user_type_" property="userType"/>
- <result column="down_status_" property="downStatus"/>
- <result column="music_score_accompaniment_id_" property="musicScoreAccompanimentId"/>
- <result column="play_status_" property="playStatus"/>
- <result column="accompaniment_play_status_" property="accompanimentPlayStatus"/>
- <result column="speed_" property="speed"/>
- <result column="mp3_url_" property="mp3Url"/>
- <result column="url_" property="url"/>
- <result column="music_score_name_" property="musicScoreName"/>
- <result column="create_time_" property="createTime"/>
- <result column="update_time_" property="updateTime"/>
- <result column="tenant_id_" property="tenantId" />
- </resultMap>
- <!-- 根据主键查询一条记录 -->
- <select id="get" resultMap="CourseScheduleStudentMusicScore">
- SELECT * FROM course_schedule_student_music_score WHERE id_ = #{id}
- </select>
- <!-- 全查询 -->
- <select id="findAll" resultMap="CourseScheduleStudentMusicScore">
- SELECT * FROM course_schedule_student_music_score where tenant_id_ = #{tenantId} ORDER BY id_
- </select>
- <!-- 向数据库增加一条记录 -->
- <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.CourseScheduleStudentMusicScore" useGeneratedKeys="true" keyColumn="id"
- keyProperty="id">
- INSERT INTO course_schedule_student_music_score (course_schedule_id_,user_id_,user_type_,down_status_,music_score_accompaniment_id_,play_status_,accompaniment_play_status_,speed_,create_time_,update_time_,tenant_id_)
- VALUES(#{courseScheduleId},#{userId},#{userType},#{downStatus},#{musicScoreAccompanimentId},#{playStatus},#{accompanimentPlayStatus},#{speed},now(),now(),#{tenantId})
- </insert>
- <insert id="batchInsert">
- INSERT INTO course_schedule_student_music_score (course_schedule_id_,user_id_,user_type_,down_status_,music_score_accompaniment_id_,play_status_,accompaniment_play_status_,speed_,create_time_,update_time_,tenant_id_)
- VALUE
- <foreach collection="scheduleStudentMusicScores" item="item" separator=",">
- (#{item.courseScheduleId},#{item.userId},#{item.userType},#{item.downStatus},#{item.musicScoreAccompanimentId},#{item.playStatus},#{item.accompanimentPlayStatus},#{item.speed},now(),now(),#{item.tenantId})
- </foreach>
- </insert>
- <!-- 根据主键查询一条记录 -->
- <update id="update" parameterType="com.ym.mec.biz.dal.entity.CourseScheduleStudentMusicScore">
- UPDATE course_schedule_student_music_score
- <set>
- <if test="accompanimentPlayStatus != null">
- accompaniment_play_status_ = #{accompanimentPlayStatus},
- </if>
- <if test="downStatus != null">
- down_status_ = #{downStatus},
- </if>
- <if test="playStatus != null">
- play_status_ = #{playStatus},
- </if>
- <if test="speed != null">
- speed_ = #{speed},
- </if>
- update_time_ = NOW()
- </set>
- WHERE id_ = #{id} and tenant_id_ = #{tenantId}
- </update>
- <update id="closePlayStatus">
- UPDATE course_schedule_student_music_score SET play_status_ = 0,accompaniment_play_status_ = 0,update_time_ = NOW()
- WHERE course_schedule_id_ = #{scheduleId}
- <if test="musicScoreAccompanimentId != null">
- AND music_score_accompaniment_id_ = #{musicScoreAccompanimentId}
- </if>
- <if test="userId != null">
- AND user_id_ = #{userId}
- </if>
- </update>
- <update id="openPlayStatus">
- UPDATE course_schedule_student_music_score SET play_status_ = 1,update_time_ = NOW()
- WHERE course_schedule_id_ = #{scheduleId}
- AND music_score_accompaniment_id_ = #{musicScoreAccompanimentId}
- <if test="userId != null">
- AND user_id_ = #{userId}
- </if>
- </update>
- <update id="openAccompanimentPlayStatus">
- UPDATE course_schedule_student_music_score SET accompaniment_play_status_ = 1,update_time_ = NOW()
- WHERE course_schedule_id_ = #{scheduleId} AND music_score_accompaniment_id_ = #{musicScoreAccompanimentId}
- <if test="userId != null">
- AND user_id_ = #{userId}
- </if>
- </update>
- <!-- 根据主键删除一条记录 -->
- <delete id="delete">
- DELETE FROM course_schedule_student_music_score WHERE id_ = #{id}
- </delete>
- <!-- 分页查询 -->
- <select id="queryPage" resultMap="CourseScheduleStudentMusicScore" parameterType="map">
- SELECT * FROM course_schedule_student_music_score where tenant_id_ = #{tenantId}
- <include refid="global.limit" />
- </select>
- <!-- 查询当前表的总记录数 -->
- <select id="queryCount" resultType="int">
- SELECT COUNT(*) FROM course_schedule_student_music_score where tenant_id_ = #{tenantId}
- </select>
- <select id="queryByScoreIdAndCourseId"
- resultMap="CourseScheduleStudentMusicScore">
- SELECT cssm.*,
- CASE WHEN smsa.metronome_mp3_url_ IS NULL OR smsa.metronome_mp3_url_ = '' THEN smsa.mp3_url_ ELSE smsa.metronome_mp3_url_ END url_,
- sms.url_ mp3_url_,sms.name_ music_score_name_
- FROM course_schedule_student_music_score cssm
- LEFT JOIN sys_music_score_accompaniment smsa ON cssm.music_score_accompaniment_id_ = smsa.id_
- LEFT JOIN sys_music_score sms ON sms.id_ = smsa.exam_song_id_
- <where>
- <if test="courseId != null">
- AND cssm.course_schedule_id_ = #{courseId}
- </if>
- <if test="musicScoreAccompanimentId != null">
- AND cssm.music_score_accompaniment_id_ = #{musicScoreAccompanimentId}
- </if>
- <if test="userType != null">
- AND cssm.user_type_ = #{userType}
- </if>
- <if test="userId != null">
- AND cssm.user_id_ = #{userId}
- </if>
- <if test="downStatus != null">
- AND cssm.down_status_ = #{downStatus}
- </if>
- </where>
- </select>
- </mapper>
|