From da76455a9ef5910d1379b00b1c3223c5fd1d1481 Mon Sep 17 00:00:00 2001 From: quyixiao <2621048238@qq.com> Date: Fri, 7 Nov 2025 00:04:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/mm/AdminProductController.java | 105 +++++++++++++++++- 1 file changed, 99 insertions(+), 6 deletions(-) diff --git a/api-web/api-interface/src/main/java/com/heyu/api/controller/mm/AdminProductController.java b/api-web/api-interface/src/main/java/com/heyu/api/controller/mm/AdminProductController.java index 1d9718e..3bac8c6 100644 --- a/api-web/api-interface/src/main/java/com/heyu/api/controller/mm/AdminProductController.java +++ b/api-web/api-interface/src/main/java/com/heyu/api/controller/mm/AdminProductController.java @@ -1,6 +1,7 @@ package com.heyu.api.controller.mm; +import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.metadata.IPage; import com.heyu.api.alibaba.request.mm.VvProductDetailRequest; import com.heyu.api.alibaba.request.mm.VvProductRequest; @@ -289,13 +290,14 @@ public class AdminProductController { List vvProductPropertyDTOS = vvProductDTO.getVvProductPropertyList(); List vvProductPropertyEntities = vvProductPropertyDao.selectVvProductPropertyByProductId(productId); - Map> groupbyProductProperty = - SanUtils.list2GroupBy(vvProductPropertyEntities, VvProductPropertyEntity::getId); - for (VvProductPropertyEntity vvProductPropertyDb : vvProductPropertyEntities) { + Map> groupbyProductProperty = + SanUtils.list2GroupBy(vvProductPropertyDTOS, VvProductPropertyDTO::getId); + + for (VvProductPropertyEntity vvProductProperty : vvProductPropertyEntities) { // 对他进行编辑 - if (CollectionUtils.notContainsKey(groupbyProductProperty, vvProductPropertyDb.getId())) { - vvProductPropertyDao.deleteVvProductPropertyRealById(vvProductPropertyDb.getId()); - vvProductPropertyValueDao.deleteVvProductPropertyValueRealByProductPropertyId(vvProductPropertyDb.getId()); + if (CollectionUtils.notContainsKey(groupbyProductProperty, vvProductProperty.getId())) { + vvProductPropertyDao.deleteVvProductPropertyRealById(vvProductProperty.getId()); + vvProductPropertyValueDao.deleteVvProductPropertyValueRealByProductPropertyId(vvProductProperty.getId()); } } @@ -356,5 +358,96 @@ public class AdminProductController { return R.ok(); } + // key: + + + public static void main(String[] args) { + String a[] = new String[]{"a","b","c"}; // 颜色 + String b[] = new String[]{"x","y","z"}; // 长度 + String c[] = new String[]{"m","n"}; // 尺寸 + + List list =new ArrayList<>(); + + list.add(a); + list.add(b); + list.add(c); + + + int size = list.size(); + List level = new ArrayList<>(); + for (String[] strings : list) { + level.add(strings.length); + } + + System.out.println(JSON.toJSONString(level)); + + List> ccc = can(level); + System.out.println(JSON.toJSONString(ccc)); + + List> ddd = new ArrayList<>(); + + int i = 0 ; + for (List integers : ccc) { + ddd = digui(integers,ddd,i ); + i ++; + + } + System.out.println(JSON.toJSONString(ddd)); + } + + + public static List> digui(List list, List> ddd,int flag ){ + List> newList = new ArrayList<>(); + if(ddd.size()==0){ + newList.add(list); + return newList; + } + + if(flag ==2){ + System.out.println("xxxxxxxxxx"); + } + + for (List integers : ddd) { + for (Integer integer : integers) { + for (Integer i : list) { + List listItem = new ArrayList<>(); + listItem.addAll(integers ); + listItem.add(i); + newList.add(listItem); + } + } + + } + + return newList; + + } + + + + + + + + + public static List> can (List list ){ + List> lists = new ArrayList<>(); + for (Integer i : list) { + List xx = aa(i); + lists.add(xx); + } + return lists; + } + + + public static List aa (Integer max){ + List list = new ArrayList<>(); + for(int i = 0 ;i < max;i ++){ + list.add(i); + } + return list; + + } + }