|  | @@ -33,23 +33,33 @@
 | 
	
		
			
				|  |  |          <trim prefixOverrides="union all">
 | 
	
		
			
				|  |  |              <if test="type == null or type =='MUSIC'">
 | 
	
		
			
				|  |  |                  union all
 | 
	
		
			
				|  |  | -                (select a.music_subject_ as subject_id_ from music_sheet a GROUP BY a.music_subject_)
 | 
	
		
			
				|  |  | +                (select a.music_subject_ as subject_id_ from music_sheet a
 | 
	
		
			
				|  |  | +                    where a.del_flag_ = 0 and a.state_ = 1
 | 
	
		
			
				|  |  | +                    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 GROUP BY a.lesson_subject_)
 | 
	
		
			
				|  |  | +                (select a.lesson_subject_ as subject_id_ from video_lesson_group a
 | 
	
		
			
				|  |  | +                    where a.audit_status_ = 'PASS' and a.shelves_flag_ = 1
 | 
	
		
			
				|  |  | +                    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 where a.type_ = 'PIANO_ROOM_CLASS' GROUP BY a.subject_id_)
 | 
	
		
			
				|  |  | +                (select a.subject_id_ as subject_id_ from course_group a
 | 
	
		
			
				|  |  | +                    where a.type_ = 'PIANO_ROOM_CLASS' and a.status_ in ('ING','COMPLETE','APPLY')
 | 
	
		
			
				|  |  | +                    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 where a.type_ = 'PRACTICE' GROUP BY a.subject_id_)
 | 
	
		
			
				|  |  | +                (select a.subject_id_ as subject_id_ from course_group a
 | 
	
		
			
				|  |  | +                    where a.type_ = 'PRACTICE' and a.status_ in ('ING','COMPLETE','APPLY')
 | 
	
		
			
				|  |  | +                    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 where a.type_ = 'LIVE' GROUP BY a.subject_id_)
 | 
	
		
			
				|  |  | +                (select a.subject_id_ as subject_id_ from course_group a
 | 
	
		
			
				|  |  | +                    where a.type_ = 'LIVE' and a.status_ in ('ING','COMPLETE','APPLY')
 | 
	
		
			
				|  |  | +                    GROUP BY a.subject_id_)
 | 
	
		
			
				|  |  |              </if>
 | 
	
		
			
				|  |  |          </trim>
 | 
	
		
			
				|  |  |          ) a on t.id_ = a.subject_id_
 |