From 02f0716a1d7ea69e1c66738681b3e5edc5a07342 Mon Sep 17 00:00:00 2001 From: jiangping <jp@doumee.com> Date: 星期三, 20 九月 2023 10:37:09 +0800 Subject: [PATCH] sessionkey更换 --- server/service/src/main/java/com/doumee/service/business/impl/GoodsServiceImpl.java | 33 ++++++++++++++++++++++----------- 1 files changed, 22 insertions(+), 11 deletions(-) diff --git a/server/service/src/main/java/com/doumee/service/business/impl/GoodsServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/GoodsServiceImpl.java index 16e0905..3a99f62 100644 --- a/server/service/src/main/java/com/doumee/service/business/impl/GoodsServiceImpl.java +++ b/server/service/src/main/java/com/doumee/service/business/impl/GoodsServiceImpl.java @@ -175,6 +175,8 @@ // 濡傛灉閫夋嫨骞冲彴鍟嗗搧鍜屾煡璇㈢粨鏋滃涓嶄笂锛屾彁绀洪敊璇� throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"瀵逛笉璧凤紝璇锋纭�夋嫨骞冲彴鍟嗗搧锛�"); } + List<Multifile> multifileList = new ArrayList<>(); + List<GoodsParam> goodsParamList = new ArrayList<>(); for(BaseGoods model : goodsList){ //閬嶅巻骞冲彴鍟嗗搧淇℃伅锛岃繘琛屽晢鍝佷俊鎭悓姝� Goods goods = initGoodsPlatParam(user,model,param); @@ -183,16 +185,21 @@ } goodsMapper.insert(goods); //寮�濮嬪鐞嗛檮浠� - dealPlatMultifule(goods.getId(),user,model); + dealPlatMultifule(goods.getId(),user,model,multifileList); //寮�濮嬪鐞嗗弬鏁伴厤缃� - dealPlatGoodsParam(model,goods,user); + dealPlatGoodsParam(model,goods,user,goodsParamList); } - + if(multifileList.size()>0){ + multifileMapper.insertBatch(multifileList); + } + if(goodsParamList.size()>0){ + goodsParamMapper.insertBatch(goodsParamList); + } return 1; } - private void dealPlatGoodsParam(BaseGoods model, Goods goods, LoginUserInfo user) { + private void dealPlatGoodsParam(BaseGoods model, Goods goods, LoginUserInfo user,List<GoodsParam> paramList) { BaseGoodsParam baseGoodsParam = new BaseGoodsParam(); baseGoodsParam.setGoodsId(model.getId()); baseGoodsParam.setIsdeleted(Constants.ZERO); @@ -220,7 +227,8 @@ goodsParam.setVal(bgParam.getVal()); goodsParam.setName(bgParam.getName()); goodsParam.setPramaId(Objects.isNull(cateParam)?null:cateParam.getId()); - goodsParamMapper.insert(goodsParam); + paramList.add(goodsParam); +// goodsParamMapper.insert(goodsParam); } } } @@ -257,7 +265,7 @@ /** * 寮�濮嬪鐞嗗钩鍙板晢鍝佸叧鑱旈檮浠讹紝澶嶅埗涓�濂楀埌浼佷笟鍟嗗搧涓� */ - private void dealPlatMultifule(Integer id, LoginUserInfo user, BaseGoods model) { + private void dealPlatMultifule(Integer id, LoginUserInfo user, BaseGoods model,List<Multifile> fileList ) { Multifile f = new Multifile(); f.setObjId(model.getId()); f.setIsdeleted(Constants.ZERO); @@ -276,7 +284,8 @@ multifile.setName(multifile.getName()); multifile.setSortnum(multifile.getSortnum()); multifile.setCompanyId(user.getCompanyId()); - multifileMapper.insert(multifile); + fileList.add(multifile); +// multifileMapper.insert(multifile); } } } @@ -509,7 +518,7 @@ throw new BusinessException(ResponseStatus.DATA_EMPTY); } //鎷夊紡鍟嗗搧 涓� 涓婃灦鏃讹紝闇�瑕侀檺鍒� 骞冲彴鍟嗗搧鏄惁宸蹭笅鏋� - if(dbGoods.getType().equals(Constants.goodsType.PULL)&&goods.getStatus().equals(Constants.ZERO)){ + if(dbGoods.getType().equals(Constants.goodsType.PULL.getValue())&&goods.getStatus().equals(Constants.ZERO)){ BaseGoods baseGoods = baseGoodsMapper.selectById(dbGoods.getGoodsId()); if(Objects.isNull(baseGoods)){ throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"鏈煡璇㈠埌骞冲彴鍟嗗搧淇℃伅"); @@ -547,7 +556,7 @@ continue; } //鎷夊紡鍟嗗搧 涓� 涓婃灦鏃讹紝闇�瑕侀檺鍒� 骞冲彴鍟嗗搧鏄惁宸蹭笅鏋� - if(dbGoods.getType().equals(Constants.goodsType.PULL)&&batchDisableDTO.getStatus().equals(Constants.ZERO)){ + if(dbGoods.getType().equals(Constants.goodsType.PULL.getValue())&&batchDisableDTO.getStatus().equals(Constants.ZERO)){ BaseGoods baseGoods = baseGoodsMapper.selectById(dbGoods.getGoodsId()); if(Objects.isNull(baseGoods)||!baseGoods.getStatus().equals(Constants.ZERO)){ errNum++; @@ -1067,7 +1076,6 @@ i.setMultifileList(multifileMapper.selectList(new QueryWrapper<Multifile>().eq("OBJ_ID",i.getId()).orderByAsc(" SORTNUM "))); i.setGoodsParamList(goodsParamMapper.selectList(new QueryWrapper<GoodsParam>() .eq("GOODS_ID",i.getId()) - .apply(" name in ( select cp.NAME from cate_param cp where cp.CATEGORY_ID = "+i.getCategoryId()+" and cp.ISSHOW = 1 and cp.ISDELETED = 0 and cp.STATUS = 0 ) ") .orderByAsc(" SORTNUM "))); }); return PageData.from(goodsIPage); @@ -1110,7 +1118,10 @@ goodsList.forEach(i->{ i.setPrefixUrl(prefixUrl); i.setMultifileList(multifileMapper.selectList(new QueryWrapper<Multifile>().eq("OBJ_ID",i.getId()).orderByAsc(" SORTNUM "))); - i.setGoodsParamList(goodsParamMapper.selectList(new QueryWrapper<GoodsParam>().eq("GOODS_ID",i.getId()).orderByAsc(" SORTNUM "))); + i.setGoodsParamList(goodsParamMapper.selectList( + new QueryWrapper<GoodsParam>().eq("GOODS_ID",i.getId()) + .apply(" name in ( select cp.NAME from cate_param cp where cp.CATEGORY_ID = "+i.getCategoryId()+" and cp.ISSHOW = 1 and cp.ISDELETED = 0 and cp.STATUS = 0 ) ") + .orderByAsc(" SORTNUM "))); }); return goodsList; } -- Gitblit v1.9.3