|
@@ -280,9 +280,11 @@
|
|
|
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_sheet_purchase_record mspr on mspr.music_sheet_id_ = t.id_
|
|
|
+ left join music_favorite mf on t.id_ = mf.music_sheet_id_ and mspr.student_id_ = mf.user_id_
|
|
|
<where>
|
|
|
<include refid="QueryInfo"/>
|
|
|
<if test="param.studentId != null">
|
|
@@ -321,19 +323,22 @@
|
|
|
,(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_sheet_practice_record mspr on mspr.music_sheet_id_ = t.id_
|
|
|
+ left join music_favorite mf on t.id_ = mf.music_sheet_id_ and mspr.user_id_ = mf.user_id_
|
|
|
<where>
|
|
|
<include refid="QueryInfo"/>
|
|
|
<if test="practiceMusicIdList != null and practiceMusicIdList.size() != 0">
|
|
|
- and t.id_ in
|
|
|
+ and mspr.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_,
|
|
|
+ order by field(mspr.id_,
|
|
|
<foreach collection="practiceMusicIdList" item="item" separator=",">
|
|
|
#{item}
|
|
|
</foreach>
|