|
@@ -395,17 +395,6 @@
|
|
|
(SELECT COUNT(1) FROM user_period up LEFT JOIN user_period_status ups on up.id = ups.period_id where ups.period_status =1 and (ups.`status` =3 or ups.`status` =0) and up.grade_id = cgu.grade_id and up.user_id = cgu.user_id) as rebuild,
|
|
|
(case WHEN (SELECT COUNT(1) FROM user_period up LEFT JOIN user_period_status ups on up.id = ups.period_id where up.grade_id = cgu.grade_id AND ups.period_status =1 and ups.`status` =3 and up.user_id = cgu.user_id ) >0 then 1 ELSE 0 end) as rebuild_status,
|
|
|
cgu.grade_id,
|
|
|
- IFNULL(ge.exam_num,0) exam_num,
|
|
|
- (SELECT COUNT(DISTINCT ubr.module_id,ubr.chapter_id,ubr.exam_id) FROM user_bank_record ubr LEFT JOIN class_grade_goods cgg on cgg.goods_id = ubr.goods_id where ubr.`status`=1 and ubr.report_status =1 and ubr.user_id =cgu.user_id and ubr.grade_id = cg.grade_id and ubr.current_status = 1) as record_num,
|
|
|
-
|
|
|
- (SELECT
|
|
|
- COUNT(up.id) FROM user_period up LEFT JOIN user_period_status ups on up.id = ups.period_id where ups.`status`
|
|
|
- =0 and ups.period_status = 1 and up.goods_id=g.goods_id and up.user_id = cgu.user_id and up.type = 1) as cheat,
|
|
|
- (SELECT COUNT(up.id) FROM user_period up LEFT JOIN user_period_status ups on up.id = ups.period_id where
|
|
|
- ups.`status` =1 and ups.period_status = 1 and up.goods_id=g.goods_id and up.user_id = cgu.user_id and up.type = 2) as exam_pass,
|
|
|
- (SELECT
|
|
|
- COUNT(up.id) FROM user_period up LEFT JOIN user_period_status ups on up.id = ups.period_id where ups.`status`
|
|
|
- =0 and ups.period_status = 1 and up.goods_id=g.goods_id and up.user_id = cgu.user_id and up.type = 2) as exam_cheat,
|
|
|
(case WHEN (SELECT COUNT(1) FROM exam_apply_goods eag LEFT JOIN exam_apply ea on eag.apply_id = ea.apply_id where eag.goods_id = cgg.goods_id and ea.`status` = 1 and unix_timestamp(now()) BETWEEN ea.apply_start_time and ea.apply_end_time) >0 then 1 ELSE 0 end) as apply_status,
|
|
|
(case WHEN (SELECT COUNT(1) FROM exam_before_goods ebg LEFT JOIN exam_before eb on ebg.before_id = eb.before_id where ebg.goods_id = cgg.goods_id and eb.`status` = 1 and unix_timestamp(now()) BETWEEN eb.before_start_time and eb.before_end_time) >0 then 1 ELSE 0 end) as before_status,
|
|
|
(SELECT ea.apply_name FROM exam_apply_goods eag LEFT JOIN exam_apply ea on eag.apply_id = ea.apply_id where eag.goods_id = cgg.goods_id and ea.`status` = 1 and unix_timestamp(now()) BETWEEN ea.apply_start_time and ea.apply_end_time) as apply_name,
|
|
@@ -421,8 +410,7 @@
|
|
|
LEFT JOIN class_grade cg on cg.grade_id = cgu.grade_id
|
|
|
LEFT JOIN goods g on g.goods_id=cgg.goods_id
|
|
|
LEFT JOIN order_goods og on cgu.order_goods_id = og.order_goods_id
|
|
|
- LEFT JOIN (SELECT c.goods_id,COUNT(m.id) exam_num FROM course_menu_exam m LEFT JOIN goods_course c on m.course_id=c.course_id where m.type = 1 GROUP BY c.goods_id) ge ON
|
|
|
- cgg.goods_id = ge.goods_id
|
|
|
+
|
|
|
WHERE
|
|
|
cgu.user_id =#{userId}
|
|
|
AND cg.status=1 AND cgu.`status`=1 AND cgu.change_grade=0
|