use of com.ikoori.vip.common.persistence.model.StoreCoupon in project vip by guangdada.
the class CouponController method couponUpdate.
/**
* 跳转到修改优惠券
*/
@Permission
@RequestMapping("/coupon_update/{couponId}")
public String couponUpdate(@PathVariable Long couponId, Model model) {
Long userId = Long.valueOf(ShiroKit.getUser().getId());
Merchant merchant = merchantService.getMerchantUserId(userId);
Map<String, Object> condition = new HashMap<String, Object>();
condition.put("merchantId", merchant.getId());
// 查询可用店铺
List<StoreCoupon> storeCoupons = storeCouponService.getByCouponId(couponId);
model.addAttribute("storeCoupons", storeCoupons);
// 查询店铺
List<Store> stores = storeService.selectByCondition(condition);
model.addAttribute("stores", stores);
// 查询会员卡
List<Card> cards = cardService.selectByCondition(condition);
model.addAttribute("cards", cards);
Coupon coupon = couponService.selectById(couponId);
model.addAttribute(coupon);
return PREFIX + "coupon_edit.html";
}
use of com.ikoori.vip.common.persistence.model.StoreCoupon in project vip by guangdada.
the class StoreCouponServiceImpl method saveStoreCoupon.
/**
* 保存优惠券可用店铺
* @Title: saveStoreCoupon
* @param couponId
* @param storeIds
* @date: 2017年9月23日 下午2:29:56
* @author: chengxg
*/
@Transactional(readOnly = false, propagation = Propagation.REQUIRED)
public void saveStoreCoupon(Long couponId, String storeIds) {
// 先删除优惠券可用店铺
if (couponId != null) {
storeCouponDao.deleteByCouponId(couponId);
}
// 保存优惠券可用店铺
if (StringUtils.isNotBlank(storeIds)) {
String[] ids = storeIds.split(",");
for (int i = 0; i < ids.length; i++) {
StoreCoupon storeCoupon = new StoreCoupon();
storeCoupon.setCouponId(couponId);
storeCoupon.setStoreId(Long.valueOf(ids[i]));
storeCouponMapper.insert(storeCoupon);
}
}
}
Aggregations