コード例 #1
0
 /**
  * @author mao
  * @date 创建时间:2016-1-3下午11:12:38
  * @see com.monkey77.service.ICartService#getCartByUserId(int)
  */
 @Override
 public Map<String, Object> getCartByUserId(int userId) {
   // TODO Auto-generated method stub
   Map<String, Object> result = new HashMap<String, Object>();
   List<JsonCart> c = cartDao.getCartByUserId(userId);
   result.put("cart", c);
   return result;
 }
コード例 #2
0
 /**
  * @author mao
  * @return
  * @date 创建时间:2016-1-3下午11:12:38
  * @see com.monkey77.service.ICartService#delCart(int, int, int)
  */
 @Override
 public Map<String, Object> delCart(int userId, int goodId, int num) {
   // TODO Auto-generated method stub
   Map<String, Object> result = new HashMap<String, Object>();
   List<JsonCart> c = cartDao.delCartWithResult(userId, goodId, num);
   result.put("cart", c);
   return result;
 }
コード例 #3
0
 /**
  * @date 创建时间:2016-1-9下午3:38:18
  * @see com.monkey77.service.ICartService#getCartByMobile(int)
  */
 @Override
 public Map<String, Object> getCartByMobile(String mobile) {
   // TODO Auto-generated method stub
   Map<String, Object> result = new HashMap<String, Object>();
   List<JsonCart> c = cartDao.getCartByMobile(mobile);
   result.put("cart", c);
   return result;
 }
コード例 #4
0
 /**
  * @author mao
  * @date 创建时间:2016-2-1下午2:44:07
  * @see com.monkey77.service.ICartService#getOrderDetailFromCart(int)
  */
 @Override
 public Set<TOrderDetail> getOrderDetailFromCart(int userId) {
   // TODO Auto-generated method stub
   Set<TOrderDetail> orderDetail = cartDao.getOrderDetil(userId);
   for (TOrderDetail t : orderDetail) {
     goodDao.decreaseGoodNum(t.getTGood().getId(), t.getGoodNumber());
   }
   return orderDetail;
 }
コード例 #5
0
 /**
  * @author mao
  * @date 创建时间:2016-3-23下午1:56:19
  * @see com.monkey77.service.ICartService#updateCartByMobile(java.lang.String, java.lang.String)
  */
 @Override
 public Map<String, Object> updateCartByMobile(String mobile, String cartData) {
   // TODO Auto-generated method stub
   Gson g = new Gson();
   CartInfo ci = g.fromJson(cartData, CartInfo.class);
   int userId = userDao.getUserByMobile(mobile).getId();
   cartDao.updateCartByMobile(ci.getCart(), userId);
   Map<String, Object> result = new HashMap<String, Object>();
   result.put("statusCode", 0);
   return result;
 }
コード例 #6
0
 /**
  * @author mao
  * @date 创建时间:2016-1-7下午2:07:17
  * @see com.monkey77.service.ICartService#addNewCart(int, int, int)
  */
 @Override
 public void addNewCart(int userId, int goodId, int num) {
   // TODO Auto-generated method stub
   cartDao.insertCart(userId, goodId, num);
 }
コード例 #7
0
 /**
  * @author mao
  * @date 创建时间:2016-1-3下午11:12:38
  * @see com.monkey77.service.ICartService#clearCart(int)
  */
 @Override
 public void clearCart(int userId) {
   // TODO Auto-generated method stub
   cartDao.clearCart(userId);
 }