@Test public void testUpdateCommodity() throws Exception { }
@Override public boolean updateCommodity(Long accountId, Long commId, Integer count) { Commoditys commoditys = commodMapper.selectByPrimaryKey(commId); Integer state = commoditys.getStateId(); boolean can = commoditys.getBuyCurrentNumber() + count > commoditys.getBuyTotalNumber(); if (state == Settings.COMMODITY_STATE_ON_LOTTERY || state == Settings.COMMODITY_STATE_HAS_LOTTERY || can) return false; ShoppingCart shopping = new ShoppingCart(); shopping.setUserAccountId(accountId); shopping.setCommodityId(commId); ShoppingCart shoppingCart = mapper.selectOne(shopping); shoppingCart.setNumber(count); return mapper.updateByPrimaryKeySelective(shoppingCart) > 0; }
ShoppingCartServiceImpl implements IShoppingCartService { @Override public boolean updateCommodity(Long accountId, Long commId, Integer count) { Commoditys commoditys = commodMapper.selectByPrimaryKey(commId); Integer state = commoditys.getStateId(); boolean can = commoditys.getBuyCurrentNumber() + count > commoditys.getBuyTotalNumber(); if (state == Settings.COMMODITY_STATE_ON_LOTTERY || state == Settings.COMMODITY_STATE_HAS_LOTTERY || can) return false; ShoppingCart shopping = new ShoppingCart(); shopping.setUserAccountId(accountId); shopping.setCommodityId(commId); ShoppingCart shoppingCart = mapper.selectOne(shopping); shoppingCart.setNumber(count); return mapper.updateByPrimaryKeySelective(shoppingCart) > 0; } }
ShoppingCartServiceImpl implements IShoppingCartService { @Override public boolean updateCommodity(Long accountId, Long commId, Integer count) { Commoditys commoditys = commodMapper.selectByPrimaryKey(commId); Integer state = commoditys.getStateId(); boolean can = commoditys.getBuyCurrentNumber() + count > commoditys.getBuyTotalNumber(); if (state == Settings.COMMODITY_STATE_ON_LOTTERY || state == Settings.COMMODITY_STATE_HAS_LOTTERY || can) return false; ShoppingCart shopping = new ShoppingCart(); shopping.setUserAccountId(accountId); shopping.setCommodityId(commId); ShoppingCart shoppingCart = mapper.selectOne(shopping); shoppingCart.setNumber(count); return mapper.updateByPrimaryKeySelective(shoppingCart) > 0; }  }
ShoppingCartServiceImpl implements IShoppingCartService { @Override public boolean updateCommodity(Long accountId, Long commId, Integer count) { Commoditys commoditys = commodMapper.selectByPrimaryKey(commId); Integer state = commoditys.getStateId(); boolean can = commoditys.getBuyCurrentNumber() + count > commoditys.getBuyTotalNumber(); if (state == Settings.COMMODITY_STATE_ON_LOTTERY || state == Settings.COMMODITY_STATE_HAS_LOTTERY || can) return false; ShoppingCart shopping = new ShoppingCart(); shopping.setUserAccountId(accountId); shopping.setCommodityId(commId); ShoppingCart shoppingCart = mapper.selectOne(shopping); shoppingCart.setNumber(count); return mapper.updateByPrimaryKeySelective(shoppingCart) > 0; }  @Override boolean addCommodityToCart(Long accountId, Long commId, Integer count); @Override boolean deleteCommodity(Long accountId, Long commId); @Override boolean updateCommodity(Long accountId, Long commId, Integer count); @Override List<Map<String, Object>> selectByAccount(Long accountId); }
ShoppingCartServiceImpl implements IShoppingCartService { @Override public boolean updateCommodity(Long accountId, Long commId, Integer count) { Commoditys commoditys = commodMapper.selectByPrimaryKey(commId); Integer state = commoditys.getStateId(); boolean can = commoditys.getBuyCurrentNumber() + count > commoditys.getBuyTotalNumber(); if (state == Settings.COMMODITY_STATE_ON_LOTTERY || state == Settings.COMMODITY_STATE_HAS_LOTTERY || can) return false; ShoppingCart shopping = new ShoppingCart(); shopping.setUserAccountId(accountId); shopping.setCommodityId(commId); ShoppingCart shoppingCart = mapper.selectOne(shopping); shoppingCart.setNumber(count); return mapper.updateByPrimaryKeySelective(shoppingCart) > 0; }  @Override boolean addCommodityToCart(Long accountId, Long commId, Integer count); @Override boolean deleteCommodity(Long accountId, Long commId); @Override boolean updateCommodity(Long accountId, Long commId, Integer count); @Override List<Map<String, Object>> selectByAccount(Long accountId);  }