提交修改
This commit is contained in:
parent
29862e7f9b
commit
517fcd0d42
@ -9,6 +9,7 @@ package com.heyu.api.data.dao.vv;
|
||||
*/
|
||||
import com.heyu.api.data.entity.vv.VvProductPropertyEntity;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.lz.mybatis.plugin.annotations.IN;
|
||||
import com.lz.mybatis.plugin.annotations.OrderBy;
|
||||
import com.lz.mybatis.plugin.annotations.OrderType;
|
||||
import com.lz.mybatis.plugin.annotations.Realy;
|
||||
@ -39,11 +40,15 @@ public interface VvProductPropertyDao extends BaseMapper<VvProductPropertyEntity
|
||||
int deleteVvProductPropertyById(@Param("id")Long id);
|
||||
|
||||
|
||||
@OrderBy(value={VvProductPropertyEntity.defalut_sort}, type={OrderType.ASC})
|
||||
@OrderBy(value={VvProductPropertyEntity.default_sort}, type={OrderType.ASC})
|
||||
List<VvProductPropertyEntity> selectVvProductPropertyByProductId(Long productId);
|
||||
|
||||
|
||||
|
||||
@Realy
|
||||
int deleteVvProductPropertyRealById(@Param("id")Long id);
|
||||
|
||||
|
||||
|
||||
List<VvProductPropertyEntity> selectProductPropertyByIds(@IN List<Long> id);
|
||||
}
|
||||
@ -10,6 +10,7 @@ package com.heyu.api.data.dao.vv;
|
||||
|
||||
import com.heyu.api.data.entity.vv.VvProductPropertyValueEntity;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.lz.mybatis.plugin.annotations.IN;
|
||||
import com.lz.mybatis.plugin.annotations.OrderBy;
|
||||
import com.lz.mybatis.plugin.annotations.OrderType;
|
||||
import com.lz.mybatis.plugin.annotations.Realy;
|
||||
@ -40,7 +41,7 @@ public interface VvProductPropertyValueDao extends BaseMapper<VvProductPropertyV
|
||||
int deleteVvProductPropertyValueById(@Param("id") Long id);
|
||||
|
||||
|
||||
@OrderBy(value={VvProductPropertyValueEntity.defalut_sort},type={OrderType.ASC})
|
||||
@OrderBy(value={VvProductPropertyValueEntity.default_sort},type={OrderType.ASC})
|
||||
List<VvProductPropertyValueEntity> selectVvProductPropertyValueByProductIdPropertyId(Long productPropertyId);
|
||||
|
||||
|
||||
@ -50,6 +51,10 @@ public interface VvProductPropertyValueDao extends BaseMapper<VvProductPropertyV
|
||||
@Realy
|
||||
int deleteVvProductPropertyValueRealByProductPropertyId(Long productPropertyId);
|
||||
|
||||
@OrderBy(value={VvProductPropertyValueEntity.defalut_sort},type={OrderType.ASC})
|
||||
@OrderBy(value={VvProductPropertyValueEntity.default_sort},type={OrderType.ASC})
|
||||
List<VvProductPropertyValueEntity> selectVvProductPropertyValueByProductIdProductId(Long productId);
|
||||
|
||||
|
||||
|
||||
List<VvProductPropertyValueEntity> selectProductPropertyValueByIds(@IN List<Long> id);
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
package com.heyu.api.data.dto.vv;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class VVAdminProductPropertyDTO {
|
||||
|
||||
/**
|
||||
* 商品属性id
|
||||
*/
|
||||
private List<Long> productPropertyIds;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,15 @@
|
||||
package com.heyu.api.data.dto.vv;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class VVAdminProductPropertyValueDTO {
|
||||
|
||||
/***
|
||||
* 商品属性值排序
|
||||
*/
|
||||
private List<Long> productPropertyValueIds;
|
||||
}
|
||||
@ -1,16 +1,15 @@
|
||||
package com.heyu.api.data.entity.vv;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import com.lz.mybatis.plugin.annotations.AS;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;import java.util.Date;
|
||||
import java.util.Date;
|
||||
/**
|
||||
*sku 与属性的对应关系
|
||||
* @author quyixiao
|
||||
* @since 2025-08-24
|
||||
* @since 2025-10-27
|
||||
*/
|
||||
|
||||
@Data
|
||||
@ -27,7 +26,7 @@ private static final long serialVersionUID = 1L;
|
||||
public final static String modify_time = CLASS_NAME + "modify_time"; // 修改时间
|
||||
public final static String product_id = CLASS_NAME + "product_id"; // 商品id
|
||||
public final static String product_property_name = CLASS_NAME + "product_property_name"; // 属性名称
|
||||
public final static String defalut_sort = CLASS_NAME + "defalut_sort"; // 默认排序
|
||||
public final static String default_sort = CLASS_NAME + "default_sort"; // 默认排序
|
||||
//
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
@ -42,7 +41,7 @@ private static final long serialVersionUID = 1L;
|
||||
//属性名称
|
||||
private String productPropertyName;
|
||||
//默认排序
|
||||
private Integer defalutSort;
|
||||
private Integer defaultSort;
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
@ -137,15 +136,15 @@ private static final long serialVersionUID = 1L;
|
||||
* 默认排序
|
||||
* @return
|
||||
*/
|
||||
public Integer getDefalutSort() {
|
||||
return defalutSort;
|
||||
public Integer getDefaultSort() {
|
||||
return defaultSort;
|
||||
}
|
||||
/**
|
||||
* 默认排序
|
||||
* @param defalutSort
|
||||
* @param defaultSort
|
||||
*/
|
||||
public void setDefalutSort(Integer defalutSort) {
|
||||
this.defalutSort = defalutSort;
|
||||
public void setDefaultSort(Integer defaultSort) {
|
||||
this.defaultSort = defaultSort;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -157,7 +156,7 @@ private static final long serialVersionUID = 1L;
|
||||
",modifyTime=" + modifyTime +
|
||||
",productId=" + productId +
|
||||
",productPropertyName=" + productPropertyName +
|
||||
",defalutSort=" + defalutSort +
|
||||
",defaultSort=" + defaultSort +
|
||||
"}";
|
||||
}
|
||||
}
|
||||
@ -1,16 +1,15 @@
|
||||
package com.heyu.api.data.entity.vv;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import com.lz.mybatis.plugin.annotations.AS;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;import java.util.Date;
|
||||
import java.util.Date;
|
||||
/**
|
||||
*sku 与属性的对应关系
|
||||
* @author quyixiao
|
||||
* @since 2025-08-24
|
||||
* @since 2025-10-27
|
||||
*/
|
||||
|
||||
@Data
|
||||
@ -29,7 +28,7 @@ private static final long serialVersionUID = 1L;
|
||||
public final static String product_property_name = CLASS_NAME + "product_property_name"; // 属性名称
|
||||
public final static String product_property_value = CLASS_NAME + "product_property_value"; // 属性id
|
||||
public final static String product_property_id = CLASS_NAME + "product_property_id"; // 商品属性id
|
||||
public final static String defalut_sort = CLASS_NAME + "defalut_sort"; // 默认排序
|
||||
public final static String default_sort = CLASS_NAME + "default_sort"; // 默认排序
|
||||
//
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
@ -48,7 +47,7 @@ private static final long serialVersionUID = 1L;
|
||||
//商品属性id
|
||||
private Long productPropertyId;
|
||||
//默认排序
|
||||
private Integer defalutSort;
|
||||
private Integer defaultSort;
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
@ -173,15 +172,15 @@ private static final long serialVersionUID = 1L;
|
||||
* 默认排序
|
||||
* @return
|
||||
*/
|
||||
public Integer getDefalutSort() {
|
||||
return defalutSort;
|
||||
public Integer getDefaultSort() {
|
||||
return defaultSort;
|
||||
}
|
||||
/**
|
||||
* 默认排序
|
||||
* @param defalutSort
|
||||
* @param defaultSort
|
||||
*/
|
||||
public void setDefalutSort(Integer defalutSort) {
|
||||
this.defalutSort = defalutSort;
|
||||
public void setDefaultSort(Integer defaultSort) {
|
||||
this.defaultSort = defaultSort;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -195,7 +194,7 @@ private static final long serialVersionUID = 1L;
|
||||
",productPropertyName=" + productPropertyName +
|
||||
",productPropertyValue=" + productPropertyValue +
|
||||
",productPropertyId=" + productPropertyId +
|
||||
",defalutSort=" + defalutSort +
|
||||
",defaultSort=" + defaultSort +
|
||||
"}";
|
||||
}
|
||||
}
|
||||
@ -48,7 +48,7 @@ public class MysqlMain_update {
|
||||
}
|
||||
List<TablesBean> list = new ArrayList<TablesBean>();
|
||||
|
||||
list.add(new TablesBean("vv_sku_property_value"));
|
||||
list.add(new TablesBean("vv_product_property_value"));
|
||||
|
||||
|
||||
Map<String, String> map = MysqlUtil2ShowCreateTable.getComments();
|
||||
|
||||
@ -5,10 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.heyu.api.alibaba.request.mm.VvProductDetailRequest;
|
||||
import com.heyu.api.alibaba.request.mm.VvProductRequest;
|
||||
import com.heyu.api.data.dao.vv.*;
|
||||
import com.heyu.api.data.dto.vv.VvCopyProductRequest;
|
||||
import com.heyu.api.data.dto.vv.VvProductDTO;
|
||||
import com.heyu.api.data.dto.vv.VvProductPropertyDTO;
|
||||
import com.heyu.api.data.dto.vv.VvSkuDTO;
|
||||
import com.heyu.api.data.dto.vv.*;
|
||||
import com.heyu.api.data.entity.vv.*;
|
||||
import com.heyu.api.data.utils.CollectionUtils;
|
||||
import com.heyu.api.data.utils.NumberUtil;
|
||||
@ -58,13 +55,6 @@ public class AdminProductController {
|
||||
private VvProductPropertyValueDao vvProductPropertyValueDao;
|
||||
|
||||
|
||||
@Autowired
|
||||
private VvCategoryPropertyDao vvCategoryPropertyDao;
|
||||
|
||||
|
||||
@Autowired
|
||||
private VvCategoryPropertyValueDao vvCategoryPropertyValueDao;
|
||||
|
||||
/***
|
||||
* 列表
|
||||
* http://localhost:8888/mm/product/list
|
||||
@ -226,6 +216,8 @@ public class AdminProductController {
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
// /mm/product/insertOrUpadate
|
||||
@RequestMapping("/insertOrUpadate")
|
||||
public R insertOrUpadate(@RequestBody VvProductDTO vvProductDTO) {
|
||||
vvProductDao.insertOrUpdateVvProduct(vvProductDTO);
|
||||
@ -300,7 +292,7 @@ public class AdminProductController {
|
||||
SanUtils.list2GroupBy(vvProductPropertyEntities, VvProductPropertyEntity::getId);
|
||||
for (VvProductPropertyEntity vvProductPropertyDb : vvProductPropertyEntities) {
|
||||
// 对他进行编辑
|
||||
if (CollectionUtils.notContainsKey(groupbyProductProperty,vvProductPropertyDb.getId())) {
|
||||
if (CollectionUtils.notContainsKey(groupbyProductProperty, vvProductPropertyDb.getId())) {
|
||||
vvProductPropertyDao.deleteVvProductPropertyRealById(vvProductPropertyDb.getId());
|
||||
vvProductPropertyValueDao.deleteVvProductPropertyValueRealByProductPropertyId(vvProductPropertyDb.getId());
|
||||
}
|
||||
@ -319,7 +311,7 @@ public class AdminProductController {
|
||||
if (productPropertyId != null) {
|
||||
List<VvProductPropertyValueEntity> productPropertyValueDb = vvProductPropertyValueDao.selectVvProductPropertyValueByProductIdPropertyId(productPropertyId);
|
||||
for (VvProductPropertyValueEntity vvProductPropertyValueEntity : productPropertyValueDb) {
|
||||
if (CollectionUtils.notContainsKey(groupbyProductPropertyValue,vvProductPropertyValueEntity.getId())) {
|
||||
if (CollectionUtils.notContainsKey(groupbyProductPropertyValue, vvProductPropertyValueEntity.getId())) {
|
||||
vvProductPropertyValueDao.deleteVvProductPropertyValueRealById(vvProductPropertyValueEntity.getId());
|
||||
}
|
||||
}
|
||||
@ -335,4 +327,33 @@ public class AdminProductController {
|
||||
}
|
||||
|
||||
|
||||
// // /mm/product/property/sort
|
||||
@RequestMapping("/property/sort")
|
||||
public R propertySort(@RequestBody VVAdminProductPropertyDTO dto) {
|
||||
List<VvProductPropertyEntity> list = vvProductPropertyDao.selectProductPropertyByIds(dto.getProductPropertyIds());
|
||||
List<Long> categoryIds = dto.getProductPropertyIds();
|
||||
for (VvProductPropertyEntity vvCategoryEntity : list) {
|
||||
int index = categoryIds.indexOf(vvCategoryEntity.getId()) + 1;
|
||||
vvCategoryEntity.setDefaultSort(index);
|
||||
vvProductPropertyDao.insertOrUpdateVvProductProperty(vvCategoryEntity);
|
||||
}
|
||||
return R.ok("排序成功");
|
||||
}
|
||||
|
||||
|
||||
// /mm/product/property/value/sort
|
||||
@RequestMapping("/property/value/sort")
|
||||
public R propertyValueSort(@RequestBody VVAdminProductPropertyValueDTO dto) {
|
||||
List<VvProductPropertyValueEntity> list = vvProductPropertyValueDao.selectProductPropertyValueByIds(dto.getProductPropertyValueIds());
|
||||
List<Long> categoryIds = dto.getProductPropertyValueIds();
|
||||
for (VvProductPropertyValueEntity vvCategoryEntity : list) {
|
||||
int index = categoryIds.indexOf(vvCategoryEntity.getId()) + 1;
|
||||
vvCategoryEntity.setDefaultSort(index);
|
||||
vvProductPropertyValueDao.insertOrUpdateVvProductPropertyValue(vvCategoryEntity);
|
||||
}
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user