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