提交修改

This commit is contained in:
quyixiao 2025-11-07 00:04:21 +08:00
parent 3949ac0375
commit da76455a9e

View File

@ -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<VvProductPropertyDTO> vvProductPropertyDTOS = vvProductDTO.getVvProductPropertyList();
List<VvProductPropertyEntity> vvProductPropertyEntities = vvProductPropertyDao.selectVvProductPropertyByProductId(productId);
Map<Long, List<VvProductPropertyEntity>> groupbyProductProperty =
SanUtils.list2GroupBy(vvProductPropertyEntities, VvProductPropertyEntity::getId);
for (VvProductPropertyEntity vvProductPropertyDb : vvProductPropertyEntities) {
Map<Long, List<VvProductPropertyDTO>> 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<String[]> list =new ArrayList<>();
list.add(a);
list.add(b);
list.add(c);
int size = list.size();
List<Integer> level = new ArrayList<>();
for (String[] strings : list) {
level.add(strings.length);
}
System.out.println(JSON.toJSONString(level));
List<List<Integer>> ccc = can(level);
System.out.println(JSON.toJSONString(ccc));
List<List<Integer>> ddd = new ArrayList<>();
int i = 0 ;
for (List<Integer> integers : ccc) {
ddd = digui(integers,ddd,i );
i ++;
}
System.out.println(JSON.toJSONString(ddd));
}
public static List<List<Integer>> digui(List<Integer> list, List<List<Integer>> ddd,int flag ){
List<List<Integer>> newList = new ArrayList<>();
if(ddd.size()==0){
newList.add(list);
return newList;
}
if(flag ==2){
System.out.println("xxxxxxxxxx");
}
for (List<Integer> integers : ddd) {
for (Integer integer : integers) {
for (Integer i : list) {
List<Integer> listItem = new ArrayList<>();
listItem.addAll(integers );
listItem.add(i);
newList.add(listItem);
}
}
}
return newList;
}
public static List<List<Integer>> can (List<Integer> list ){
List<List<Integer>> lists = new ArrayList<>();
for (Integer i : list) {
List<Integer> xx = aa(i);
lists.add(xx);
}
return lists;
}
public static List<Integer> aa (Integer max){
List<Integer> list = new ArrayList<>();
for(int i = 0 ;i < max;i ++){
list.add(i);
}
return list;
}
}