feat(手机端): 订单模块

添加订单页面获取商品接口
master
hequan_waynaqua 4 years ago
parent 1acdb7b8b5
commit 67ec5f216e

@ -1,6 +1,7 @@
package com.wayn.mobile.api.controller; package com.wayn.mobile.api.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.wayn.common.base.BaseController; import com.wayn.common.base.BaseController;
import com.wayn.common.util.R; import com.wayn.common.util.R;
import com.wayn.mobile.api.domain.Cart; import com.wayn.mobile.api.domain.Cart;
@ -9,6 +10,9 @@ import com.wayn.mobile.framework.security.util.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.math.BigDecimal;
import java.util.List;
/** /**
* <p> * <p>
* *
@ -59,4 +63,16 @@ public class CartController extends BaseController {
public R goodsCount() { public R goodsCount() {
return iCartService.goodsCount(); return iCartService.goodsCount();
} }
@PostMapping("getCheckedGoods")
public R getCheckedGoods() {
Long userId = SecurityUtils.getLoginUser().getMember().getId();
List<Cart> cartList = iCartService.list(new QueryWrapper<Cart>()
.eq("user_id", userId).eq("checked", true));
BigDecimal amount = new BigDecimal(0.00);
for (Cart cart : cartList) {
amount = amount.add(cart.getPrice().multiply(new BigDecimal(cart.getNumber())));
}
return R.success().add("data", cartList).add("amount", amount);
}
} }

Loading…
Cancel
Save