v0.0.18
This commit is contained in:
@@ -143,6 +143,54 @@
|
||||
ORDER BY `latestRegisteredAt` DESC
|
||||
</select>
|
||||
|
||||
<select id="statCustomerRegistrationDay" resultType="com.imyeyu.api.modules.gao.vo.GaoCustomerRegistrationDayStatView">
|
||||
SELECT
|
||||
r.`customer_id` AS `customerId`,
|
||||
c.`code` AS `customerCode`,
|
||||
c.`name` AS `customerName`,
|
||||
(
|
||||
SELECT a.`id`
|
||||
FROM `attachment` a
|
||||
WHERE
|
||||
a.`biz_type` = 'GAO_CUSTOMER'
|
||||
AND a.`biz_id` = c.`id`
|
||||
AND a.`attach_type` = 'PHOTO'
|
||||
AND a.`deleted_at` IS NULL
|
||||
AND (a.`destroy_at` IS NULL OR UNIX_TIMESTAMP() < a.`destroy_at`)
|
||||
ORDER BY a.`created_at` ASC
|
||||
LIMIT 1
|
||||
) AS `customerPhotoAttachmentId`,
|
||||
CAST(DATE_FORMAT(FROM_UNIXTIME(r.`registered_at` / 1000), '%Y%m%d') AS UNSIGNED) AS `dateValue`,
|
||||
COUNT(1) AS `dailyCount`,
|
||||
MAX(r.`registered_at`) AS `latestRegisteredAt`
|
||||
FROM `gao_registration_event_record` r
|
||||
LEFT JOIN `gao_customer` c ON r.`customer_id` = c.`id`
|
||||
WHERE
|
||||
r.`deleted_at` IS NULL
|
||||
AND c.`deleted_at` IS NULL
|
||||
<if test="req.beginRegisteredAt != null">
|
||||
AND r.`registered_at` >= #{req.beginRegisteredAt}
|
||||
</if>
|
||||
<if test="req.endRegisteredAt != null">
|
||||
AND r.`registered_at` <= #{req.endRegisteredAt}
|
||||
</if>
|
||||
<if test="req.registrationEventId != null and req.registrationEventId != ''">
|
||||
AND r.`registration_event_id` = #{req.registrationEventId}
|
||||
</if>
|
||||
<if test="req.registrationEventIdList != null and req.registrationEventIdList.size() > 0">
|
||||
AND r.`registration_event_id` IN
|
||||
<foreach collection="req.registrationEventIdList" item="registrationEventId" open="(" separator="," close=")">
|
||||
#{registrationEventId}
|
||||
</foreach>
|
||||
</if>
|
||||
GROUP BY
|
||||
r.`customer_id`,
|
||||
c.`code`,
|
||||
c.`name`,
|
||||
DATE_FORMAT(FROM_UNIXTIME(r.`registered_at` / 1000), '%Y%m%d')
|
||||
ORDER BY r.`customer_id` ASC, `dateValue` DESC
|
||||
</select>
|
||||
|
||||
<select id="statDailyCountByCustomerIdAndRegistrationEventIdRange" resultType="com.imyeyu.api.modules.gao.vo.GaoRegistrationEventRecordDailyStatView">
|
||||
SELECT
|
||||
CAST(DATE_FORMAT(FROM_UNIXTIME(`registered_at` / 1000), '%Y%m%d') AS UNSIGNED) AS `dateValue`,
|
||||
|
||||
Reference in New Issue
Block a user