原记录表作废

This commit is contained in:
2025-09-13 15:57:51 +08:00
parent 77ac277856
commit dca94cc848
15 changed files with 183 additions and 336 deletions

View File

@@ -1,82 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.czg.service.account.mapper.ShopActivateCouponRecordMapper">
<select id="queryReceive" resultType="com.czg.account.vo.CouponReceiveVo">
SELECT
record.id,
vip.id as userId ,
vip.`nick_name`,
vip.phone as phone,
record.create_time as receiveTime,
record.update_time as useTime,
record.source as source
FROM
tb_shop_activate_coupon_record record
LEFT JOIN tb_shop_user vip
ON record.shop_user_id = vip.id AND vip.shop_id = #{param.shopId}
WHERE
record.coupon_id = #{param.couponId}
and record.shop_id = #{param.shopId}
<if test="param.value != null and param.value != '' ">
and (vip.name like concat('%', #{param.value}, '%') or vip.telephone like concat('%', #{param.value}, '%'))
</if>
<if test="param.status != null">
and record.status = #{param.status}
</if>
<if test="param.startTime != null ">
and record.create_time &gt; #{param.startTime}
</if>
<if test="param.endTime != null ">
and record.create_time &lt; #{param.endTime}
</if>
order by record.create_time desc
</select>
<select id="findByUser" resultType="com.czg.account.entity.ShopActivateCouponRecord">
select tb_shop_activate_coupon_record.*,tb_shop_info.shop_name
from tb_shop_activate_coupon_record
left join tb_shop_info on tb_shop_activate_coupon_record.shop_id = tb_shop_info.id
where tb_shop_activate_coupon_record.shop_user_id in
<foreach collection="shopUserIds" item="userId" open="(" separator="," close=")">
#{userId}
</foreach>
<if test="status != null">
and tb_shop_activate_coupon_record.status = #{status}
</if>
order by tb_shop_activate_coupon_record.status , tb_shop_activate_coupon_record.create_time desc
</select>
<select id="queryByVipIdAndShopId" resultType="com.czg.account.vo.UserCouponVo">
SELECT
inRecord.id as id,
inRecord.shop_id as shopId,
shop.shop_name as shopName,
inRecord.full_amount as fullAmount,
inRecord.discount_amount as discountAmount,
inRecord.coupon_id as couponId,
pro.id as proId,
pro.name as productName,
inRecord.name as name,
inRecord.type,
inRecord.use_end_time as endTime
FROM
tb_shop_activate_coupon_record inRecord
LEFT JOIN tb_shop_info shop ON inRecord.shop_id = shop.id
LEFT JOIN tb_product pro ON inRecord.pro_id = pro.id and pro.shop_id = #{shopId}
WHERE
inRecord.shop_user_id = #{shopUserId}
<if test="shopId != null and shopId != ''">
and inRecord.shop_id = #{shopId}
</if>
<if test="type != null ">
and inRecord.type = #{type}
</if>
and inRecord.status = 0
and inRecord.use_start_time &lt; now()
and inRecord.use_end_time &gt; now()
order by inRecord.use_end_time
</select>
</mapper>

View File

@@ -39,17 +39,17 @@
</select>
<select id="selectAssetsSummary" resultType="com.czg.account.dto.user.userinfo.UserInfoAssetsSummaryDTO">
SELECT
IFNULL(SUM(b.amount), 0) AS amount,
IFNULL(SUM(b.account_points), 0) AS accountPoints,
COUNT(DISTINCT c.id) AS couponNum
SELECT IFNULL(SUM(b.amount), 0) AS amount,
IFNULL(SUM(b.account_points), 0) AS accountPoints,
COUNT(DISTINCT c.id) AS couponNum
FROM tb_shop_user AS b
LEFT JOIN tb_shop_activate_coupon_record AS c
ON c.shop_id = b.shop_id
AND c.shop_user_id = b.id
AND c.`status` = 1
AND c.use_start_time &lt; NOW()
AND c.use_end_time > NOW()
LEFT JOIN mk_shop_coupon_record AS c
ON c.shop_id = b.shop_id
AND c.shop_user_id = b.id
AND c.`status` = 1
AND c.use_start_time &lt; NOW()
AND c.use_end_time > NOW()
AND c.is_del = 0
WHERE b.user_id = #{userId};
@@ -66,10 +66,11 @@
-- 预计算优惠券数量
LEFT JOIN (
SELECT shop_user_id, COUNT(*) AS couponNum
FROM tb_shop_activate_coupon_record
FROM mk_shop_coupon_record
WHERE status = 0
AND use_start_time &lt; NOW()
AND use_end_time > NOW()
AND is_del = 0
GROUP BY shop_user_id
) c ON c.shop_user_id = a.id