| | |
| | | @PostMapping("/page") |
| | | // @RequiresPermissions("business:basegoods:query") |
| | | public ApiResponse<PageData<BaseGoods>> findPage (@RequestBody PageWrap<BaseGoods> pageWrap) { |
| | | return ApiResponse.success(baseGoodsService.findPage(pageWrap)); |
| | | return ApiResponse.success(baseGoodsService.findCompanyPage(pageWrap)); |
| | | } |
| | | |
| | | } |
| | |
| | | @PreventRepeat |
| | | @ApiOperation("企业新建商品") |
| | | @PostMapping("/companyCreate") |
| | | // @RequiresPermissions("business:goods:create") |
| | | @RequiresPermissions("business:goods:create") |
| | | public ApiResponse companyCreate(@RequestBody Goods goods) { |
| | | goodsService.companyCreate(goods); |
| | | cateParamSelectService.dealCateParamSelect(); |
| | |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "file", value = "file", required = true, paramType = "query", dataType = "file", dataTypeClass = File.class), |
| | | }) |
| | | // @RequiresPermissions("business:goods:create") |
| | | @RequiresPermissions("business:goods:create") |
| | | public ApiResponse<Integer> importExcel (@ApiParam(value = "file") MultipartFile file) { |
| | | Integer val = goodsService.importBatch(file); |
| | | cateParamSelectService.dealCateParamSelect(); |
| | |
| | | * @param pageWrap 分页对象 |
| | | * @return PageData<BaseGoods> |
| | | */ |
| | | PageData<BaseGoods> findCompanyPage(PageWrap<BaseGoods> pageWrap,Integer companyId); |
| | | PageData<BaseGoods> findCompanyPage(PageWrap<BaseGoods> pageWrap); |
| | | |
| | | /** |
| | | * 条件统计 |
| | |
| | | |
| | | |
| | | @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() |
| | |
| | | .or().eq(Brand::getType,Constants.ONE) |
| | | ); |
| | | } |
| | | queryWrapper.lambda().orderByAsc(Brand::getType); |
| | | queryWrapper.lambda().orderByAsc(Brand::getSortnum); |
| | | IPage<Brand> brandIPage = brandMapper.selectPage(page, queryWrapper); |
| | | String prefixUrl = systemDictDataBiz.queryByCode(Constants.OSS, Constants.RESOURCE_PATH).getCode() |
| | |
| | | .eq("ISDELETED",Constants.ZERO) |
| | | .eq("STATUS",Constants.ZERO) |
| | | .last(" limit 1 ")); |
| | | if(Objects.isNull(cateParam)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"企业分类数据同步异常请联系管理员"); |
| | | } |
| | | // if(Objects.isNull(cateParam)){ |
| | | // throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"企业分类数据同步异常请联系管理员"); |
| | | // } |
| | | GoodsParam goodsParam = new GoodsParam(); |
| | | goodsParam.setCreator(user.getId()); |
| | | goodsParam.setCreateDate(new Date()); |
| | |
| | | goodsParam.setGoodsId(goods.getId()); |
| | | goodsParam.setVal(bgParam.getVal()); |
| | | goodsParam.setName(bgParam.getName()); |
| | | goodsParam.setPramaId(cateParam.getId()); |
| | | goodsParam.setPramaId(Objects.isNull(cateParam)?null:cateParam.getId()); |
| | | goodsParamMapper.insert(goodsParam); |
| | | |
| | | //存储 cate_param_select 查询是否已存在 |
| | | // if(cateParamSelectMapper.selectCount(new QueryWrapper<CateParamSelect>() |
| | | // .eq("PARAM_ID",goodsParam.getPramaId()).eq("NAME",goodsParam.getName()))<=Constants.ZERO){ |
| | | // CateParamSelect cateParamSelect = new CateParamSelect(); |
| | | // cateParamSelect.setCreator(user.getId()); |
| | | // cateParamSelect.setCreateDate(new Date()); |
| | | // cateParamSelect.setName(goodsParam.getVal()); |
| | | // cateParamSelect.setIsdeleted(Constants.ZERO); |
| | | // cateParamSelect.setStatus(Constants.ZERO); |
| | | // cateParamSelect.setParamId(goodsParam.getPramaId()); |
| | | // cateParamSelect.setCategoryId(goods.getCategoryId()); |
| | | // cateParamSelect.setStatus(Constants.ZERO); |
| | | // cateParamSelectMapper.insert(cateParamSelect); |
| | | // }; |
| | | |
| | | } |
| | | } |
| | | } |
| | |
| | | INSERT INTO `cate_param_select` |
| | | (`CREATOR`, `CREATE_DATE`, `EDITOR`, `EDIT_DATE`, `ISDELETED`, `REMARK`, `NAME`, `PARAM_ID`, `CATEGORY_ID`, |
| | | `STATUS`, `SORTNUM`) |
| | | select #{userId} , now(),null , null , 0 , null , a.VAL , a.PRAMA_ID , b.CATEGORY_ID , 0 , null from goods_param a inner join goods b on a.GOODS_ID = b.ID |
| | | select DISTINCT #{userId} , now(),null , null , 0 , null , a.VAL , a.PRAMA_ID , b.CATEGORY_ID , 0 , null from goods_param a inner join goods b on a.GOODS_ID = b.ID |
| | | and a.PRAMA_ID is not null AND a.VAL is not null |
| | | and a.ISDELETED = 0 |
| | | and a.`STATUS` = 0 |