Exemple #1
0
 public List<Cart> queryCartList() {
   Long userId = UserThreadLocal.get().getId();
   Example example = new Example(Cart.class);
   example.setOrderByClause("created DESC");
   example.createCriteria().andEqualTo("userId", userId);
   List<Cart> cartList = cartDao.selectByExample(example);
   return cartList;
 }
Exemple #2
0
  public void updateItemNum(Long itemId, Integer num) {
    Example example = new Example(Cart.class);
    example.createCriteria().andEqualTo("userId", UserThreadLocal.get().getId());

    Cart cart = new Cart();
    cart.setItemId(itemId);
    cart.setNum(num);
    cartDao.updateByExample(cart, example);
  }
Exemple #3
0
 public void deleteItemFromCart(Long itemId) {
   Cart cart = new Cart();
   cart.setItemId(itemId);
   cart.setUserId(UserThreadLocal.get().getId());
   cartDao.delete(cart);
 }