浏览代码

代码提交

cxd 6 月之前
父节点
当前提交
2621ac63d7

+ 1 - 0
gqy-admin/src/main/java/com/gqy/web/controller/document/DcSpecController.java

@@ -73,6 +73,7 @@ public class DcSpecController  extends BaseController {
     public List<Map<String, Object>> getDcSpecList(){
         Map maps = new HashMap();
         maps.put("ps_category","全部");
+        maps.put("ps_p_id",0);
         List<Map<String, Object>> list =  iDcSpecService.selectDcPsParamAndSpec(maps);
         return list;
     }

+ 33 - 0
gqy-system/src/main/java/com/gqy/document/domain/DcPsParam.java

@@ -24,10 +24,43 @@ public class DcPsParam extends BaseEntity {
     /** 文档块id */
     private Integer dcb_id;
 
+    /** 输入类型 */
+    private String psp_type;
+
+    /** 输入值 */
+    private String psp_input_value;
+
+
+    private String psp_category;
+
 
     /** 状态 */
     private Integer psp_status;
 
+    public String getPsp_category() {
+        return psp_category;
+    }
+    public void setPsp_category(String psp_category) {
+        this.psp_category = psp_category;
+    }
+
+
+
+    public String getPsp_type() {
+        return psp_type;
+    }
+    public void setPsp_type(String psp_type) {
+        this.psp_type = psp_type;
+    }
+
+    public String getPsp_input_value() {
+        return psp_input_value;
+    }
+
+    public void setPsp_input_value(String psp_input_value) {
+        this.psp_input_value = psp_input_value;
+    }
+
     public Integer getPsp_status() {
         return psp_status;
     }

+ 1 - 8
gqy-system/src/main/java/com/gqy/document/domain/DcSpec.java

@@ -29,8 +29,7 @@ public class DcSpec extends BaseEntity {
     @Excel(name = "文档块id")
     private Integer dcb_id;
 
-    /** 所属分类*/
-    private String ps_category;
+
 
     public Integer getPs_id() {
         return ps_id;
@@ -72,11 +71,5 @@ public class DcSpec extends BaseEntity {
         this.dcb_id = dcb_id;
     }
 
-    public String getPs_category() {
-        return ps_category;
-    }
 
-    public void setPs_category(String ps_category) {
-        this.ps_category = ps_category;
-    }
 }

+ 28 - 8
gqy-system/src/main/java/com/gqy/document/service/impl/DcProductServiceImpl.java

@@ -1,15 +1,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.domain.DcSystemProduct;
-import com.gqy.document.domain.DcWorkSystem;
+import com.gqy.document.domain.*;
 import com.gqy.document.mapper.DcProductMapper;
 import com.gqy.document.mapper.DcSpecMapper;
 import com.gqy.document.mapper.DcSystemProductMapper;
 import com.gqy.document.mapper.DcWorkSystemMapper;
 import com.gqy.document.service.IDcProductService;
+import com.gqy.system.mapper.DcPsParamMapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -33,6 +31,13 @@ public class DcProductServiceImpl implements IDcProductService {
     private DcSystemProductMapper dcSystemProductMapper;
 
 
+    @Autowired
+    private DcSpecMapper dcSpecMapper;
+
+    @Autowired
+    private DcPsParamMapper dcPsParamMapper;
+
+
     /**
      * 查询所有参数名称
      * @param params
@@ -83,13 +88,28 @@ public class DcProductServiceImpl implements IDcProductService {
 
             // 规格管理
             List<Map> specs = (List<Map>) params.get("specs");
-            for (Map spec : specs) {
+            for (Map maps : specs) {
                 // 规格
+
+
+
+                //保存规格信息表
                 DcSpec dcSpec = new DcSpec();
-                //设置 产品id
                 dcSpec.setPs_p_id(dcpId);
-                // 拷贝参数
-                BeanUtils.mapToBean(spec, dcSpec);
+                BeanUtils.mapToBean(maps,dcSpec );
+                String ps_no = maps.get("ps_no").toString();
+                dcSpec.setPs_no(ps_no);
+                dcSpec.setPs_name(maps.get("ps_name").toString());
+                //dcSpec.setPs_category(maps.get("ps_category").toString());
+
+                dcSpecMapper.insertDcSpec(dcSpec);
+
+                //规格参数
+                DcPsParam dcPsParam = new DcPsParam();
+                BeanUtils.mapToBean(maps,dcPsParam );
+                dcPsParam.setPsp_mode(ps_no);
+
+                dcPsParamMapper.insertDcPsParam(dcPsParam);
 
 
 

+ 15 - 8
gqy-system/src/main/java/com/gqy/document/service/impl/DcSpecServiceImpl.java

@@ -92,19 +92,26 @@ public class DcSpecServiceImpl implements IDcSpecService {
             //保存规格信息表
             DcSpec dcSpec = new DcSpec();
             String ps_no = maps.get("ps_no").toString();
-            dcSpec.setPs_no(ps_no);
-            dcSpec.setPs_name(maps.get("ps_name").toString());
-         //   dcSpec.setPs_status(Integer.valueOf(UserStatus.OK.getCode()));
-            dcSpec.setPs_category(maps.get("ps_category").toString());
+//            dcSpec.setPs_no(ps_no);
+//            dcSpec.setPs_name(maps.get("ps_name").toString());
+//         //   dcSpec.setPs_status(Integer.valueOf(UserStatus.OK.getCode()));
+//            dcSpec.setPs_category(maps.get("ps_category").toString());
+
+            BeanUtils.mapToBean(maps,dcSpec );
+
             dcSpecMapper.insertDcSpec(dcSpec);
 
             //规格参数
             DcPsParam dcPsParam = new DcPsParam();
+//            dcPsParam.setPsp_mode(ps_no);
+//            String psp_name = maps.get("psp_name").toString();
+//            dcPsParam.setPsp_name(psp_name);
+//            String psp_value = maps.get("psp_value").toString();
+//            dcPsParam.setPsp_value(psp_value);
+
+            BeanUtils.mapToBean(maps,dcPsParam );
             dcPsParam.setPsp_mode(ps_no);
-            String psp_name = maps.get("psp_name").toString();
-            dcPsParam.setPsp_name(psp_name);
-            String psp_value = maps.get("psp_value").toString();
-            dcPsParam.setPsp_value(psp_value);
+
             dcPsParamMapper.insertDcPsParam(dcPsParam);
 
             return  1;

+ 6 - 3
gqy-system/src/main/resources/mapper/document/DcProductMapper.xml

@@ -41,10 +41,13 @@
         p.dcp_oa_code,
         p.dcp_p_no,
         p.dcp_name,
-        p.dcp_model,
-        <foreach item="paramName" collection="paramNames" separator=",">
+        p.dcp_model
+        <if test="paramNames != null and paramNames.size() > 0">
+            ,<foreach item="paramName" collection="paramNames" separator=",">
             MAX(CASE WHEN param.psp_name = #{paramName} THEN param.psp_input_value END) as "${paramName}"
-        </foreach>
+            </foreach>
+        </if>
+
         FROM
         dc_product p
         LEFT JOIN dc_p_spec spec ON p.dcp_id = spec.ps_p_id

+ 13 - 3
gqy-system/src/main/resources/mapper/document/DcPsParamMapper.xml

@@ -11,6 +11,7 @@
         <result property="psp_value" column="psp_value" />
         <result property="dcb_id"    column="dcb_id"    />
         <result property="psp_status" column="psp_status"/>
+        <result property="psp_type" column="psp_type" />
     </resultMap>
 
 
@@ -21,12 +22,13 @@
         SELECT
         p.psp_name,
         p.psp_value,
+        p.psp_type,
         s.ps_id,
         s.ps_p_id,
         s.ps_no,
         s.ps_name,
         s.dcb_id,
-        s.ps_category
+        p.psp_category
         FROM dc_ps_param p
         LEFT JOIN dc_p_spec s ON p.psp_mode = s.ps_no
         <where>
@@ -36,12 +38,16 @@
             <if test="ps_no != null and ps_no != ''">
                 AND s.ps_no like concat('%', #{ps_no}, '%')
             </if>
-            <if test="ps_category != null and ps_category != ''">
-                AND s.ps_category = #{ps_category}
+            <if test="psp_category != null and psp_category != ''">
+                AND s.psp_category = #{psp_category}
             </if>
             <if test="psp_name != null and psp_name != ''">
                 AND p.psp_name like concat('%', #{psp_name}, '%')
             </if>
+
+            <if test="ps_p_id != null and ps_p_id != ''">
+                and s.ps_p_id = #{ps_p_id}
+            </if>
         </where>
     </select>
 
@@ -74,6 +80,8 @@
             <if test="psp_value != null">psp_value,</if>
             <if test="dcb_id != null">dcb_id,</if>
             <if test="psp_status != null">psp_status,</if>
+            <if test="psp_type != null">psp_type,</if>
+            <if test="psp_category != null">psp_category,</if>
 
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
@@ -82,6 +90,8 @@
             <if test="psp_value != null">#{psp_value},</if>
             <if test="dcb_id != null">#{dcb_id},</if>
             <if test="psp_status != null">#{psp_status},</if>
+            <if test="psp_type != null">#{psp_type},</if>
+            <if test="psp_category != null">psp_category,</if>
 
         </trim>
     </insert>

+ 0 - 4
gqy-system/src/main/resources/mapper/document/DcSpecMapper.xml

@@ -7,9 +7,7 @@
         <result property="ps_p_id"   column="ps_p_id"   />
         <result property="ps_no"     column="ps_no"     />
         <result property="ps_name"   column="ps_name"   />
-        <result property="ps_category" column="ps_category" />
         <result property="dcb_id" column="dcb_id" />
-
     </resultMap>
 
     <sql id="selectDcSpecVo">
@@ -24,7 +22,6 @@
             <if test="ps_no != null and ps_no != ''">ps_no,</if>
             <if test="ps_name != null and ps_name != ''">ps_name,</if>
             <if test="dcb_id != null">dcb_id,</if>
-            <if test="ps_category != null">ps_category,</if>
 
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
@@ -32,7 +29,6 @@
             <if test="ps_no != null and ps_no != ''">#{ps_no},</if>
             <if test="ps_name != null and ps_name != ''">#{ps_name},</if>
             <if test="dcb_id != null">#{dcb_id},</if>
-            <if test="ps_category != null">#{ps_category},</if>
         </trim>
     </insert>