feat(pricing): 添加优惠券管理功能

- 新增 CouponManagementController 控制器,实现优惠券配置和领取记录的管理
- 新增 ICouponManagementService 接口和 CouponManagementServiceImpl 实现类,提供优惠券管理服务
- 在 PricingConfigController 中添加获取所有优惠券配置和领取记录的接口
- 新增 BundleProductListTypeHandler 类,用于处理一口价商品列表的序列化和反序列化
- 更新 PriceCouponClaimRecordMapper 和 PriceCouponConfigMapper,添加管理端所需的查询接口
This commit is contained in:
2025-08-18 04:33:58 +08:00
parent 16e07ee9ef
commit 4787efd328
7 changed files with 813 additions and 0 deletions

View File

@@ -59,4 +59,48 @@ public interface PriceCouponConfigMapper extends BaseMapper<PriceCouponConfig> {
"valid_from = #{validFrom}, valid_until = #{validUntil}, is_active = #{isActive}, " +
"updated_time = NOW() WHERE id = #{id}")
int updateCoupon(PriceCouponConfig coupon);
// ==================== 管理端接口 ====================
/**
* 管理端:查询所有优惠券配置(包含禁用的)
*/
@Select("SELECT * FROM price_coupon_config ORDER BY created_time DESC")
List<PriceCouponConfig> selectAllForAdmin();
/**
* 管理端:根据条件查询优惠券配置(支持分页)
*/
@Select("<script>" +
"SELECT * FROM price_coupon_config " +
"<where>" +
"<if test='isActive != null'>" +
"AND is_active = #{isActive}" +
"</if>" +
"<if test='couponName != null and couponName != \"\"'>" +
"AND coupon_name LIKE CONCAT('%', #{couponName}, '%')" +
"</if>" +
"</where>" +
"ORDER BY created_time DESC" +
"</script>")
List<PriceCouponConfig> selectByConditionsForAdmin(@Param("isActive") Boolean isActive,
@Param("couponName") String couponName);
/**
* 管理端:根据状态查询优惠券配置
*/
@Select("SELECT * FROM price_coupon_config WHERE is_active = #{isActive} ORDER BY created_time DESC")
List<PriceCouponConfig> selectByStatusForAdmin(@Param("isActive") Boolean isActive);
/**
* 管理端:更新优惠券状态
*/
@Update("UPDATE price_coupon_config SET is_active = #{isActive}, updated_time = NOW() WHERE id = #{id}")
int updateCouponStatus(@Param("id") Long id, @Param("isActive") Boolean isActive);
/**
* 管理端:删除优惠券配置
*/
@Update("UPDATE price_coupon_config SET deleted = 1, updated_time = NOW() WHERE id = #{id}")
int deleteCoupon(Long id);
}