@@ -105,4 +105,12 @@ public interface UserCouponService extends IService<MtUserCoupon> {
* @return
* */
boolean buyCouponItem(Integer orderId, Integer couponId, Integer userId, String mobile, Integer num) throws BusinessCheckException;
+
+ /**
+ * 通过卡券ID删除会员卡券
+ *
+ * @param couponId 卡券ID
+ * @return
+ * */
+ void removeUserCouponByCouponId(Integer couponId);
}
@@ -436,6 +436,9 @@ public class CouponServiceImpl extends ServiceImpl<MtCouponMapper, MtCoupon> imp
couponInfo.setUpdateTime(new Date());
// 操作人
couponInfo.setOperator(operator);
+ // 删除会员关联的卡券
+ userCouponService.removeUserCouponByCouponId(couponInfo.getId());
mtCouponMapper.updateById(couponInfo);
@@ -710,6 +710,19 @@ public class UserCouponServiceImpl extends ServiceImpl<MtUserCouponMapper, MtUse
return true;
+ public void removeUserCouponByCouponId(Integer couponId) {
+ if (couponId == null || couponId <= 0) {
+ return;
+ }
+ mtUserCouponMapper.removeUserCouponByCouponId(couponId);
/**
* 预存单张
*
@@ -37,4 +37,6 @@ public interface MtUserCouponMapper extends BaseMapper<MtUserCoupon> {
List<MtUserCoupon> getUserCouponListByExpireTime(@Param("userId") Integer userId, @Param("status") String status, @Param("startTime") String startTime, @Param("endTime") String endTime);
+ Boolean removeUserCouponByCouponId(@Param("couponId") Integer couponId);
@@ -63,6 +63,10 @@
</select>
<update id="updateExpireTime">
- update mt_user_coupon t set t.EXPIRE_TIME = #{expireTime} where t.COUPON_ID = #{couponId}
+ update mt_user_coupon set EXPIRE_TIME = #{expireTime} where COUPON_ID = #{couponId}
+ </update>
+ <update id="removeUserCouponByCouponId">
+ update mt_user_coupon set STATUS = 'D' where COUPON_ID = #{couponId}
</update>
</mapper>