@Test public void testAddCommodityToCart() throws Exception { ShoppingCart s = new ShoppingCart(); s.setUserAccountId(2l); s.setCommodityId(10l); s.setNumber(10); s.setAddDate(new Date().getTime()); boolean b = service.addCommodityToCart(1L,1L,1); Assert.assertTrue(b); }
@Override public boolean addCommodityToCart(Long accountId, Long commId, Integer count) { if (null == accountId) return false; ShoppingCart cart = new ShoppingCart(); cart.setUserAccountId(accountId); cart.setCommodityId(commId); cart.setNumber(count); cart.setAddDate(new Date().getTime()); return mapper.insert(cart) > 0; }
ShoppingCartServiceImpl implements IShoppingCartService { @Override public boolean addCommodityToCart(Long accountId, Long commId, Integer count) { if (null == accountId) return false; ShoppingCart cart = new ShoppingCart(); cart.setUserAccountId(accountId); cart.setCommodityId(commId); cart.setNumber(count); cart.setAddDate(new Date().getTime()); return mapper.insert(cart) > 0; } }
ShoppingCartServiceImpl implements IShoppingCartService { @Override public boolean addCommodityToCart(Long accountId, Long commId, Integer count) { if (null == accountId) return false; ShoppingCart cart = new ShoppingCart(); cart.setUserAccountId(accountId); cart.setCommodityId(commId); cart.setNumber(count); cart.setAddDate(new Date().getTime()); return mapper.insert(cart) > 0; }  }
ShoppingCartServiceImpl implements IShoppingCartService { @Override public boolean addCommodityToCart(Long accountId, Long commId, Integer count) { if (null == accountId) return false; ShoppingCart cart = new ShoppingCart(); cart.setUserAccountId(accountId); cart.setCommodityId(commId); cart.setNumber(count); cart.setAddDate(new Date().getTime()); return mapper.insert(cart) > 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 addCommodityToCart(Long accountId, Long commId, Integer count) { if (null == accountId) return false; ShoppingCart cart = new ShoppingCart(); cart.setUserAccountId(accountId); cart.setCommodityId(commId); cart.setNumber(count); cart.setAddDate(new Date().getTime()); return mapper.insert(cart) > 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);  }