| | |
| | | |
| | | @Autowired |
| | | private SystemDictDataBiz systemDictDataBiz; |
| | | @Autowired |
| | | private ShopMapper shopMapper; |
| | | |
| | | @Autowired |
| | | private GoodsSkuAttrJoinMapper goodsSkuAttrJoinMapper; |
| | |
| | | || goods.getDeductRata() == null |
| | | || goods.getPrice() == null |
| | | || goods.getSkuPrice() == null |
| | | || StringUtils.isBlank(goods.getImgurl()) |
| | | || org.apache.commons.collections.CollectionUtils.isEmpty(goods.getFileList())) { |
| | | // || StringUtils.isBlank(goods.getImgurl()) |
| | | // || org.apache.commons.collections.CollectionUtils.isEmpty(goods.getFileList()) |
| | | ) { |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), ResponseStatus.BAD_REQUEST.getMessage()); |
| | | } |
| | | |
| | |
| | | @Override |
| | | public List<Goods> findList(Goods goods) { |
| | | QueryWrapper<Goods> wrapper = new QueryWrapper<>(goods); |
| | | wrapper.lambda() |
| | | .in(goods.getIdList() != null && goods.getIdList().size()>0, Goods::getId, goods.getIdList()) |
| | | .eq( Goods::getIsdeleted, Constants.ZERO); |
| | | return goodsMapper.selectList(wrapper); |
| | | } |
| | | |
| | |
| | | IPage<Goods> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity()); |
| | | MPJLambdaWrapper<Goods> queryWrapper = new MPJLambdaWrapper<>(); |
| | | Utils.MP.blankToNull(pageWrap.getModel()); |
| | | |
| | | queryWrapper.selectAll(Goods.class); |
| | | |
| | | queryWrapper.select("t1.name",Goods::getCategoryName); |
| | | queryWrapper.select("t2.name" ,Goods::getBrandName); |
| | | queryWrapper.select("t3.name" ,Goods::getParentName); |
| | |
| | | queryWrapper.leftJoin(Labels.class,Labels::getId,Goods::getParentCategoryId); |
| | | //库存量 |
| | | queryWrapper.select("(select sum(STOCK) from goods_sku where ISDELETED=0 and GOODS_ID=t.id) as stockNum "); |
| | | queryWrapper.select("(select count(id) from shop_goods_relation s where s.ISDELETED=0 and s.GOODS_ID=t.id) as pricedShopNum "); |
| | | //实际销量 |
| | | queryWrapper.select("(select sum(gd.GOODS_NUM) from goodsorder_detail gd" + |
| | | " inner join goods_sku gs on gs.id=gd.GOODS_SKU_ID" + |
| | |
| | | queryWrapper.eq(pageWrap.getModel().getParentCategoryId() != null, Goods::getParentCategoryId, pageWrap.getModel().getParentCategoryId()); |
| | | queryWrapper.eq(pageWrap.getModel().getBrandId() != null, Goods::getBrandId, pageWrap.getModel().getBrandId()); |
| | | queryWrapper.eq(pageWrap.getModel().getStatus() != null, Goods::getStatus, pageWrap.getModel().getStatus()); |
| | | |
| | | queryWrapper.orderByDesc(Goods::getCreateDate); |
| | | queryWrapper.in(pageWrap.getModel().getIdList() != null && pageWrap.getModel().getIdList().size()>0, Goods::getId, pageWrap.getModel().getIdList()); |
| | | queryWrapper.orderByDesc(Goods::getId); |
| | | IPage<Goods> result = goodsAdminJoinMapper.selectJoinPage(page, Goods.class, queryWrapper); |
| | | initResult(result.getRecords()); |
| | | return PageData.from(result); |
| | |
| | | if (list == null || list.size() == 0) { |
| | | return; |
| | | } |
| | | long shopNum = shopMapper.selectCount(new QueryWrapper<Shop>().lambda() |
| | | .eq(Shop::getIsdeleted,Constants.ZERO)); |
| | | String path = systemDictDataBiz.queryByCode(Constants.OSS, Constants.RESOURCE_PATH).getCode() |
| | | + systemDictDataBiz.queryByCode(Constants.OSS, Constants.GOODS_FILE).getCode(); |
| | | for (Goods goods : list) { |
| | | goods.setShopNum(shopNum); |
| | | goods.setResourcePath(path); |
| | | //查询sku |
| | | MPJLambdaWrapper<GoodsSku> queryWrapper = new MPJLambdaWrapper<GoodsSku>() |