未使用券 不可用删除
This commit is contained in:
parent
08351e6260
commit
42775cae36
|
|
@ -44,6 +44,11 @@ public interface TbActivateInRecordMapper extends BaseMapper<TbActivateInRecord>
|
||||||
" order by inRecord.use_end_time asc")
|
" order by inRecord.use_end_time asc")
|
||||||
List<TbUserCouponVo> queryByVipIdAndShopId(@Param("vipUserId") Integer vipUserId, @Param("shopId") Integer shopId);
|
List<TbUserCouponVo> queryByVipIdAndShopId(@Param("vipUserId") Integer vipUserId, @Param("shopId") Integer shopId);
|
||||||
|
|
||||||
|
@Select("SELECT sum( over_num ) from tb_activate_in_record" +
|
||||||
|
" where coupon_id = #{couponId} and now() < use_end_time group by coupon_id ")
|
||||||
|
int countNoUseCoupon(@Param("couponId") Integer couponId);
|
||||||
|
|
||||||
|
|
||||||
@Update("update tb_activate_in_record" +
|
@Update("update tb_activate_in_record" +
|
||||||
" set over_num = #{overNum}" +
|
" set over_num = #{overNum}" +
|
||||||
" where id = #{id}")
|
" where id = #{id}")
|
||||||
|
|
|
||||||
|
|
@ -160,6 +160,10 @@ 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);
|
||||||
|
if (i > 0) {
|
||||||
|
throw new BadRequestException("该优惠券有发放后未使用,无法删除");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
tbShopCouponmapper.deleteBatchIds(Arrays.asList(ids));
|
tbShopCouponmapper.deleteBatchIds(Arrays.asList(ids));
|
||||||
for (Integer id : ids) {
|
for (Integer id : ids) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue