cxd před 7 měsíci
rodič
revize
cd31f91031

+ 9 - 7
gqy-system/src/main/java/com/gqy/document/domain/DcSpec.java

@@ -15,7 +15,7 @@ public class DcSpec extends BaseEntity {
 
     /** 产品表主键 */
     @Excel(name = "产品表主键")
-    private String ps_p_id;
+    private Integer ps_p_id;
 
     /** 规格编号 */
     @Excel(name = "规格编号")
@@ -60,13 +60,7 @@ public class DcSpec extends BaseEntity {
         this.ps_id = ps_id;
     }
 
-    public String getPs_p_id() {
-        return ps_p_id;
-    }
 
-    public void setPs_p_id(String ps_p_id) {
-        this.ps_p_id = ps_p_id;
-    }
 
     public String getPs_no() {
         return ps_no;
@@ -89,4 +83,12 @@ public class DcSpec extends BaseEntity {
     public void setPs_dck_id(Integer ps_dck_id) {
         this.ps_dck_id = ps_dck_id;
     }
+
+    public Integer getPs_p_id() {
+        return ps_p_id;
+    }
+
+    public void setPs_p_id(Integer ps_p_id) {
+        this.ps_p_id = ps_p_id;
+    }
 }

+ 16 - 2
gqy-system/src/main/java/com/gqy/document/service/impl/DcProductServiceImpl.java

@@ -2,11 +2,13 @@ package com.gqy.document.service.impl;
 
 import com.gqy.common.utils.bean.BeanUtils;
 import com.gqy.document.domain.DcProduct;
+import com.gqy.document.domain.DcSpec;
 import com.gqy.document.mapper.DcProductMapper;
 import com.gqy.document.mapper.DcSpecMapper;
 import com.gqy.document.service.IDcProductService;
 import org.springframework.beans.factory.annotation.Autowired;
 
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -30,8 +32,20 @@ public class DcProductServiceImpl implements IDcProductService {
         BeanUtils.copyProperties(params, product);
         // 保存
         dcProductMapper.insertDcProduct(product);
-
-
+        // 产品id
+        int dcpId = product.getDcp_id();
+
+        // 规格管理
+        List<Map> specs = (List<Map>) params.get("specs");
+        for (Map spec : specs) {
+            // 规格
+            DcSpec dcSpec = new DcSpec();
+            //设置 产品id
+            dcSpec.setPs_p_id(dcpId);
+            // 拷贝参数
+            BeanUtils.copyProperties(spec, dcSpec);
+
+        }
 
         return 0;
     }