提交修改
This commit is contained in:
parent
f802b9d211
commit
274536dc03
@ -10,6 +10,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.OrderBy;
|
||||
import com.lz.mybatis.plugin.annotations.Realy;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@ -41,5 +42,7 @@ public interface VvProductPropertyDao extends BaseMapper<VvProductPropertyEntity
|
||||
List<VvProductPropertyEntity> selectVvProductPropertyByProductId(Long productId);
|
||||
|
||||
|
||||
|
||||
@Realy
|
||||
int deleteVvProductPropertyRealById(@Param("id")Long id);
|
||||
}
|
||||
@ -1,15 +1,17 @@
|
||||
package com.heyu.api.data.dao.vv;
|
||||
/**
|
||||
* <p>
|
||||
* sku 与属性的对应关系 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author quyixiao
|
||||
* @since 2025-08-22
|
||||
*/
|
||||
* <p>
|
||||
* sku 与属性的对应关系 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author quyixiao
|
||||
* @since 2025-08-22
|
||||
*/
|
||||
|
||||
import com.heyu.api.data.entity.vv.VvProductPropertyValueEntity;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.lz.mybatis.plugin.annotations.OrderBy;
|
||||
import com.lz.mybatis.plugin.annotations.Realy;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@ -19,27 +21,31 @@ import java.util.List;
|
||||
public interface VvProductPropertyValueDao extends BaseMapper<VvProductPropertyValueEntity> {
|
||||
|
||||
|
||||
VvProductPropertyValueEntity selectVvProductPropertyValueById(@Param("id")Long id);
|
||||
VvProductPropertyValueEntity selectVvProductPropertyValueById(@Param("id") Long id);
|
||||
|
||||
|
||||
Long insertVvProductPropertyValue(VvProductPropertyValueEntity vvProductPropertyValue);
|
||||
Long insertVvProductPropertyValue(VvProductPropertyValueEntity vvProductPropertyValue);
|
||||
|
||||
|
||||
Long insertOrUpdateVvProductPropertyValue(VvProductPropertyValueEntity vvProductPropertyValue);
|
||||
Long insertOrUpdateVvProductPropertyValue(VvProductPropertyValueEntity vvProductPropertyValue);
|
||||
|
||||
|
||||
int updateVvProductPropertyValueById(VvProductPropertyValueEntity vvProductPropertyValue);
|
||||
int updateVvProductPropertyValueById(VvProductPropertyValueEntity vvProductPropertyValue);
|
||||
|
||||
|
||||
int updateCoverVvProductPropertyValueById(VvProductPropertyValueEntity vvProductPropertyValue);
|
||||
int updateCoverVvProductPropertyValueById(VvProductPropertyValueEntity vvProductPropertyValue);
|
||||
|
||||
|
||||
int deleteVvProductPropertyValueById(@Param("id")Long id);
|
||||
int deleteVvProductPropertyValueById(@Param("id") Long id);
|
||||
|
||||
|
||||
@OrderBy(VvProductPropertyValueEntity.defalut_sort)
|
||||
List<VvProductPropertyValueEntity> selectVvProductPropertyValueByProductIdPropertyId(Long productId, Long propertyId);
|
||||
@OrderBy(VvProductPropertyValueEntity.defalut_sort)
|
||||
List<VvProductPropertyValueEntity> selectVvProductPropertyValueByProductIdPropertyId(Long productId, Long propertyId);
|
||||
|
||||
|
||||
int deleteVvProductPropertyValueRealById(Long id);
|
||||
int deleteVvProductPropertyValueRealById(Long id);
|
||||
|
||||
|
||||
@Realy
|
||||
int deleteVvProductPropertyValueRealByProductPropertyId(Long productPropertyId);
|
||||
}
|
||||
@ -21,15 +21,16 @@ private static final long serialVersionUID = 1L;
|
||||
public final static String CLASS_NAME ="com.heyu.api.data.entity.vv.VvProductPropertyValueEntity:";
|
||||
|
||||
public final static String all = CLASS_NAME + "*";
|
||||
public final static String id_ = CLASS_NAME + "id"; //
|
||||
public final static String is_delete = CLASS_NAME + "is_delete"; // 是否删除:0 否 1 删除
|
||||
public final static String create_time = CLASS_NAME + "create_time"; // 创建时间
|
||||
public final static String modify_time = CLASS_NAME + "modify_time"; // 修改时间
|
||||
public final static String product_id = CLASS_NAME + "product_id"; // skuid
|
||||
public final static String property_name = CLASS_NAME + "property_name"; // 属性名称
|
||||
public final static String property_value = CLASS_NAME + "property_value"; // 属性id
|
||||
public final static String defalut_sort = CLASS_NAME + "defalut_sort"; // 默认排序
|
||||
public final static String property_id = CLASS_NAME + "property_id"; // 属性id
|
||||
public final static String id_ = CLASS_NAME + "id"; //
|
||||
public final static String is_delete = CLASS_NAME + "is_delete"; // 是否删除:0 否 1 删除
|
||||
public final static String create_time = CLASS_NAME + "create_time"; // 创建时间
|
||||
public final static String modify_time = CLASS_NAME + "modify_time"; // 修改时间
|
||||
public final static String product_id = CLASS_NAME + "product_id"; // skuid
|
||||
public final static String property_name = CLASS_NAME + "property_name"; // 属性名称
|
||||
public final static String property_value = CLASS_NAME + "property_value"; // 属性id
|
||||
public final static String defalut_sort = CLASS_NAME + "defalut_sort"; // 默认排序
|
||||
public final static String property_id = CLASS_NAME + "property_id"; // 属性id
|
||||
public final static String product_property_id = CLASS_NAME + "product_property_id"; // 商品属性id
|
||||
//
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
@ -49,6 +50,8 @@ private static final long serialVersionUID = 1L;
|
||||
private Integer defalutSort;
|
||||
//属性id
|
||||
private Long propertyId;
|
||||
//商品属性id
|
||||
private Long productPropertyId;
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
@ -184,6 +187,21 @@ private static final long serialVersionUID = 1L;
|
||||
this.propertyId = propertyId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品属性id
|
||||
* @return
|
||||
*/
|
||||
public Long getProductPropertyId() {
|
||||
return productPropertyId;
|
||||
}
|
||||
/**
|
||||
* 商品属性id
|
||||
* @param productPropertyId
|
||||
*/
|
||||
public void setProductPropertyId(Long productPropertyId) {
|
||||
this.productPropertyId = productPropertyId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "VvProductPropertyValueEntity{" +
|
||||
@ -196,6 +214,7 @@ private static final long serialVersionUID = 1L;
|
||||
",propertyValue=" + propertyValue +
|
||||
",defalutSort=" + defalutSort +
|
||||
",propertyId=" + propertyId +
|
||||
",productPropertyId=" + productPropertyId +
|
||||
"}";
|
||||
}
|
||||
}
|
||||
@ -139,10 +139,6 @@ public class ProductController {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@RequestMapping("/insertOrUpadate")
|
||||
public R insertOrUpadate(VvProductDTO vvProductDTO) {
|
||||
|
||||
@ -172,7 +168,6 @@ public class ProductController {
|
||||
vvProductDetailDao.insertOrUpdateVvProductDetail(vvProductDetailEntity);
|
||||
}
|
||||
|
||||
|
||||
List<VvSkuDTO> vvSkuDTOS = vvProductDTO.getVvSkuList();
|
||||
|
||||
List<VvSkuEntity> vvSkuEntities = vvSkuDao.selectVvSkuByProductId(productId);
|
||||
@ -190,23 +185,16 @@ public class ProductController {
|
||||
}
|
||||
|
||||
for (VvSkuDTO vvSkuDTO : vvSkuDTOS) {
|
||||
|
||||
Long skuId = vvSkuDTO.getId() ;
|
||||
|
||||
vvSkuDao.insertOrUpdateVvSku(vvSkuDTO);
|
||||
|
||||
/***
|
||||
* 插入
|
||||
*/
|
||||
if(skuId == null){
|
||||
List<VvSkuPropertyValueEntity> vvSkuPropertyValueEntities = vvSkuDTO.getVvSkuPropertyValueList();
|
||||
for (VvSkuPropertyValueEntity vvSkuPropertyValueEntity : vvSkuPropertyValueEntities) {
|
||||
vvSkuPropertyValueEntity.setSkuId(vvSkuDTO.getId());
|
||||
vvSkuPropertyValueDao.insertOrUpdateVvSkuPropertyValue(vvSkuPropertyValueEntity);
|
||||
}
|
||||
}else{ // 更新
|
||||
if(skuId != null){
|
||||
// 更新
|
||||
List<VvSkuPropertyValueEntity> vvSkuPropertyValueEntities = vvSkuDTO.getVvSkuPropertyValueList();
|
||||
List<VvSkuPropertyValueEntity> vvSkuPropertyValueDB = vvSkuPropertyValueDao.selectVvSkuPropertyValueBySkuId(vvSkuDTO.getId());
|
||||
|
||||
for (VvSkuPropertyValueEntity vvSkuPropertyValueDb : vvSkuPropertyValueDB) {
|
||||
boolean flag = true;
|
||||
for (VvSkuPropertyValueEntity skuPropertyValueEntity : vvSkuPropertyValueEntities) {
|
||||
@ -218,19 +206,18 @@ public class ProductController {
|
||||
if (flag) {
|
||||
vvSkuPropertyValueDao.deleteVvSkuPropertyValueRealById(vvSkuPropertyValueDb.getId());
|
||||
}
|
||||
|
||||
for (VvSkuPropertyValueEntity vvSkuPropertyValueEntity : vvSkuPropertyValueEntities) {
|
||||
vvSkuPropertyValueDao.insertOrUpdateVvSkuPropertyValue(vvSkuPropertyValueEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
List<VvSkuPropertyValueEntity> vvSkuPropertyValueEntities = vvSkuDTO.getVvSkuPropertyValueList();
|
||||
for (VvSkuPropertyValueEntity vvSkuPropertyValueEntity : vvSkuPropertyValueEntities) {
|
||||
vvSkuPropertyValueEntity.setSkuId(vvSkuDTO.getId());
|
||||
vvSkuPropertyValueDao.insertOrUpdateVvSkuPropertyValue(vvSkuPropertyValueEntity);
|
||||
}
|
||||
}
|
||||
|
||||
List<VvProductPropertyDTO> vvProductPropertyDTOS = vvProductDTO.getVvProductPropertyList();
|
||||
|
||||
List<VvProductPropertyEntity> vvProductPropertyEntities = vvProductPropertyDao.selectVvProductPropertyByProductId(productId);
|
||||
|
||||
|
||||
for (VvProductPropertyEntity vvProductPropertyDb: vvProductPropertyEntities) {
|
||||
boolean flag = true;
|
||||
for (VvProductPropertyDTO vvProductPropertyDTO : vvProductPropertyDTOS) {
|
||||
@ -240,14 +227,12 @@ public class ProductController {
|
||||
}
|
||||
if (flag) {
|
||||
vvProductPropertyDao.deleteVvProductPropertyRealById(vvProductPropertyDb.getId());
|
||||
vvProductPropertyValueDao.deleteVvProductPropertyValueRealByProductPropertyId(vvProductPropertyDb.getId());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (VvProductPropertyDTO vvProductPropertyDTO : vvProductPropertyDTOS) {
|
||||
|
||||
Long productPropertyId = vvProductPropertyDTO.getId();
|
||||
|
||||
vvProductPropertyDao.insertOrUpdateVvProductProperty(vvProductPropertyDTO);
|
||||
List<VvProductPropertyValueEntity> vvProductPropertyValueEntities = vvProductPropertyDTO.getVvProductPropertyValueList();
|
||||
if(productPropertyId != null){
|
||||
@ -259,14 +244,14 @@ public class ProductController {
|
||||
flag = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
vvProductPropertyValueDao.deleteVvProductPropertyValueRealById(vvProductPropertyValueEntity.getId());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
for (VvProductPropertyValueEntity vvProductPropertyValueEntity : vvProductPropertyValueEntities) {
|
||||
vvProductPropertyValueEntity.setProductPropertyId(vvProductPropertyDTO.getId());
|
||||
vvProductPropertyValueDao.insertOrUpdateVvProductPropertyValue(vvProductPropertyValueEntity);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user