add chart api

This commit is contained in:
Timi
2026-08-11 23:58:00 +08:00
parent 81b7356d67
commit 5ec6bc472f
12 changed files with 490 additions and 0 deletions
@@ -203,4 +203,93 @@
ORDER BY `rank`
LIMIT #{offset}, #{limit}
</select>
<sql id="storeChartRangeWhere">
r.`store_id` = #{storeId}
AND r.`registered_at` &gt;= #{beginAt}
AND r.`registered_at` &lt;= #{endAt}
AND r.`deleted_at` IS NULL
<if test="eventIdList != null and eventIdList.size() > 0">
AND r.`event_id` IN
<foreach collection="eventIdList" item="eventId" open="(" separator="," close=")">
#{eventId}
</foreach>
</if>
</sql>
<select id="stateDailyByRange" resultType="com.imyeyu.api.modules.gao.vo.GaoEventRecordDailyStatView">
SELECT
r.`event_id` AS `eventId`,
r.`registered_date_value` AS `dateValue`,
COUNT(1) AS `dailyCount`
FROM `gao_event_record` r
WHERE
<include refid="storeChartRangeWhere"/>
GROUP BY
r.`event_id`,
r.`registered_date_value`
ORDER BY
r.`registered_date_value` ASC,
r.`event_id` ASC
</select>
<select id="selectCalendarByRange" resultType="com.imyeyu.api.modules.gao.vo.GaoEventRecordCalendarView">
SELECT
r.`id`,
r.`customer_id` AS `customerId`,
c.`code` AS `customerCode`,
c.`name` AS `customerName`,
r.`event_id` AS `eventId`,
r.`registered_at` AS `registeredAt`
FROM `gao_event_record` r
LEFT JOIN `gao_customer` c ON r.`customer_id` = c.`id` AND c.`deleted_at` IS NULL
WHERE
<include refid="storeChartRangeWhere"/>
ORDER BY
r.`registered_at` ASC,
r.`created_at` ASC
</select>
<sql id="customerChartRangeWhere">
r.`store_id` = #{storeId}
AND r.`customer_id` = #{customerId}
AND r.`registered_at` &gt;= #{beginAt}
AND r.`registered_at` &lt;= #{endAt}
AND r.`deleted_at` IS NULL
<if test="eventIdList != null and eventIdList.size() > 0">
AND r.`event_id` IN
<foreach collection="eventIdList" item="eventId" open="(" separator="," close=")">
#{eventId}
</foreach>
</if>
</sql>
<select id="stateCustomerDailyByRange" resultType="com.imyeyu.api.modules.gao.vo.GaoEventRecordDailyStatView">
SELECT
r.`event_id` AS `eventId`,
r.`registered_date_value` AS `dateValue`,
COUNT(1) AS `dailyCount`
FROM `gao_event_record` r
WHERE
<include refid="customerChartRangeWhere"/>
GROUP BY
r.`event_id`,
r.`registered_date_value`
ORDER BY
r.`registered_date_value` ASC,
r.`event_id` ASC
</select>
<select id="selectCustomerCalendarByRange" resultType="com.imyeyu.api.modules.gao.vo.GaoEventRecordCalendarView">
SELECT
r.`id`,
r.`customer_id` AS `customerId`,
c.`code` AS `customerCode`,
c.`name` AS `customerName`,
r.`event_id` AS `eventId`,
r.`registered_at` AS `registeredAt`
FROM `gao_event_record` r
LEFT JOIN `gao_customer` c ON r.`customer_id` = c.`id` AND c.`deleted_at` IS NULL
WHERE
<include refid="customerChartRangeWhere"/>
ORDER BY
r.`registered_at` DESC,
r.`created_at` DESC
</select>
</mapper>