/** * 是否已经存在存在主推抽奖商品 * * @see com.sohu.suc.gift.service.GiftService#hasRecommendGift(com.sohu.suc.gift.model.SucGift) */ public boolean hasLotteryRecommendGift(SucLotteryGift gift) { try { if (gift.getIsRecommend() == null || gift.getIsRecommend().intValue() == EnumUtils.NO) { return false; } StringBuilder queryString = new StringBuilder( "select count(id) from SucLotteryGift where regionId = 1 and isRecommend = ? "); List<Object> params = new ArrayList<Object>(); params.add(EnumUtils.YES); if (gift.getId() != null && gift.getIsRecommend().intValue() == EnumUtils.YES) { queryString.append(" and id != ?"); params.add(gift.getId()); } List<SucLotteryGift> results = lotteryGiftDao.getListByParams(queryString.toString(), params.toArray()); if (results != null && results.size() > 0) { return true; } return false; } catch (Exception e) { logger.error(e.getMessage(), e); return false; } }
/** * (后台)管理员礼品管理-保存编辑后的抽奖礼品对象 * * @see * com.sohu.suc.gift.service.LotteryService#updateLotteryGift(com.sohu.suc.gift.model.SucLotteryGift) */ public void updateLotteryGift(SucLotteryGift gift) throws SucLotteryException { try { lotteryGiftDao.saveOrUpdate(gift); } catch (Exception e) { logger.error(e.getMessage(), e); throw new SucLotteryException(e); } }
public SucLotteryGift fetchLotteryGift(Long id) { SucLotteryGift lotteryGift = null; try { lotteryGift = lotteryGiftDao.get(id); } catch (Exception e) { logger.error(e.getMessage(), e); } return lotteryGift; }
/** * 前台 抽奖 * * @param regionId 域id 默认为1 * @param pagination * @return */ public List<SucLotteryGift> lottery_recommend(Long regionId, Pagination pagination) { List<SucLotteryGift> result = null; try { // 过滤掉待重新上架状态 String queryString = "from SucLotteryGift where regionId = ? and isShelf =? and priority>=80 and priority<90 ORDER BY compositorId asc, operateTime DESC "; Object[] params = {regionId, GiftEnumUtils.SHELFED}; result = lotteryGiftDao.getObjectList(queryString, pagination, params); } catch (Exception e) { logger.error(e.getMessage(), e); } return result; }
public List<SucLotteryGift> getLotteryGiftList( String querySql, Object[] params, Pagination pagination) { return lotteryGiftDao.getObjectList(querySql, pagination, params); }