修改抢单逻辑

This commit is contained in:
2026-07-06 11:43:33 +08:00
parent 28a927a053
commit 3269ffd66f
8 changed files with 494 additions and 25 deletions

View File

@@ -3,7 +3,23 @@ package com.rj.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.rj.entity.LbUserCoupon;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import java.time.LocalDate;
import java.util.List;
import java.util.Map;
@Mapper
public interface LbUserCouponMapper extends BaseMapper<LbUserCoupon> {
@Select("SELECT user_id, ANY_VALUE(user_phone) AS user_phone, ANY_VALUE(user_nickname) AS user_nickname, " +
"ANY_VALUE(parent_phone) AS parent_phone, ANY_VALUE(parent_nickname) AS parent_nickname, " +
"YEAR(coupon_date) AS year, MONTH(coupon_date) AS month, " +
"SUM(coupon_amount) AS total_amount " +
"FROM lb_user_coupon " +
"WHERE tenant_id = #{tenantId} " +
"AND coupon_date >= #{startDate} " +
"AND coupon_date <= #{endDate} " +
"GROUP BY user_id, YEAR(coupon_date), MONTH(coupon_date)")
List<Map<String, Object>> selectMonthlyAggregation(String tenantId, LocalDate startDate, LocalDate endDate);
}