|
@@ -398,29 +398,28 @@
|
|
|
|
|
|
<select id="goodsList" parameterType="com.zhongzheng.modules.course.bo.CourseQueryBo" resultMap="GoodsUserVo">
|
|
<select id="goodsList" parameterType="com.zhongzheng.modules.course.bo.CourseQueryBo" resultMap="GoodsUserVo">
|
|
SELECT
|
|
SELECT
|
|
- g.*,
|
|
|
|
- cgu.grade_id,
|
|
|
|
- cgu.user_id,
|
|
|
|
|
|
+ g.*,
|
|
|
|
+ o.user_id,
|
|
(SELECT cet.education_name FROM course_education_type cet where cet.id = g.education_type_id) as education_name,
|
|
(SELECT cet.education_name FROM course_education_type cet where cet.id = g.education_type_id) as education_name,
|
|
(SELECT cet.project_name FROM course_project_type cet where cet.id = g.project_id) as project_name,
|
|
(SELECT cet.project_name FROM course_project_type cet where cet.id = g.project_id) as project_name,
|
|
(SELECT cet.business_name FROM course_business cet where cet.id = g.business_id) as business_name,
|
|
(SELECT cet.business_name FROM course_business cet where cet.id = g.business_id) as business_name,
|
|
(SELECT COUNT(1) FROM goods_course gc where gc.goods_id = g.goods_id) as course_num,
|
|
(SELECT COUNT(1) FROM goods_course gc where gc.goods_id = g.goods_id) as course_num,
|
|
- (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,
|
|
|
|
- (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 = g.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 = g.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 = g.goods_id and ea.`status` = 1 and unix_timestamp(now()) BETWEEN ea.apply_start_time and ea.apply_end_time) as apply_name,
|
|
|
|
+ (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 = g.goods_id and eb.`status` = 1 and unix_timestamp(now()) BETWEEN eb.before_start_time and eb.before_end_time) as before_name
|
|
FROM
|
|
FROM
|
|
- class_grade_user cgu
|
|
|
|
- LEFT JOIN class_grade_goods cgg ON cgu.grade_id = cgg.grade_id
|
|
|
|
- LEFT JOIN goods g on cgg.goods_id = g.goods_id
|
|
|
|
- LEFT JOIN class_grade cg on cg.grade_id = cgu.grade_id
|
|
|
|
|
|
+ `order` o
|
|
|
|
+ LEFT JOIN order_goods og ON og.order_sn = o.order_sn
|
|
|
|
+ LEFT JOIN goods g on og.goods_id = g.goods_id
|
|
where 1=1
|
|
where 1=1
|
|
|
|
+ AND og.`status` = 1
|
|
|
|
+ AND og.refund_status in (0,1,3)
|
|
|
|
+ AND og.pay_status in (2,3)
|
|
|
|
+ AND g.goods_type =1
|
|
<if test="userId != null and userId != ''">
|
|
<if test="userId != null and userId != ''">
|
|
- and cgu.user_id = #{userId}
|
|
|
|
|
|
+ and o.user_id = #{userId}
|
|
</if>
|
|
</if>
|
|
- and unix_timestamp(now()) BETWEEN cg.class_start_time and cg.class_end_time
|
|
|
|
- and cg.status =1
|
|
|
|
- and cgu.status =1
|
|
|
|
</select>
|
|
</select>
|
|
<select id="courseList" parameterType="com.zhongzheng.modules.course.bo.CourseQueryBo" resultMap="CourseUserVo">
|
|
<select id="courseList" parameterType="com.zhongzheng.modules.course.bo.CourseQueryBo" resultMap="CourseUserVo">
|
|
SELECT
|
|
SELECT
|
|
@@ -446,4 +445,18 @@
|
|
AND ups.`status` = 0
|
|
AND ups.`status` = 0
|
|
AND ups.period_status = 1
|
|
AND ups.period_status = 1
|
|
</select>
|
|
</select>
|
|
|
|
+ <select id="gradeIdSelect" parameterType="map" resultType="Long">
|
|
|
|
+ SELECT
|
|
|
|
+ cgu.grade_id
|
|
|
|
+ FROM
|
|
|
|
+ class_grade_user cgu
|
|
|
|
+ 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
|
|
|
|
+ cgu.user_id=#{userId}
|
|
|
|
+
|
|
|
|
+ and cg.`status` =1
|
|
|
|
+ and cgg.goods_id = #{goodsId}
|
|
|
|
+ order by cg.create_time desc LIMIT 1
|
|
|
|
+ </select>
|
|
</mapper>
|
|
</mapper>
|