@Override
 public VipAccount vote(Integer type) {
   List<VipAccount> list = vipAccountMapper.listByTypeOrderByCountDesc(type);
   if (list == null) return null;
   VipAccount vipAccount = list.get(0);
   if (vipAccount.getCount() == 0) return null;
   return vipAccount;
 }
  @Transactional(rollbackFor = Exception.class)
  @Override
  public int save(VipAccount vipAccount) {

    // 更新商品数量
    Goods goods = new Goods();
    goods.setType(1);
    goods.setVipType(vipAccount.getType());
    goods = goodsMapper.selectByTypeAndVipType(goods);
    if (goods != null) {
      goods.setCount(goods.getCount() + vipAccount.getCount());
      goodsMapper.updateByPrimaryKey(goods);
    }

    return vipAccountMapper.insert(vipAccount);
  }