| | |
| | | @Override |
| | | public Integer create(BaseGoodsCreateOrUpdateRequest baseGoods) { |
| | | LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | if(baseGoodsMapper.selectCount(new QueryWrapper<BaseGoods>().eq("ISDELETED", Constants.ZERO).eq("name",baseGoods.getName()))>0){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"【"+baseGoods.getName()+"】已存在"); |
| | | } |
| | | // if(baseGoodsMapper.selectCount(new QueryWrapper<BaseGoods>().eq("ISDELETED", Constants.ZERO).eq("name",baseGoods.getName()))>0){ |
| | | // throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"【"+baseGoods.getName()+"】已存在"); |
| | | // } |
| | | |
| | | Integer integer = baseGoodsMapper.selectCount(new QueryWrapper<BaseGoods>().eq("ISDELETED", Constants.ZERO)); |
| | | BaseGoods insert = new BaseGoods(); |
| | |
| | | public void update(BaseGoodsCreateOrUpdateRequest baseGoods) { |
| | | |
| | | LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | if(baseGoodsMapper.selectCount(new QueryWrapper<BaseGoods>() |
| | | .eq("ISDELETED",Constants.ZERO).ne("id",baseGoods.getId()) |
| | | .eq("name",baseGoods.getName()))>0){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"【"+baseGoods.getName()+"】已存在"); |
| | | } |
| | | // if(baseGoodsMapper.selectCount(new QueryWrapper<BaseGoods>() |
| | | // .eq("ISDELETED",Constants.ZERO).ne("id",baseGoods.getId()) |
| | | // .eq("name",baseGoods.getName()))>0){ |
| | | // throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"【"+baseGoods.getName()+"】已存在"); |
| | | // } |
| | | |
| | | UpdateWrapper<BaseGoods> wrapper = new UpdateWrapper<>(); |
| | | wrapper.lambda() |
| | |
| | | brandQuery.lambda() |
| | | .eq(Brand::getIsdeleted,Constants.ZERO); |
| | | brandQuery.lambda() |
| | | .eq(Brand::getType,Constants.ZERO); |
| | | .eq(Brand::getType,Constants.ONE); |
| | | Brand brand = brandMapper.selectOne(brandQuery.last("limit 1")); |
| | | |
| | | if (Objects.isNull(brand)){ |
| | |
| | | File[] files = dir.listFiles(); |
| | | if(files!=null && files.length>0){ |
| | | for(File f:files){ |
| | | if(StringUtils.isBlank(baseCategory.getImgurl()) && isImgFile(f)){ |
| | | if(isImgFile(f)){ |
| | | //取第一张图片作为列表图 |
| | | baseGoods.setImgurl(baseDataService.getOssImgurl(ossModel,ossModel.getGoodsFolder(),f)); |
| | | } |