|
@@ -442,9 +442,9 @@
|
|
(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,
|
|
(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,
|
|
(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,
|
|
cgu.grade_id,
|
|
- (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 eb.before_name 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) as before_name,
|
|
|
|
|
|
+ (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 = og.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 = og.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 eb.before_name FROM exam_before_goods ebg LEFT JOIN exam_before eb on ebg.before_id = eb.before_id where ebg.goods_id = og.goods_id and eb.`status` = 1 and unix_timestamp(now()) BETWEEN eb.before_start_time and eb.before_end_time) as before_name,
|
|
cgu.order_goods_id,
|
|
cgu.order_goods_id,
|
|
og.service_start_time,
|
|
og.service_start_time,
|
|
og.service_end_time,
|
|
og.service_end_time,
|
|
@@ -465,9 +465,9 @@
|
|
g.external_link_status
|
|
g.external_link_status
|
|
FROM
|
|
FROM
|
|
class_grade_user cgu
|
|
class_grade_user cgu
|
|
- LEFT JOIN class_grade_goods cgg ON cgu.grade_id = cgg.grade_id
|
|
|
|
|
|
+ LEFT JOIN order_goods og ON cgu.order_goods_id = og.order_goods_id
|
|
LEFT JOIN class_grade cg on cg.grade_id = cgu.grade_id
|
|
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 goods g on g.goods_id=og.goods_id
|
|
LEFT JOIN order_goods og on cgu.order_goods_id = og.order_goods_id
|
|
LEFT JOIN order_goods og on cgu.order_goods_id = og.order_goods_id
|
|
LEFT JOIN course_education_type cet ON g.education_type_id = cet.id
|
|
LEFT JOIN course_education_type cet ON g.education_type_id = cet.id
|
|
LEFT JOIN course_project_type cpt ON g.project_id = cpt.id
|
|
LEFT JOIN course_project_type cpt ON g.project_id = cpt.id
|
|
@@ -780,8 +780,7 @@
|
|
where
|
|
where
|
|
m.type in (1,3)
|
|
m.type in (1,3)
|
|
and c.goods_id = #{goodsId}) as exam_num,
|
|
and c.goods_id = #{goodsId}) as 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.grade_id = cg.grade_id and ubr.order_goods_id = cgu.order_goods_id and ubr.user_id = cgu.user_id and ubr.current_status = 1) as record_num,
|
|
|
|
|
|
+ (SELECT COUNT(DISTINCT ubr.module_id,ubr.chapter_id,ubr.exam_id) FROM user_bank_record ubr where ubr.`status`=1 and ubr.report_status=1 and ubr.grade_id = cg.grade_id and ubr.order_goods_id = cgu.order_goods_id and ubr.user_id = cgu.user_id and ubr.current_status = 1) as record_num,
|
|
cgu.grade_id,
|
|
cgu.grade_id,
|
|
cg.class_start_time,
|
|
cg.class_start_time,
|
|
cg.class_end_time,
|
|
cg.class_end_time,
|
|
@@ -802,7 +801,7 @@
|
|
FROM
|
|
FROM
|
|
class_grade_user cgu
|
|
class_grade_user cgu
|
|
LEFT JOIN class_grade cg on cgu.grade_id = cg.grade_id
|
|
LEFT JOIN class_grade cg on cgu.grade_id = cg.grade_id
|
|
- LEFT JOIN class_grade_goods cgg on cg.grade_id = cgg.grade_id
|
|
|
|
|
|
+ LEFT JOIN order_goods og on cgu.order_goods_id = og.order_goods_id
|
|
WHERE
|
|
WHERE
|
|
1=1
|
|
1=1
|
|
<if test="gradeId != null and gradeId != ''">
|
|
<if test="gradeId != null and gradeId != ''">
|
|
@@ -811,7 +810,7 @@
|
|
<if test="orderGoodsId != null and orderGoodsId != ''">
|
|
<if test="orderGoodsId != null and orderGoodsId != ''">
|
|
and cgu.order_goods_id = #{orderGoodsId}
|
|
and cgu.order_goods_id = #{orderGoodsId}
|
|
</if>
|
|
</if>
|
|
- and cg.`status` =1 and cgg.goods_id = #{goodsId} and cgu.change_grade = 0 and cgu.user_id=#{userId}
|
|
|
|
|
|
+ and cg.`status` =1 and og.goods_id = #{goodsId} and cgu.change_grade = 0 and cgu.user_id=#{userId}
|
|
order by cg.create_time desc LIMIT 1
|
|
order by cg.create_time desc LIMIT 1
|
|
</select>
|
|
</select>
|
|
|
|
|
|
@@ -824,8 +823,7 @@
|
|
where
|
|
where
|
|
m.type in (1,3)
|
|
m.type in (1,3)
|
|
and c.goods_id = #{goodsId}) as exam_num,
|
|
and c.goods_id = #{goodsId}) as 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.grade_id = cg.grade_id and ubr.user_id = cgu.user_id and ubr.current_status = 1) as record_num,
|
|
|
|
|
|
+ (SELECT COUNT(DISTINCT ubr.module_id,ubr.chapter_id,ubr.exam_id) FROM user_bank_record ubr where ubr.`status`=1 and ubr.report_status=1 and ubr.grade_id = cg.grade_id and ubr.order_goods_id = cgu.order_goods_id and ubr.user_id = cgu.user_id and ubr.current_status = 1) as record_num,
|
|
cgu.grade_id,
|
|
cgu.grade_id,
|
|
cg.class_start_time,
|
|
cg.class_start_time,
|
|
cg.class_end_time,
|
|
cg.class_end_time,
|
|
@@ -845,15 +843,15 @@
|
|
FROM
|
|
FROM
|
|
class_grade_user cgu
|
|
class_grade_user cgu
|
|
LEFT JOIN class_grade cg on cgu.grade_id = cg.grade_id
|
|
LEFT JOIN class_grade cg on cgu.grade_id = cg.grade_id
|
|
- LEFT JOIN class_grade_goods cgg on cg.grade_id = cgg.grade_id
|
|
|
|
|
|
+ LEFT JOIN order_goods og on cgu.order_goods_id = og.order_goods_id
|
|
WHERE
|
|
WHERE
|
|
1=1 and cgu.tenant_id = #{tenantId}
|
|
1=1 and cgu.tenant_id = #{tenantId}
|
|
and cg.tenant_id = #{tenantId}
|
|
and cg.tenant_id = #{tenantId}
|
|
- and cgg.tenant_id = #{tenantId}
|
|
|
|
|
|
+ and og.tenant_id = #{tenantId}
|
|
<if test="gradeId != null and gradeId != ''">
|
|
<if test="gradeId != null and gradeId != ''">
|
|
and cg.grade_id = #{gradeId}
|
|
and cg.grade_id = #{gradeId}
|
|
</if>
|
|
</if>
|
|
- and cg.`status` =1 and cgg.goods_id = #{goodsId} and cgu.change_grade = 0 and cgu.user_id=#{userId}
|
|
|
|
|
|
+ and cg.`status` =1 and og.goods_id = #{goodsId} and cgu.change_grade = 0 and cgu.user_id=#{userId}
|
|
order by cg.create_time desc LIMIT 1
|
|
order by cg.create_time desc LIMIT 1
|
|
</select>
|
|
</select>
|
|
|
|
|
|
@@ -878,15 +876,13 @@
|
|
where
|
|
where
|
|
m.type in (1,3)
|
|
m.type in (1,3)
|
|
and c.goods_id = #{goodsId}) as exam_num,
|
|
and c.goods_id = #{goodsId}) as exam_num,
|
|
- (SELECT ifnull(COUNT(DISTINCT ubr.module_id,ubr.chapter_id,ubr.exam_id),0) 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.grade_id = cg.grade_id and ubr.user_id = cgu.user_id and ubr.current_status = 1) as record_num,
|
|
|
|
|
|
+ (SELECT ifnull(COUNT(DISTINCT ubr.module_id,ubr.chapter_id,ubr.exam_id),0) FROM user_bank_record ubr where ubr.`status`=1 and ubr.report_status=1 and ubr.order_goods_id = cgu.order_goods_id and ubr.grade_id = cg.grade_id and ubr.user_id = cgu.user_id and ubr.current_status = 1) as record_num,
|
|
cgu.grade_id,
|
|
cgu.grade_id,
|
|
cgu.user_id,
|
|
cgu.user_id,
|
|
cgu.order_goods_id
|
|
cgu.order_goods_id
|
|
FROM
|
|
FROM
|
|
class_grade_user cgu
|
|
class_grade_user cgu
|
|
LEFT JOIN class_grade cg on cgu.grade_id = cg.grade_id
|
|
LEFT JOIN class_grade cg on cgu.grade_id = cg.grade_id
|
|
- LEFT JOIN class_grade_goods cgg on cg.grade_id = cgg.grade_id
|
|
|
|
WHERE
|
|
WHERE
|
|
1=1
|
|
1=1
|
|
<if test="gradeId != null and gradeId != ''">
|
|
<if test="gradeId != null and gradeId != ''">
|