| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449 | <?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.MusicSheetDao">    <resultMap id="BaseResultMap" type="com.yonge.cooleshow.biz.dal.entity.MusicSheet">        <id column="id_" jdbcType="BIGINT" property="id"/>        <result column="music_sheet_name_" jdbcType="VARCHAR" property="musicSheetName"/>        <result column="user_id_" jdbcType="BIGINT" property="userId"/>        <result column="composer_" jdbcType="VARCHAR" property="composer"/>        <result column="music_subject_" jdbcType="VARCHAR" property="musicSubject"/>        <result column="audio_type_" jdbcType="VARCHAR" property="audioType"/>        <result column="music_tag_" jdbcType="VARCHAR" property="musicTag"/>        <result column="play_speed_" jdbcType="INTEGER" property="playSpeed"/>        <result column="can_evaluate_" jdbcType="TINYINT" property="canEvaluate"/>        <result column="show_fingering_" jdbcType="TINYINT" property="showFingering"/>        <result column="charge_type_" jdbcType="TINYINT" property="chargeType"/>        <result column="audit_status_" jdbcType="TINYINT" property="auditStatus"/>        <result column="sort_number_" jdbcType="INTEGER" property="sortNumber"/>        <result column="top_flag_" jdbcType="TINYINT" property="topFlag"/>        <result column="hot_flag_" jdbcType="TINYINT" property="hotFlag"/>        <result column="music_price_" jdbcType="DECIMAL" property="musicPrice"/>        <result column="audio_file_url_" jdbcType="VARCHAR" property="audioFileUrl"/>        <result column="xml_file_url_" jdbcType="VARCHAR" property="xmlFileUrl"/>        <result column="has_beat_" jdbcType="TINYINT" property="hasBeat"/>        <result column="create_time_" jdbcType="TIMESTAMP" property="createTime"/>        <result column="create_by_" jdbcType="BIGINT" property="createBy"/>        <result column="update_time_" jdbcType="TIMESTAMP" property="updateTime"/>        <result column="update_by_" jdbcType="BIGINT" property="updateBy"/>        <result column="remark_" jdbcType="VARCHAR" property="remark"/>    </resultMap>    <sql id="Base_Column_List">        t.id_ as id ,        t.music_sheet_name_ as musicSheetName,        t.user_id_ as userId,        t.composer_ as composer,        t.music_subject_ as musicSubject,        t.audio_type_ as audioType,        t.music_tag_ as musicTag,        t.play_speed_ as playSpeed,        t.can_evaluate_ as canEvaluate,        t.show_fingering_ as showFingering,        t.charge_type_ as chargeType,        t.state_ as state,        t.audit_status_ as auditStatus,        t.sort_number_ as sortNumber,        t.top_flag_ as topFlag,        t.hot_flag_ as hotFlag,        t.music_price_ as musicPrice,        t.audio_file_url_ as audioFileUrl,        t.xml_file_url_ as xmlFileUrl,        t.has_beat_ as hasBeat,        t.mp3_type_ as mp3Type,        t.create_time_ as createTime,        t.create_by_ as createBy,        t.update_time_ as updateTime,        t.update_by_ as updateBy,        t.del_flag_ as delFlag,        t.source_type_ as sourceType,        t.submit_audit_time_ as submitAuditTime,        t.remark_ as remark    </sql>    <select id="selectPage" resultType="com.yonge.cooleshow.biz.dal.vo.MusicSheetVo">        select <include refid="Base_Column_List"/>        ,su.username_ as addName        ,su.avatar_ as addUserAvatar        ,(select group_concat(mt.name_) from music_tag mt            where find_in_set(mt.id_,t.music_tag_) and mt.del_flag_ = 0) as musicTagNames        ,(select group_concat(s.name_) from subject s            where find_in_set(s.id_,t.music_subject_) and s.del_flag_ = 0 ) as subjectNames        from music_sheet t        left join sys_user su on t.create_by_ = su.id_        <where>            <include refid="QueryInfo"/>        </where>        order by  t.id_ desc    </select>    <sql id="QueryInfo">        <if test="param.idAndName != null and param.idAndName != ''">            and (t.id_ like concat('%',#{param.idAndName},'%') or            t.music_sheet_name_ like concat('%',#{param.idAndName},'%'))        </if>        <if test="param.musicTagIds != null and param.musicTagIds != ''">            and            <foreach collection="param.musicTagIdList" separator="and" item="item">                find_in_set(#{item},t.music_tag_)            </foreach>        </if>        <if test="param.subjectIds != null and param.subjectIds != ''">            and            <foreach collection="param.subjectIdList" separator="and" item="item">                find_in_set(#{item},t.music_subject_)            </foreach>        </if>        <if test="param.state != null">            and t.state_ = #{param.state}        </if>        <if test="param.auditStatus != null">            and t.audit_status_ = #{param.auditStatus}        </if>        <if test="param.createBy != null">            and t.create_by_ = #{param.createBy}        </if>        <if test="param.delFlag != null">            and t.del_flag_ = #{param.delFlag}        </if>        <if test="param.sourceType != null">            and t.source_type_ = #{param.sourceType}        </if>    </sql>    <select id="selectAlbumDetailPage" resultType="com.yonge.cooleshow.biz.dal.vo.MusicSheetVo">        select distinct <include refid="Base_Column_List"/>        ,(select group_concat(mt.name_) from music_tag mt        where find_in_set(mt.id_,t.music_tag_) and mt.del_flag_ = 0) as musicTagNames        ,(select group_concat(s.name_) from subject s        where find_in_set(s.id_,t.music_subject_) and s.del_flag_ = 0 ) as subjectNames        from music_sheet t        left join album_music_relate amr on t.id_ = amr.music_sheet_id_        <where>            <if test="param.idAndName != null and param.idAndName != ''">                and (t.id_ like concat('%',#{param.idAndName},'%') or                t.music_sheet_name_ like concat('%',#{param.idAndName},'%'))            </if>            <if test="param.musicTagIds != null and param.musicTagIds != ''">                and                <foreach collection="param.musicTagIdList" separator="and" item="item">                    find_in_set(#{item},t.music_tag_)                </foreach>            </if>            <if test="param.subjectIds != null and param.subjectIds != ''">                and                <foreach collection="param.subjectIdList" separator="and" item="item">                    find_in_set(#{item},t.music_subject_)                </foreach>            </if>            <if test="param.state != null">                and t.state_ = #{param.state}            </if>            <if test="param.delFlag != null">                and t.del_flag_ = #{param.delFlag}            </if>            <if test="param.id != null">                <if test="param.type == 2">                    and amr.album_id_ = #{param.id}                    order by amr.create_time_                </if>                <if test="param.type == 1">                    and t.id_ not in(select amr2.music_sheet_id_  from album_music_relate amr2                        where amr2.album_id_ = #{param.id})                </if>            </if>        </where>    </select>    <select id="detail" resultMap="DetailResultMap">        SELECT        <include refid="Base_Column_List"/>        ,t.url_ as url        ,t.midi_url_ as midiUrl        ,t.metronome_url_ as metronomeUrl        ,msa.id_ as accompanimentId        ,msa.music_sheet_id_ as accompanimentMusicSheetId        ,msa.music_subject_ as accompanimentMusicSubject        ,msa.audio_file_url_ as accompanimentAudioFileUrl        ,msa.sort_number_ as accompanimentSortNumber        ,msa.create_time_ as accompanimentCreateTime        ,msa.metronome_url_ as accompanimentMetronomeUrl        ,msa.track_ as track        ,su.username_ as userName        ,(select group_concat(mt.name_) from music_tag mt        where find_in_set(mt.id_,t.music_tag_) and mt.del_flag_ = 0) as musicTagNames        ,(select group_concat(s.name_) from subject s        where find_in_set(s.id_,t.music_subject_)  and s.del_flag_ = 0) as subjectNames        FROM music_sheet t        left join music_sheet_accompaniment msa on msa.music_sheet_id_ = t.id_        left join sys_user su on t.create_by_ = su.id_        where t.id_ = #{id}         order by  msa.sort_number_    </select>    <resultMap id="DetailResultMap" type="com.yonge.cooleshow.biz.dal.vo.MusicSheetDetailVo">        <id column="id" jdbcType="BIGINT" property="id"/>        <result column="musicSheetName" jdbcType="VARCHAR" property="musicSheetName"/>        <result column="userId" jdbcType="BIGINT" property="userId"/>        <result column="composer" jdbcType="VARCHAR" property="composer"/>        <result column="musicSubject" jdbcType="VARCHAR" property="musicSubject"/>        <result column="audioType" jdbcType="VARCHAR" property="audioType"/>        <result column="musicTag" jdbcType="VARCHAR" property="musicTag"/>        <result column="playSpeed" jdbcType="INTEGER" property="playSpeed"/>        <result column="canEvaluate" jdbcType="TINYINT" property="canEvaluate"/>        <result column="showFingering" jdbcType="TINYINT" property="showFingering"/>        <result column="chargeType" jdbcType="TINYINT" property="chargeType"/>        <result column="auditStatus" jdbcType="TINYINT" property="auditStatus"/>        <result column="sortNumber" jdbcType="INTEGER" property="sortNumber"/>        <result column="topFlag" jdbcType="TINYINT" property="topFlag"/>        <result column="hotFlag" jdbcType="TINYINT" property="hotFlag"/>        <result column="musicPrice" jdbcType="DECIMAL" property="musicPrice"/>        <result column="audioFileUrl" jdbcType="VARCHAR" property="audioFileUrl"/>        <result column="musicTagNames" jdbcType="VARCHAR" property="musicTagNames"/>        <result column="subjectNames" jdbcType="VARCHAR" property="subjectNames"/>        <result column="xmlFileUrl" jdbcType="VARCHAR" property="xmlFileUrl"/>        <result column="hasBeat" jdbcType="TINYINT" property="hasBeat"/>        <result column="createTime" jdbcType="TIMESTAMP" property="createTime"/>        <result column="createBy" jdbcType="BIGINT" property="createBy"/>        <result column="updateTime" jdbcType="TIMESTAMP" property="updateTime"/>        <result column="updateBy" jdbcType="BIGINT" property="updateBy"/>        <result column="delFlag" jdbcType="BOOLEAN" property="delFlag"/>        <result column="url" jdbcType="BOOLEAN" property="url"/>        <result column="metronomeUrl" jdbcType="BOOLEAN" property="metronomeUrl"/>        <result column="midiUrl" jdbcType="BOOLEAN" property="midiUrl"/>        <result column="mp3Type" jdbcType="BOOLEAN" property="mp3Type"/>        <result column="remark" jdbcType="VARCHAR" property="remark"/>        <result column="userName" jdbcType="VARCHAR" property="userName"/>        <collection property="background" ofType="com.yonge.cooleshow.biz.dal.entity.MusicSheetAccompaniment">            <id column="accompanimentId" jdbcType="BIGINT" property="id"/>            <result column="accompanimentMusicSheetId" jdbcType="BIGINT" property="musicSheetId"/>            <result column="accompanimentMusicSubject" jdbcType="VARCHAR" property="musicSubject"/>            <result column="accompanimentAudioFileUrl" jdbcType="VARCHAR" property="audioFileUrl"/>            <result column="accompanimentSortNumber" jdbcType="TINYINT" property="sortNumber"/>            <result column="accompanimentCreateTime" jdbcType="TIMESTAMP" property="createTime"/>            <result column="accompanimentMetronomeUrl" jdbcType="VARCHAR" property="metronomeUrl"/>            <result column="track" jdbcType="VARCHAR" property="track"/>        </collection>    </resultMap>    <select id="selectStudentMusicPage" resultType="com.yonge.cooleshow.biz.dal.vo.MusicSheetVo">        select <include refid="Base_Column_List"/>        ,su.username_ as addName        ,su.avatar_ as addUserAvatar        ,(select group_concat(mt.name_) from music_tag mt        where find_in_set(mt.id_,t.music_tag_) and mt.del_flag_ = 0) as musicTagNames        ,(select group_concat(s.name_) from subject s        where find_in_set(s.id_,t.music_subject_)  and s.del_flag_ = 0) as subjectNames        <if test="param.studentId != null">            ,if(mf.id_ is not null,1,0) as favorite        </if>        from music_sheet t        left join sys_user su on t.create_by_ = su.id_        <if test="param.studentId != null">            left join music_favorite mf on t.id_ = mf.music_sheet_id_ and mf.user_id_ = #{param.studentId}        </if>        <where>            <include refid="QueryInfo"/>        </where>        order by  t.id_ desc    </select>    <select id="selectMyMusicPage" resultType="com.yonge.cooleshow.biz.dal.vo.MusicSheetVo">        select <include refid="Base_Column_List"/>        ,su.username_ as addName        ,su.avatar_ as addUserAvatar        ,(select group_concat(mt.name_) from music_tag mt        where find_in_set(mt.id_,t.music_tag_) and mt.del_flag_ = 0) as musicTagNames        ,(select group_concat(s.name_) from subject s        where find_in_set(s.id_,t.music_subject_) and s.del_flag_ = 0 ) as subjectNames        from music_sheet t        left join sys_user su on t.create_by_ = su.id_        left join music_sheet_purchase_record mspr on mspr.music_sheet_id_ = t.id_        <where>            <include refid="QueryInfo"/>            <if test="param.studentId != null">                and mspr.student_id_ = #{param.studentId}                and mspr.order_status_ = 1            </if>        </where>        order by  mspr.id_ desc    </select>    <select id="selectFavoriteMusicPage" resultType="com.yonge.cooleshow.biz.dal.vo.MusicSheetVo">        select <include refid="Base_Column_List"/>        ,su.username_ as addName        ,su.avatar_ as addUserAvatar        ,(select group_concat(mt.name_) from music_tag mt        where find_in_set(mt.id_,t.music_tag_) and mt.del_flag_ = 0) as musicTagNames        ,(select group_concat(s.name_) from subject s        where find_in_set(s.id_,t.music_subject_) and s.del_flag_ = 0 ) as subjectNames        ,if(mf.id_ is not null,1,0) as favorite        from music_sheet t        left join sys_user su on t.create_by_ = su.id_        left join music_favorite mf on t.id_ = mf.music_sheet_id_        <where>            <include refid="QueryInfo"/>            <if test="param.studentId != null">                and mf.user_id_ = #{param.studentId}            </if>        </where>        order by mf.id_ desc    </select>    <select id="selectPracticeMusicPage" resultType="com.yonge.cooleshow.biz.dal.vo.MusicSheetVo">        select <include refid="Base_Column_List"/>        ,su.username_ as addName        ,su.avatar_ as addUserAvatar        ,(select group_concat(mt.name_) from music_tag mt        where find_in_set(mt.id_,t.music_tag_) and mt.del_flag_ = 0) as musicTagNames        ,(select group_concat(s.name_) from subject s where find_in_set(s.id_,t.music_subject_) ) as subjectNames        from music_sheet t        left join sys_user su on t.create_by_ = su.id_        <where>            <include refid="QueryInfo"/>            <if test="practiceMusicIdList != null and practiceMusicIdList.size() != 0">                and t.id_ in                <foreach collection="practiceMusicIdList" item="item" open="(" close=")" separator=",">                    #{item}                </foreach>            </if>        </where>        <if test="practiceMusicIdList != null and practiceMusicIdList.size() != 0">            order by field(t.id_,            <foreach collection="practiceMusicIdList" item="item" separator=",">                #{item}            </foreach>        </if>        )    </select>    <select id="selectStudentOrderPage" resultType="com.yonge.cooleshow.biz.dal.vo.StudentMusicSheetOrderVo">        select mspr.music_sheet_id_ as musicSheetId        ,ms.music_sheet_name_ as musicSheetName        ,ms.composer_ as composer        ,ms.music_tag_ as musicTag        ,(select group_concat(mt.name_) from music_tag mt        where find_in_set(mt.id_,ms.music_tag_) and mt.del_flag_ = 0) as musicTagNames        ,mspr.purchase_price_ as purchasePrice        ,mspr.order_no_ as orderNo        ,mspr.purchase_time_ as purchaseTime        from music_sheet_purchase_record mspr        left join music_sheet ms on mspr.music_sheet_id_ = ms.id_        <where>            <if test="param.orderStatus != null">                and mspr.order_status_ = #{param.orderStatus}            </if>            <if test="param.idAndName != null and param.idAndName != ''">                and (ms.id_ like concat('%',#{param.idAndName} ,'%')                    or ms.music_sheet_name_ like concat('%',#{param.idAndName},'%'))            </if>            <if test="param.studentId != null">                and mspr.student_id_ = #{param.studentId}            </if>            <if test="param.orderNo != null and param.orderNo != ''">                and mspr.order_no_ = #{param.orderNo}            </if>            <if test="param.musicTagList != null and param.musicTagList.size() != 0">                and                <foreach collection="param.musicTagList" separator="and" item="item">                    find_in_set(#{item},ms.music_tag_)                </foreach>            </if>            <if test="param.startTime != null">                and mspr.purchase_time_ > #{param.startTime}            </if>            <if test="param.endTime != null">                and mspr.purchase_time_ < #{param.endTime}            </if>            <if test="param.delFlag != null">                and ms.del_flag_ = #{param.delFlag}            </if>        </where>        order by mspr.id_ desc    </select>    <select id="selectTeacherPage" resultType="com.yonge.cooleshow.biz.dal.vo.TeacherMusicSheetVo">        select ms.id_ as musicSheetId        ,ms.music_sheet_name_ as musicSheetName        ,ms.composer_ as composer        ,ms.music_tag_ as musicTag        ,(select group_concat(mt.name_) from music_tag mt        where find_in_set(mt.id_,ms.music_tag_) and mt.del_flag_ = 0) as musicTagNames        ,ms.play_speed_ as playSpeed        ,ms.music_price_ as musicPrice        ,ms.create_time_ as createTime        ,ms.audit_status_ as auditStatus        ,su.username_ as auditName        from music_sheet ms        left join music_sheet_auth_record msar on ms.id_ = msar.music_sheet_id_        left join sys_user su on msar.verify_user_id_ = su.id_        <where>            <if test="param.idAndName != null and param.idAndName != ''">                and (ms.id_ like concat('%',#{param.idAndName} ,'%')                or ms.music_sheet_name_ like concat('%',#{param.idAndName},'%')                or ms.composer_ like concat('%',#{param.idAndName},'%'))            </if>            <if test="param.teacherId != null">                and ms.create_by_ = #{param.teacherId}            </if>            <if test="param.startTime != null">                and ms.create_time_ > #{param.startTime}            </if>            <if test="param.endTime != null">                and ms.create_time_ < #{param.endTime}            </if>            <if test="param.delFlag != null">                and ms.del_flag_ = #{param.delFlag}            </if>        </where>        order by  ms.id_ desc    </select>    <select id="selectAuditPage" resultType="com.yonge.cooleshow.biz.dal.vo.TeacherMusicSheetVo">        select        ms.create_by_ as teacherId        ,su.username_ as username        ,su.phone_ as phone        ,ms.id_ as musicSheetId        ,ms.music_sheet_name_ as musicSheetName        ,ms.composer_ as composer        ,ms.music_tag_ as musicTag        ,(select group_concat(mt.name_) from music_tag mt        where find_in_set(mt.id_,ms.music_tag_) and mt.del_flag_ = 0) as musicTagNames        ,ms.play_speed_ as playSpeed        ,ms.music_price_ as musicPrice        ,ms.create_time_ as createTime        ,ms.audit_status_ as auditStatus        ,su.username_ as auditName        from music_sheet ms        left join sys_user su on su.id_ = ms.create_by_        left join music_sheet_auth_record msar on ms.id_ = msar.music_sheet_id_        left join sys_user su2 on msar.verify_user_id_ = su2.id_        <where>            ms.user_id_ > 0            <if test="param.idAndName != null and param.idAndName != ''">                and (su.id_ like concat('%',#{param.idAndName} ,'%')                or su.username_ like concat('%',#{param.idAndName},'%')                or su.phone_ like concat('%',#{param.idAndName},'%'))            </if>            <if test="param.auditName != null and param.auditName != ''">                and su2.username_ like concat('%',#{param.auditName},'%')            </if>            <if test="param.authStatus != null">                and ms.audit_status_ = #{param.authStatus}            </if>            <if test="param.startTime != null">                and ms.create_time_ > #{param.startTime}            </if>            <if test="param.endTime != null">                and ms.create_time_ < #{param.endTime}            </if>            <if test="param.delFlag != null">                and ms.del_flag_ = #{param.delFlag}            </if>        </where>        order by  ms.submit_audit_time_ desc    </select></mapper>
 |