|
@@ -413,7 +413,8 @@
|
|
|
</resultMap>
|
|
|
<select id="queryStudentBuys" resultMap="queryStudentBuysMap">
|
|
|
SELECT o.`name_` organ_name_,a.student_id_,u.`username_` student_name_,u.phone_,a.lastClassDate last_class_date_,
|
|
|
- b.firstBuyTime first_buy_time_,DATEDIFF(b.firstBuyTime,a.lastClassDate) interval_day_,
|
|
|
+ b.firstBuyTime first_buy_time_,
|
|
|
+ CASE WHEN DATEDIFF(b.firstBuyTime,a.lastClassDate) < 0 THEN 0 ELSE DATEDIFF(b.firstBuyTime,a.lastClassDate) END interval_day_,
|
|
|
CASE WHEN b.firstBuyTime IS NULL THEN 0 ELSE 1 END buy_practice_ FROM
|
|
|
(SELECT pg.`student_id_` ,max(concat(cs.`class_date_`,' ',cs.`end_class_time_` )) lastClassDate
|
|
|
FROM `practice_group` pg
|