Przeglądaj źródła

管乐迷需求一大堆

zouxuan 2 lat temu
rodzic
commit
2d984aee97

+ 9 - 10
mec-biz/src/main/resources/config/mybatis/IndexBaseMonthDataMapper.xml

@@ -2142,21 +2142,20 @@
 		GROUP BY spo.user_id_,spo.create_time_,spo.organ_id_;
 	</select>
     <select id="getCurrentCourseError" resultType="java.lang.Integer">
-		select COUNT(DISTINCT ss.user_id_) from student_statistics ss
-		left join (select su.id_ from sys_user su
-		left join course_schedule_student_payment cssp ON cssp.user_id_ = su.id_
-		left join course_schedule cs ON cs.id_ = cssp.course_schedule_id_
-		AND DATE_FORMAT(cs.class_date_,'%Y-%m') = #{month} AND cs.type_ = 'VIP' AND cssp.group_type_ = 'VIP' and cssp.user_id_ IS NOT NULL
-		where
+		select COUNT(cs.user_id_) from (
+		select DISTINCT ss.user_id_ from student_statistics ss
+		left join course_schedule_student_payment cssp ON cssp.user_id_ = ss.user_id_
+		left join course_schedule cs ON cs.id_ = cssp.course_schedule_id_ AND DATE_FORMAT(cs.class_date_,'%Y-%m') = #{month} AND cssp.group_type_ = 'VIP'
+		where ss.no_schedule_num_ + ss.sub_course_num_ > 4 and
+		(((ss.no_schedule_num_ > 0 OR ss.sub_course_num_) AND ss.lately_year_course_consumer_ > 0 AND ss.last_visit_status_ IS NULL) OR ss.last_visit_status_ = 'NORMAL')
+		and ss.group_type_ = 'VIP'
 		<if test="organIdList != null and organIdList.size > 0">
-			su.organ_id_ IN
+			AND su.organ_id_ IN
 			<foreach collection="organIdList" open="(" close=")" item="item" separator=",">
 				#{item}
 			</foreach>
 		</if>
-		group by su.id_ having COUNT(distinct cs.id_) &lt; 4 OR COUNT(distinct cs.id_) IS NULL) cs ON cs.id_ = ss.user_id_
-		where ss.no_schedule_num_ + ss.sub_course_num_ > 4 and (((ss.no_schedule_num_ > 0 OR ss.sub_course_num_) AND ss.lately_year_course_consumer_ > 0 AND ss.last_visit_status_ IS NULL) OR ss.last_visit_status_ = 'NORMAL')
-		AND cs.id_ = ss.user_id_ and ss.group_type_ = 'VIP'
+		group by ss.user_id_ having COUNT(distinct cs.id_) &lt; 4) cs
 	</select>
 	<select id="getWaitRenewInfo" resultType="java.lang.Integer">
 		select COUNT(ss.user_id_) from student_statistics ss