v1.0.33
CI / build-deploy (pull_request) Successful in 24s
CI / notify-on-failure (pull_request) Skipped

This commit is contained in:
Timi
2026-09-07 17:40:06 +08:00
parent 4a549e77cb
commit bb5abcb48e
9 changed files with 147 additions and 1 deletions
@@ -12,6 +12,26 @@
AND `effective_at` >= #{beginAt} AND `effective_at` <= #{endAt} AND `deleted_at` IS NULL
ORDER BY `effective_at` ASC, `id` ASC
</select>
<sql id="pageWhere">
r.`deleted_at` IS NULL
<if test="storeId != null and storeId != ''">AND r.`store_id` = #{storeId}</if>
<if test="customerId != null and customerId != ''">AND r.`customer_id` = #{customerId}</if>
<if test="sourceType != null">AND r.`source_type` = #{sourceType}</if>
<if test="status != null">AND r.`status` = #{status}</if>
<if test="beginAt != null">AND r.`effective_at` &gt;= #{beginAt}</if>
<if test="endAt != null">AND r.`effective_at` &lt;= #{endAt}</if>
</sql>
<select id="countByQuery" resultType="long">
SELECT COUNT(1) FROM `gao_customer_consumption_record` r WHERE <include refid="pageWhere"/>
</select>
<select id="sumAmountByPage" resultType="long">
SELECT COALESCE(SUM(r.`amount`), 0) FROM `gao_customer_consumption_record` r WHERE <include refid="pageWhere"/>
</select>
<select id="selectByQuery" resultType="com.imyeyu.api.modules.gao.entity.GaoCustomerConsumptionRecord">
SELECT r.* FROM `gao_customer_consumption_record` r WHERE <include refid="pageWhere"/>
ORDER BY r.`effective_at` DESC, r.`created_at` DESC
LIMIT #{offset}, #{limit}
</select>
<update id="revokeBySource">
UPDATE `gao_customer_consumption_record`
SET `status` = 'REVOKED', `revoked_at` = #{revokedAt}, `revoke_reason` = #{revokeReason}, `updated_at` = FLOOR(UNIX_TIMESTAMP(NOW(3)) * 1000)