|
@@ -60,34 +60,45 @@
|
|
|
<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_) ) as subjectNames
|
|
|
from music_sheet t
|
|
|
left join sys_user su on t.create_by_ = su.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>
|
|
|
+ <include refid="QueryInfo"/>
|
|
|
</where>
|
|
|
</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>
|
|
|
+ </sql>
|
|
|
+
|
|
|
<select id="selectAlbumDetailPage" resultType="com.yonge.cooleshow.biz.dal.entity.MusicSheet">
|
|
|
select <include refid="Base_Column_List"/>
|
|
|
from music_sheet t
|
|
@@ -123,4 +134,141 @@
|
|
|
</if>
|
|
|
</where>
|
|
|
</select>
|
|
|
+
|
|
|
+ <select id="detail" resultMap="DetailResultMap">
|
|
|
+ SELECT
|
|
|
+ <include refid="Base_Column_List"/>
|
|
|
+ ,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
|
|
|
+
|
|
|
+ FROM music_sheet t
|
|
|
+ left join music_sheet_accompaniment msa on msa.music_sheet_id_ = t.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="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="remark" jdbcType="VARCHAR" property="remark"/>
|
|
|
+ <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"/>
|
|
|
+ </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_) ) 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>
|
|
|
+ </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_) ) 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>
|
|
|
+ </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_) ) 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>
|
|
|
+ </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>
|
|
|
</mapper>
|