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; }
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); }
public List<Cart> queryCartList(Long userId) { Example example = new Example(Cart.class); example.setOrderByClause("created DESC"); example.createCriteria().andEqualTo("userId", userId); return this.cartDao.selectByExample(example); }