소스 검색

新增产品规格管理

cxd 7 달 전
부모
커밋
f7170221d6

+ 12 - 0
gqy-admin/src/main/java/com/gqy/web/controller/document/ProductController.java

@@ -4,10 +4,12 @@ import com.gqy.common.core.domain.AjaxResult;
 import com.gqy.common.core.domain.AjaxResultCQY;
 import com.gqy.document.domain.vo.PageResult;
 import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.servlet.http.HttpServletRequest;
+import java.util.Map;
 
 
 /**
@@ -23,4 +25,14 @@ public class ProductController {
     public AjaxResultCQY search(HttpServletRequest request) {
         return AjaxResultCQY.success("查询成功", new PageResult());
     }
+
+
+    /**
+     * 添加产品
+     * @return
+     */
+    @PostMapping("/add")
+    public AjaxResultCQY add(@RequestBody Map maps) {
+        return AjaxResultCQY.success("添加成功");
+    }
 }

+ 154 - 0
gqy-system/src/main/java/com/gqy/document/domain/DcProduct.java

@@ -0,0 +1,154 @@
+package com.gqy.document.domain;
+
+import java.math.BigDecimal;
+
+/**
+ * 产品对象 dc_product
+ * 最新
+ */
+public class DcProduct {
+
+    /** 产品ID */
+    private Integer dcp_id;
+
+    /** 产品名称 */
+    private String dcp_name;
+
+    /** 产品型号 */
+    private String dcp_model;
+
+    /** 产品区分代码 */
+    private String dcp_diff;
+
+    /** 产品应用编码 */
+    private String dcp_p_no;
+
+    /** 状态 */
+    private Integer dcp_status;
+
+    /** 公开价 */
+    private BigDecimal dcp_price1;
+
+    /** 销售价 */
+    private BigDecimal dcp_price2;
+
+    /** 标准价 */
+    private BigDecimal dcp_price3;
+
+    /** 大客价 */
+    private BigDecimal dcp_price4;
+
+    /** 成本价 */
+    private BigDecimal dcp_cost_price;
+
+    /** 文档id */
+    private BigDecimal dcm_id;
+
+    /** OA编码 */
+    private String dcp_oa_code;
+
+
+    public Integer getDcp_id() {
+        return dcp_id;
+    }
+
+    public void setDcp_id(Integer dcp_id) {
+        this.dcp_id = dcp_id;
+    }
+
+    public String getDcp_name() {
+        return dcp_name;
+    }
+
+    public void setDcp_name(String dcp_name) {
+        this.dcp_name = dcp_name;
+    }
+
+    public String getDcp_model() {
+        return dcp_model;
+    }
+
+    public void setDcp_model(String dcp_model) {
+        this.dcp_model = dcp_model;
+    }
+
+    public String getDcp_diff() {
+        return dcp_diff;
+    }
+
+    public void setDcp_diff(String dcp_diff) {
+        this.dcp_diff = dcp_diff;
+    }
+
+    public String getDcp_p_no() {
+        return dcp_p_no;
+    }
+
+    public void setDcp_p_no(String dcp_p_no) {
+        this.dcp_p_no = dcp_p_no;
+    }
+
+    public Integer getDcp_status() {
+        return dcp_status;
+    }
+
+    public void setDcp_status(Integer dcp_status) {
+        this.dcp_status = dcp_status;
+    }
+
+    public BigDecimal getDcp_price1() {
+        return dcp_price1;
+    }
+
+    public void setDcp_price1(BigDecimal dcp_price1) {
+        this.dcp_price1 = dcp_price1;
+    }
+
+    public BigDecimal getDcp_price2() {
+        return dcp_price2;
+    }
+
+    public void setDcp_price2(BigDecimal dcp_price2) {
+        this.dcp_price2 = dcp_price2;
+    }
+
+    public BigDecimal getDcp_price3() {
+        return dcp_price3;
+    }
+
+    public void setDcp_price3(BigDecimal dcp_price3) {
+        this.dcp_price3 = dcp_price3;
+    }
+
+    public BigDecimal getDcp_price4() {
+        return dcp_price4;
+    }
+
+    public void setDcp_price4(BigDecimal dcp_price4) {
+        this.dcp_price4 = dcp_price4;
+    }
+
+    public BigDecimal getDcp_cost_price() {
+        return dcp_cost_price;
+    }
+
+    public void setDcp_cost_price(BigDecimal dcp_cost_price) {
+        this.dcp_cost_price = dcp_cost_price;
+    }
+
+    public BigDecimal getDcm_id() {
+        return dcm_id;
+    }
+
+    public void setDcm_id(BigDecimal dcm_id) {
+        this.dcm_id = dcm_id;
+    }
+
+    public String getDcp_oa_code() {
+        return dcp_oa_code;
+    }
+
+    public void setDcp_oa_code(String dcp_oa_code) {
+        this.dcp_oa_code = dcp_oa_code;
+    }
+}

+ 19 - 0
gqy-system/src/main/java/com/gqy/document/mapper/DcProductMapper.java

@@ -0,0 +1,19 @@
+package com.gqy.document.mapper;
+
+import com.gqy.document.domain.DcProduct;
+
+/**
+ * 产品对象 dc_product 最新
+ */
+public interface DcProductMapper {
+
+    /**
+     * 新增产品对象 dc_product
+     *
+     * @param dcProduct 产品对象 dc_product
+     * @return 结果
+     */
+    public int insertDcProduct(DcProduct dcProduct);
+
+
+}

+ 16 - 0
gqy-system/src/main/java/com/gqy/document/service/IDcProductService.java

@@ -0,0 +1,16 @@
+package com.gqy.document.service;
+
+import java.util.Map;
+
+/**
+ * 产品服务
+ */
+public interface IDcProductService {
+
+    /**
+     * 新增产品
+     * @param params
+     * @return
+     */
+    public int add(Map<String, Object> params);
+}

+ 38 - 0
gqy-system/src/main/java/com/gqy/document/service/impl/DcProductServiceImpl.java

@@ -0,0 +1,38 @@
+package com.gqy.document.service.impl;
+
+import com.gqy.common.utils.bean.BeanUtils;
+import com.gqy.document.domain.DcProduct;
+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.Map;
+
+/**
+ *  产品信息
+ */
+public class DcProductServiceImpl implements IDcProductService {
+
+    @Autowired
+    private DcProductMapper dcProductMapper;
+
+
+    /**
+     *
+     * @param params
+     * @return
+     */
+    public int add(Map<String, Object> params) {
+
+        DcProduct product = new DcProduct();
+        // 拷贝参数
+        BeanUtils.copyProperties(params, product);
+        // 保存
+        dcProductMapper.insertDcProduct(product);
+
+
+
+        return 0;
+    }
+}

+ 126 - 0
gqy-system/src/main/resources/mapper/document/DcProductMapper.xml

@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.gqy.document.mapper.DcProductMapper">
+
+    <resultMap type="DcProduct" id="DcProductResult">
+        <id     property="dcp_id"        column="dcp_id"         />
+        <result property="dcp_name"      column="dcp_name"       />
+        <result property="dcp_model"     column="dcp_model"      />
+        <result property="dcp_diff"      column="dcp_diff"       />
+        <result property="dcp_p_no"      column="dcp_p_no"       />
+        <result property="dcp_status"    column="dcp_status"     />
+        <result property="dcp_price1"    column="dcp_price1"     />
+        <result property="dcp_price2"    column="dcp_price2"     />
+        <result property="dcp_price3"    column="dcp_price3"     />
+        <result property="dcp_price4"    column="dcp_price4"     />
+        <result property="dcp_cost_price" column="dcp_cost_price" />
+        <result property="dcm_id"        column="dcm_id"         />
+        <result property="dcp_oa_code"   column="dcp_oa_code"    />
+    </resultMap>
+
+    <sql id="selectDcProductVo">
+        select dcp_id, dcp_name, dcp_model, dcp_diff, dcp_p_no, dcp_status,
+               dcp_price1, dcp_price2, dcp_price3, dcp_price4, dcp_cost_price, dcm_id,
+               dcp_oa_code, create_by, create_time, update_by, update_time
+        from dc_product
+    </sql>
+
+    <select id="selectDcProductList" parameterType="DcProduct" resultMap="DcProductResult">
+        <include refid="selectDcProductVo"/>
+        <where>
+            <if test="dcp_name != null  and dcp_name != ''">
+                AND dcp_name like concat('%', #{dcp_name}, '%')
+            </if>
+            <if test="dcp_model != null  and dcp_model != ''">
+                AND dcp_model = #{dcp_model}
+            </if>
+            <if test="dcp_diff != null  and dcp_diff != ''">
+                AND dcp_diff = #{dcp_diff}
+            </if>
+            <if test="dcp_p_no != null  and dcp_p_no != ''">
+                AND dcp_p_no = #{dcp_p_no}
+            </if>
+            <if test="dcp_status != null ">
+                AND dcp_status = #{dcp_status}
+            </if>
+            <if test="dcp_oa_code != null  and dcp_oa_code != ''">
+                AND dcp_oa_code = #{dcp_oa_code}
+            </if>
+        </where>
+    </select>
+
+    <select id="selectDcProductById" parameterType="Integer" resultMap="DcProductResult">
+        <include refid="selectDcProductVo"/>
+        where dcp_id = #{dcp_id}
+    </select>
+
+    <insert id="insertDcProduct" parameterType="DcProduct" useGeneratedKeys="true" keyProperty="dcp_id">
+        insert into dc_product
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="dcp_name != null">dcp_name,</if>
+            <if test="dcp_model != null">dcp_model,</if>
+            <if test="dcp_diff != null">dcp_diff,</if>
+            <if test="dcp_p_no != null">dcp_p_no,</if>
+            <if test="dcp_status != null">dcp_status,</if>
+            <if test="dcp_price1 != null">dcp_price1,</if>
+            <if test="dcp_price2 != null">dcp_price2,</if>
+            <if test="dcp_price3 != null">dcp_price3,</if>
+            <if test="dcp_price4 != null">dcp_price4,</if>
+            <if test="dcp_cost_price != null">dcp_cost_price,</if>
+            <if test="dcm_id != null">dcm_id,</if>
+            <if test="dcp_oa_code != null">dcp_oa_code,</if>
+            <if test="createBy != null">create_by,</if>
+            <if test="createTime != null">create_time,</if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="dcp_name != null">#{dcp_name},</if>
+            <if test="dcp_model != null">#{dcp_model},</if>
+            <if test="dcp_diff != null">#{dcp_diff},</if>
+            <if test="dcp_p_no != null">#{dcp_p_no},</if>
+            <if test="dcp_status != null">#{dcp_status},</if>
+            <if test="dcp_price1 != null">#{dcp_price1},</if>
+            <if test="dcp_price2 != null">#{dcp_price2},</if>
+            <if test="dcp_price3 != null">#{dcp_price3},</if>
+            <if test="dcp_price4 != null">#{dcp_price4},</if>
+            <if test="dcp_cost_price != null">#{dcp_cost_price},</if>
+            <if test="dcm_id != null">#{dcm_id},</if>
+            <if test="dcp_oa_code != null">#{dcp_oa_code},</if>
+            <if test="createBy != null">#{createBy},</if>
+            <if test="createTime != null">#{createTime},</if>
+        </trim>
+    </insert>
+
+    <update id="updateDcProduct" parameterType="DcProduct">
+        update dc_product
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="dcp_name != null">dcp_name = #{dcp_name},</if>
+            <if test="dcp_model != null">dcp_model = #{dcp_model},</if>
+            <if test="dcp_diff != null">dcp_diff = #{dcp_diff},</if>
+            <if test="dcp_p_no != null">dcp_p_no = #{dcp_p_no},</if>
+            <if test="dcp_status != null">dcp_status = #{dcp_status},</if>
+            <if test="dcp_price1 != null">dcp_price1 = #{dcp_price1},</if>
+            <if test="dcp_price2 != null">dcp_price2 = #{dcp_price2},</if>
+            <if test="dcp_price3 != null">dcp_price3 = #{dcp_price3},</if>
+            <if test="dcp_price4 != null">dcp_price4 = #{dcp_price4},</if>
+            <if test="dcp_cost_price != null">dcp_cost_price = #{dcp_cost_price},</if>
+            <if test="dcm_id != null">dcm_id = #{dcm_id},</if>
+            <if test="dcp_oa_code != null">dcp_oa_code = #{dcp_oa_code},</if>
+            <if test="updateBy != null">update_by = #{updateBy},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+        </trim>
+        where dcp_id = #{dcp_id}
+    </update>
+
+    <delete id="deleteDcProductById" parameterType="Integer">
+        delete from dc_product where dcp_id = #{dcp_id}
+    </delete>
+
+    <delete id="deleteDcProductByIds" parameterType="String">
+        delete from dc_product where dcp_id in
+        <foreach item="dcp_id" collection="array" open="(" separator="," close=")">
+            #{dcp_id}
+        </foreach>
+    </delete>
+</mapper>

+ 17 - 0
创建表语句.txt

@@ -368,6 +368,23 @@ CREATE TABLE `dc_ps_param` (
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='产品参数表';
 
 
+------ 创建产品表
+CREATE TABLE `dc_product` (
+  `dcp_id` int(10) NOT NULL AUTO_INCREMENT COMMENT '产品ID',
+  `dcp_name` varchar(255) DEFAULT NULL COMMENT '产品名称',
+  `dcp_model` varchar(255) DEFAULT NULL COMMENT '产品型号',
+  `dcp_diff` varchar(50) DEFAULT NULL COMMENT '产品区分代码',
+  `dcp_p_no` varchar(50) DEFAULT NULL COMMENT '产品应用编码',
+  `dcp_status` smallint(5) DEFAULT '0' COMMENT '状态',
+  `dcp_price1` decimal(16,6) DEFAULT '0' COMMENT '公开价',
+  `dcp_price2` decimal(16,6) DEFAULT '0' COMMENT '销售价',
+  `dcp_price3` decimal(16,6) DEFAULT '0' COMMENT '标准价',
+  `dcp_price4` decimal(16,6) DEFAULT '0' COMMENT '大客价',
+  `dcp_cost_price` decimal(16,6) DEFAULT '0' COMMENT '成本价',
+  `dcm_id` decimal(16,6) DEFAULT NULL COMMENT '文档id',
+  `dcp_oa_code` varchar(50) DEFAULT NULL COMMENT 'OA编码',
+  PRIMARY KEY (`dcp_id`)
+) COMMENT='产品表';