购物车修改及其地址参数修复

This commit is contained in:
hupeng committed 2019-09-25 16:50:24 +08:00
1 parent 461cfaa18e
commit fbd1af0c5e
3 files changed
+6 -4

No files matched your search

@@ -1,6 +1,7 @@
package com.ruoyi.app.modular.member.controller;
import com.alibaba.fastjson.JSON;
import com.itmuch.lightsecurity.annotation.PreAuthorize;
import com.itmuch.lightsecurity.jwt.User;
import com.itmuch.lightsecurity.jwt.UserOperator;
@@ -86,8 +87,8 @@ public class UserController {
@PostMapping(value = "/shop/user-address-del")
@ApiOperation(value = "删除地址",notes = "删除地址")
public R delAddress(@RequestParam(value = "address_id",defaultValue = "0") int addressId){
public R delAddress(@Validated @RequestBody String jsonStr){
int addressId = Integer.valueOf(JSON.parseObject(jsonStr).get("address_id").toString());
boolean result = addressService.removeById(addressId);
if(result){
return R.success("操作成功");
@@ -153,7 +153,7 @@ public class MallController {
@GetMapping("/shop/mall-cart-list")
@ApiOperation(value = "获取购物车列表",notes = "获取购物车列表")
public R cartList(@RequestParam(value = "page",defaultValue = "0") int page,
@RequestParam(value = "limit",defaultValue = "10") int limit){
@RequestParam(value = "page_num",defaultValue = "10") int limit){
int userId = userOperator.getUser().getId();
//goodsService.cartList(pageVO,userId);
PageVO pageVO = new PageVO();
@@ -258,8 +258,9 @@ public class GoodsServiceImpl extends ServiceImpl<StoreGoodsMapper, StoreGoods>
.selectPage(pageModel,cartQueryWrapper);
List<StoreCart> storeCartList = storeCarts.getRecords();
List<CartDTO> carts = new ArrayList<>();
CartDTO cartDTO = new CartDTO();
for (StoreCart storeCart : storeCartList) {
CartDTO cartDTO = new CartDTO();
StoreGoods storeGoods = getById(storeCart.getGoodsId());
cartDTO.setGoodsId(storeCart.getGoodsId());
cartDTO.setGoodsName(storeGoods.getGoodsName());