Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2a35793baf | ||
|
|
4a157e9578 | ||
|
|
eabb4c6aa6 |
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
<groupId>com.imyeyu.timiserverapi</groupId>
|
<groupId>com.imyeyu.timiserverapi</groupId>
|
||||||
<artifactId>TimiServerAPI</artifactId>
|
<artifactId>TimiServerAPI</artifactId>
|
||||||
<version>1.0.41</version>
|
<version>1.0.42</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<name>TimiServerAPI</name>
|
<name>TimiServerAPI</name>
|
||||||
<description>imyeyu.com API</description>
|
<description>imyeyu.com API</description>
|
||||||
|
|||||||
@@ -348,10 +348,23 @@
|
|||||||
FROM `daily_stat` d
|
FROM `daily_stat` d
|
||||||
JOIN `open_calendar` o ON d.`registeredDateValue` = o.`dateValue`
|
JOIN `open_calendar` o ON d.`registeredDateValue` = o.`dateValue`
|
||||||
),
|
),
|
||||||
|
`customer_stat` AS (
|
||||||
|
SELECT
|
||||||
|
d.`customerId`,
|
||||||
|
MAX(CASE WHEN d.`registeredDateValue` = #{todayDateValue} THEN 1 ELSE 0 END) AS `hasToday`
|
||||||
|
FROM `daily_stat` d
|
||||||
|
GROUP BY d.`customerId`
|
||||||
|
),
|
||||||
`anchor_date` AS (
|
`anchor_date` AS (
|
||||||
SELECT
|
SELECT
|
||||||
MAX(`openIndex`) AS `anchorOpenIndex`
|
s.`customerId`,
|
||||||
FROM `open_calendar`
|
CASE
|
||||||
|
WHEN s.`hasToday` = 1 THEN MAX(CASE WHEN c.`dateValue` = #{todayDateValue} THEN c.`openIndex` END)
|
||||||
|
ELSE MAX(CASE WHEN c.`dateValue` < #{todayDateValue} THEN c.`openIndex` END)
|
||||||
|
END AS `anchorOpenIndex`
|
||||||
|
FROM `customer_stat` s
|
||||||
|
CROSS JOIN `open_calendar` c
|
||||||
|
GROUP BY s.`customerId`, s.`hasToday`
|
||||||
),
|
),
|
||||||
`continuous_stat` AS (
|
`continuous_stat` AS (
|
||||||
SELECT
|
SELECT
|
||||||
@@ -361,7 +374,7 @@
|
|||||||
ELSE COUNT(1)
|
ELSE COUNT(1)
|
||||||
END AS `recentContinuousEventDays`
|
END AS `recentContinuousEventDays`
|
||||||
FROM `continuous_ordered` o
|
FROM `continuous_ordered` o
|
||||||
JOIN `anchor_date` a
|
JOIN `anchor_date` a ON o.`customerId` = a.`customerId`
|
||||||
WHERE
|
WHERE
|
||||||
o.`openIndex` + o.`dayIndex` = a.`anchorOpenIndex` + 1
|
o.`openIndex` + o.`dayIndex` = a.`anchorOpenIndex` + 1
|
||||||
<if test="eventIdList == null or eventIdList.size() != 1">
|
<if test="eventIdList == null or eventIdList.size() != 1">
|
||||||
|
|||||||
Reference in New Issue
Block a user