zoukankan      html  css  js  c++  java
  • 购物车全部数据,带商品信息

    @RequestMapping("cartListVo")
        public ResultEntity cartListVo(@RequestParam(name = "data", required = true) String data) {
            GoodsCart goodsCart;
            try {
                goodsCart = decodeByBase64(data, GoodsCart.class);
                System.out.println(goodsCart);
            } catch (Exception e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
                return error(ResultCode.PARAM_DECODE_ERROR);
            }
            Wrapper<GoodsCart> wrapper = new EntityWrapper<GoodsCart>().eq("user_id", goodsCart.getUserId());
            List<GoodsCart> selectList = goodsCartService.selectList(wrapper);
            
            ArrayList<GoodsCartVo> goodsCartVoList = Lists.newArrayList();
            
            if(selectList.size()!=0) {
                for(GoodsCart onlyObj:selectList) {
                    GoodsCartVo goodsCartVoLin = new GoodsCartVo();
                     BeanUtils.copyProperties(onlyObj, goodsCartVoLin);
                     goodsCartVoList.add(goodsCartVoLin);
                }
            }
            if(goodsCartVoList.size()!=0) {
                for(GoodsCartVo goodsCartVo2:goodsCartVoList) {
                    Wrapper<GoodsBaseInfo> wrapper2 = new EntityWrapper<GoodsBaseInfo>().eq("id", goodsCartVo2.getGoodsId());
                    GoodsBaseInfo selectOne = goodsBaseInfoService.selectOne(wrapper2);
                    goodsCartVo2.setGoodsBaseInfo(selectOne);
                }
            }
            return success(goodsCartVoList);
        }
  • 相关阅读:
    Hadoop(1.2.1)安装
    ETL,BPM与ESB三者的一些感悟
    编程上面的理论支撑
    TreeSet类的排序
    List接口
    Map接口
    类和对象
    面向对象1
    IO流4
    Java面向对象
  • 原文地址:https://www.cnblogs.com/dianzan/p/12455523.html
Copyright © 2011-2022 走看看