未使用券 不可用删除
This commit is contained in:
@@ -47,7 +47,7 @@ public interface TbActivateInRecordMapper extends BaseMapper<TbActivateInRecord>
|
|||||||
@Select("SELECT sum( over_num ) from tb_activate_in_record" +
|
@Select("SELECT sum( over_num ) from tb_activate_in_record" +
|
||||||
" where coupon_id = #{couponId} " +
|
" where coupon_id = #{couponId} " +
|
||||||
" and now() < use_end_time group by coupon_id ")
|
" and now() < use_end_time group by coupon_id ")
|
||||||
int countNoUseCoupon(@Param("couponId") Integer couponId);
|
Integer countNoUseCoupon(@Param("couponId") Integer couponId);
|
||||||
|
|
||||||
|
|
||||||
@Update("update tb_activate_in_record" +
|
@Update("update tb_activate_in_record" +
|
||||||
|
|||||||
@@ -160,8 +160,8 @@ public class TbShopCouponServiceImpl extends ServiceImpl<TbShopCouponMapper, TbS
|
|||||||
if (CollectionUtil.isNotEmpty(tbActivates)) {
|
if (CollectionUtil.isNotEmpty(tbActivates)) {
|
||||||
throw new BadRequestException("该优惠券已关联活动,请解绑后删除");
|
throw new BadRequestException("该优惠券已关联活动,请解绑后删除");
|
||||||
}
|
}
|
||||||
int i = inRecordMapper.countNoUseCoupon(id);
|
Integer i = inRecordMapper.countNoUseCoupon(id);
|
||||||
if (i > 0) {
|
if (i != null && i > 0) {
|
||||||
throw new BadRequestException("该优惠券有发放后未使用,无法删除");
|
throw new BadRequestException("该优惠券有发放后未使用,无法删除");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user