|
@@ -131,63 +131,65 @@
|
|
<select id="querySubjectItem" resultType="com.yonge.cooleshow.biz.dal.entity.Subject">
|
|
<select id="querySubjectItem" resultType="com.yonge.cooleshow.biz.dal.entity.Subject">
|
|
select t.* from subject t
|
|
select t.* from subject t
|
|
join (
|
|
join (
|
|
- <trim prefixOverrides="union all">
|
|
|
|
- <if test="type == null or type =='MUSIC'">
|
|
|
|
- union all
|
|
|
|
- (
|
|
|
|
- select
|
|
|
|
- a.music_subject_ as subject_id_
|
|
|
|
- from music_sheet a
|
|
|
|
- join music_sheet_purchase_record a1 on a.id_ = a1.music_sheet_id_
|
|
|
|
- where a1.student_id_ = #{userId} and a1.order_status_ = 'PAID'
|
|
|
|
- GROUP BY a.music_subject_
|
|
|
|
- )
|
|
|
|
- </if>
|
|
|
|
- <if test="type == null or type =='VIDEO'">
|
|
|
|
- union all
|
|
|
|
- (
|
|
|
|
- select
|
|
|
|
- a.lesson_subject_ as subject_id_
|
|
|
|
- from video_lesson_group a
|
|
|
|
- join video_lesson_purchase_record a1 on a.id_ = a1.video_lesson_group_id_
|
|
|
|
- where a1.student_id_ = #{userId}
|
|
|
|
- GROUP BY a.lesson_subject_
|
|
|
|
- )
|
|
|
|
- </if>
|
|
|
|
- <if test="type == null or type =='PINAO_ROOM'">
|
|
|
|
- union all
|
|
|
|
- (
|
|
|
|
- select
|
|
|
|
- a.subject_id_ as subject_id_
|
|
|
|
- from course_group a
|
|
|
|
- join course_schedule_student_payment a1 on a.id_ = a1.course_group_id_
|
|
|
|
- where a.type_ = 'PIANO_ROOM_CLASS' and a1.user_id_ = #{userId}
|
|
|
|
- GROUP BY a.subject_id_
|
|
|
|
- )
|
|
|
|
- </if>
|
|
|
|
- <if test="type == null or type =='PRACTICE'">
|
|
|
|
- union all
|
|
|
|
- (
|
|
|
|
- select
|
|
|
|
- a.subject_id_ as subject_id_
|
|
|
|
- from course_group a
|
|
|
|
- join course_schedule_student_payment a1 on a.id_ = a1.course_group_id_
|
|
|
|
- where a.type_ = 'PRACTICE' and a1.user_id_ = #{userId}
|
|
|
|
- GROUP BY a.subject_id_
|
|
|
|
- )
|
|
|
|
- </if>
|
|
|
|
- <if test="type == null or type =='LIVE'">
|
|
|
|
- union all
|
|
|
|
- (
|
|
|
|
- select
|
|
|
|
- a.subject_id_ as subject_id_
|
|
|
|
- from course_group a
|
|
|
|
- join course_schedule_student_payment a1 on a.id_ = a1.course_group_id_
|
|
|
|
- where a.type_ = 'LIVE' and a1.user_id_ = #{userId}
|
|
|
|
- GROUP BY a.subject_id_
|
|
|
|
- )
|
|
|
|
- </if>
|
|
|
|
- </trim>
|
|
|
|
|
|
+ select a.subject_id_ from (
|
|
|
|
+ <trim prefixOverrides="union all">
|
|
|
|
+ <if test="type == null or type =='MUSIC'">
|
|
|
|
+ union all
|
|
|
|
+ (
|
|
|
|
+ select
|
|
|
|
+ a.music_subject_ as subject_id_
|
|
|
|
+ from music_sheet a
|
|
|
|
+ join music_sheet_purchase_record a1 on a.id_ = a1.music_sheet_id_
|
|
|
|
+ where a1.student_id_ = #{userId} and a1.order_status_ = 'PAID'
|
|
|
|
+ GROUP BY a.music_subject_
|
|
|
|
+ )
|
|
|
|
+ </if>
|
|
|
|
+ <if test="type == null or type =='VIDEO'">
|
|
|
|
+ union all
|
|
|
|
+ (
|
|
|
|
+ select
|
|
|
|
+ a.lesson_subject_ as subject_id_
|
|
|
|
+ from video_lesson_group a
|
|
|
|
+ join video_lesson_purchase_record a1 on a.id_ = a1.video_lesson_group_id_
|
|
|
|
+ where a1.student_id_ = #{userId}
|
|
|
|
+ GROUP BY a.lesson_subject_
|
|
|
|
+ )
|
|
|
|
+ </if>
|
|
|
|
+ <if test="type == null or type =='PINAO_ROOM'">
|
|
|
|
+ union all
|
|
|
|
+ (
|
|
|
|
+ select
|
|
|
|
+ a.subject_id_ as subject_id_
|
|
|
|
+ from course_group a
|
|
|
|
+ join course_schedule_student_payment a1 on a.id_ = a1.course_group_id_
|
|
|
|
+ where a.type_ = 'PIANO_ROOM_CLASS' and a1.user_id_ = #{userId}
|
|
|
|
+ GROUP BY a.subject_id_
|
|
|
|
+ )
|
|
|
|
+ </if>
|
|
|
|
+ <if test="type == null or type =='PRACTICE'">
|
|
|
|
+ union all
|
|
|
|
+ (
|
|
|
|
+ select
|
|
|
|
+ a.subject_id_ as subject_id_
|
|
|
|
+ from course_group a
|
|
|
|
+ join course_schedule_student_payment a1 on a.id_ = a1.course_group_id_
|
|
|
|
+ where a.type_ = 'PRACTICE' and a1.user_id_ = #{userId}
|
|
|
|
+ GROUP BY a.subject_id_
|
|
|
|
+ )
|
|
|
|
+ </if>
|
|
|
|
+ <if test="type == null or type =='LIVE'">
|
|
|
|
+ union all
|
|
|
|
+ (
|
|
|
|
+ select
|
|
|
|
+ a.subject_id_ as subject_id_
|
|
|
|
+ from course_group a
|
|
|
|
+ join course_schedule_student_payment a1 on a.id_ = a1.course_group_id_
|
|
|
|
+ where a.type_ = 'LIVE' and a1.user_id_ = #{userId}
|
|
|
|
+ GROUP BY a.subject_id_
|
|
|
|
+ )
|
|
|
|
+ </if>
|
|
|
|
+ </trim>
|
|
|
|
+ ) a group by a.subject_id_
|
|
) a on t.id_ = a.subject_id_
|
|
) a on t.id_ = a.subject_id_
|
|
where t.parent_subject_id_ != 0
|
|
where t.parent_subject_id_ != 0
|
|
and not exists(
|
|
and not exists(
|