| | |
| | | insert.setIsdeleted(Constants.ZERO); |
| | | insert.setRemark(baseGoods.getRemark()); |
| | | insert.setName(baseGoods.getName()); |
| | | insert.setStatus(Constants.ZERO); |
| | | //默认下架 |
| | | insert.setStatus(Constants.ONE); |
| | | insert.setSortnum(integer+Constants.ONE); |
| | | insert.setImgurl(baseGoods.getImgurl()); |
| | | insert.setCategoryId(baseGoods.getCategoryId()); |
| | |
| | | |
| | | |
| | | @Override |
| | | public PageData<BaseGoods> findCompanyPage(PageWrap<BaseGoods> pageWrap ,Integer companyId) { |
| | | |
| | | //查询企业已经存在的商品 |
| | | List<Integer> collect = new ArrayList<>(); |
| | | if(Objects.nonNull(companyId)){ |
| | | QueryWrapper<Goods> goodsQuery = new QueryWrapper<>(); |
| | | goodsQuery.lambda().eq(Goods::getIsdeleted,Constants.ZERO) |
| | | .eq(Goods::getCompanyId,companyId) |
| | | .isNotNull(Goods::getGoodsId); |
| | | List<Goods> goods = goodsMapper.selectList(goodsQuery); |
| | | if (CollectionUtils.isEmpty(goods)){ |
| | | collect = goods.stream().map(s -> s.getGoodsId()).collect(Collectors.toList()); |
| | | } |
| | | } |
| | | |
| | | public PageData<BaseGoods> findCompanyPage(PageWrap<BaseGoods> pageWrap) { |
| | | LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | pageWrap.getModel().setIsdeleted(Constants.ZERO); |
| | | IPage<BaseGoods> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity()); |
| | | MPJLambdaWrapper<BaseGoods> queryWrapper = new MPJLambdaWrapper<>(); |
| | |
| | | .eq(pageWrap.getModel().getCategoryId()!=null,BaseGoods::getCategoryId, pageWrap.getModel().getCategoryId()) |
| | | .eq(pageWrap.getModel().getBrandId()!=null,BaseGoods::getBrandId, pageWrap.getModel().getBrandId()) |
| | | .eq(pageWrap.getModel().getStatus()!=null,BaseGoods::getStatus, pageWrap.getModel().getStatus()) |
| | | .notIn(!CollectionUtils.isEmpty(collect),BaseGoods::getId, collect); |
| | | |
| | | .notExists(user.getType().equals(Constants.UserType.COMPANY.getKey())," select 1 from goods g where g.GOODS_ID = t.id and g.TYPE = 1 and g.company_id = "+user.getCompanyId()+" "); |
| | | queryWrapper.orderByDesc(Goods::getId); |
| | | PageData<BaseGoods> pageData =PageData.from(baseGoodsJoinMapper.selectJoinPage(page,BaseGoods.class,queryWrapper)); |
| | | String prefixUrl = systemDictDataBiz.queryByCode(Constants.OSS, Constants.RESOURCE_PATH).getCode() |
| | |
| | | } |
| | | QueryWrapper<BaseCategory> categoryQuery = new QueryWrapper<>(); |
| | | categoryQuery.lambda() |
| | | .eq(BaseCategory::getName,s.getCategoryName()); |
| | | .eq(BaseCategory::getName,s.getCategoryName()); |
| | | BaseCategory baseCategory = baseCategoryMapper.selectOne(categoryQuery); |
| | | if (Objects.isNull(baseCategory)){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"商品类别不存在"); |
| | |
| | | |
| | | QueryWrapper<Brand> brandQuery = new QueryWrapper<>(); |
| | | brandQuery.lambda() |
| | | .eq(Brand::getType,Constants.ONE) |
| | | .eq(Brand::getName,s.getBrandName()); |
| | | Brand brand = brandMapper.selectOne(brandQuery); |
| | | |