|  | @@ -65,12 +65,57 @@
 | 
	
		
			
				|  |  |          b.sales_end_date_             as salesEndDate,
 | 
	
		
			
				|  |  |          b.mix_student_num_            as mixStudentNum,
 | 
	
		
			
				|  |  |          b.im_group_id_              as imGroupId,
 | 
	
		
			
				|  |  | -        if(o.status_ = 'PAID', 1, 0)  as existBuy
 | 
	
		
			
				|  |  | +        0  as existBuy
 | 
	
		
			
				|  |  |          from course_group as b
 | 
	
		
			
				|  |  |          left join subject as s on b.subject_id_ = s.id_
 | 
	
		
			
				|  |  |          left join sys_user as u on b.teacher_id_ = u.id_
 | 
	
		
			
				|  |  | -        left join user_order_detail as d on b.id_ = d.biz_id_
 | 
	
		
			
				|  |  | -        left join user_order as o on d.order_no_ = o.order_no_
 | 
	
		
			
				|  |  | +        <where>
 | 
	
		
			
				|  |  | +            <if test="param.teacherId != null">
 | 
	
		
			
				|  |  | +                and b.teacher_id_ = #{param.teacherId}
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="param.groupStatus != null">
 | 
	
		
			
				|  |  | +                and b.status_ = #{param.groupStatus}
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="param.subjectId != null">
 | 
	
		
			
				|  |  | +                AND b.subject_id_ = #{param.subjectId}
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +            <if test="param.search != null and param.search !=''">
 | 
	
		
			
				|  |  | +                and  (
 | 
	
		
			
				|  |  | +                u.real_name_ like concat('%',#{param.search},'%')
 | 
	
		
			
				|  |  | +                or b.name_ like concat('%',#{param.search},'%')
 | 
	
		
			
				|  |  | +                )
 | 
	
		
			
				|  |  | +            </if>
 | 
	
		
			
				|  |  | +        </where>
 | 
	
		
			
				|  |  | +    </select>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    <select id="queryStudentCourseGroup" resultType="com.yonge.cooleshow.biz.dal.vo.CourseGroupVo">
 | 
	
		
			
				|  |  | +        select distinct b.id_                         as courseGroupId,
 | 
	
		
			
				|  |  | +                        b.name_                       as courseGroupName,
 | 
	
		
			
				|  |  | +                        s.name_                       as subjectName,
 | 
	
		
			
				|  |  | +                        b.teacher_id_                 as teacherId,
 | 
	
		
			
				|  |  | +                        u.username_                   as teacherName,
 | 
	
		
			
				|  |  | +                        b.course_start_time_          as courseStartTime,
 | 
	
		
			
				|  |  | +                        b.single_course_minutes_      as singleCourseMinutes,
 | 
	
		
			
				|  |  | +                        b.status_                     as `status`,
 | 
	
		
			
				|  |  | +                        ifnull(b.pre_student_num_, 0) as studentCount,
 | 
	
		
			
				|  |  | +                        b.background_pic_             as backgroundPic,
 | 
	
		
			
				|  |  | +                        b.course_price_               as coursePrice,
 | 
	
		
			
				|  |  | +                        b.course_num_                 as courseNum,
 | 
	
		
			
				|  |  | +                        u.avatar_                     as avatar,
 | 
	
		
			
				|  |  | +                        b.sales_start_date_           as salesStartDate,
 | 
	
		
			
				|  |  | +                        b.sales_end_date_             as salesEndDate,
 | 
	
		
			
				|  |  | +                        b.mix_student_num_            as mixStudentNum,
 | 
	
		
			
				|  |  | +                        b.im_group_id_                as imGroupId,
 | 
	
		
			
				|  |  | +                        if(y.status_ = 'PAID', 1, 0)  as existBuy
 | 
	
		
			
				|  |  | +        from course_group as b
 | 
	
		
			
				|  |  | +                 left join subject as s on b.subject_id_ = s.id_
 | 
	
		
			
				|  |  | +                 left join sys_user as u on b.teacher_id_ = u.id_
 | 
	
		
			
				|  |  | +                 left join
 | 
	
		
			
				|  |  | +             (select x.user_id_, x.course_group_id_, o.status_
 | 
	
		
			
				|  |  | +              from course_schedule_student_payment as x
 | 
	
		
			
				|  |  | +                       left join user_order as o on x.order_no_ = o.order_no_ and x.user_id_ = o.user_id_
 | 
	
		
			
				|  |  | +                       left join user_order_detail as d on d.order_no_ = x.order_no_
 | 
	
		
			
				|  |  | +              where x.user_id_ = #{param.studentId}) as y on b.id_ = y.course_group_id_
 | 
	
		
			
				|  |  |          <where>
 | 
	
		
			
				|  |  |              <if test="param.teacherId != null">
 | 
	
		
			
				|  |  |                  and b.teacher_id_ = #{param.teacherId}
 |