| | |
| | | // 妿鿩平å°åååæ¥è¯¢ç»æå¯¹ä¸ä¸ï¼æç¤ºé误 |
| | | 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); |
| | |
| | | } |
| | | 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); |
| | |
| | | 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); |
| | | } |
| | | } |
| | | } |
| | |
| | | /** |
| | | * å¼å§å¤çå¹³å°ååå
³èéä»¶ï¼å¤å¶ä¸å¥å°ä¼ä¸ååä¸ |
| | | */ |
| | | 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); |
| | |
| | | multifile.setName(multifile.getName()); |
| | | multifile.setSortnum(multifile.getSortnum()); |
| | | multifile.setCompanyId(user.getCompanyId()); |
| | | multifileMapper.insert(multifile); |
| | | fileList.add(multifile); |
| | | // multifileMapper.insert(multifile); |
| | | } |
| | | } |
| | | } |