feat(sip): 项目产品信息增加明细展示

- 在 ProjectProductInfo 类中添加了产品 BOM 编码、型号、描述、价格等字段
- 更新了 ProjectProductInfoMapper.xml 文件,增加了新字段的映射
- 修改了相关 SQL 语句,以支持新增的字段查询和插入
master
chenhao 2025-06-04 10:23:17 +08:00
parent 4c24430399
commit b9eef1f522
3 changed files with 100 additions and 20 deletions

View File

@ -20,7 +20,7 @@ import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* Controller
*
*
* @author ruoyi
* @date 2025-05-29

View File

@ -1,5 +1,6 @@
package com.ruoyi.sip.domain;
import java.math.BigDecimal;
import java.util.List;
import lombok.Data;
@ -12,7 +13,7 @@ import com.ruoyi.common.core.domain.BaseEntity;
* project_product_info
*
* @author ruoyi
* @date 2025-05-29
* @date 2025-06-04
*/
@Data
public class ProjectProductInfo extends BaseEntity
@ -28,14 +29,46 @@ public class ProjectProductInfo extends BaseEntity
/** 产品编码 */
@Excel(name = "产品编码")
private String productCode;
/** 数量 */
@Excel(name = "数量")
private Long quantity;
private String type;
private String productBomCode;
/** 产品型号 */
@Excel(name = "产品型号")
private String model;
/** 产品代码 */
@Excel(name = "产品代码")
private String productCode;
/** 产品描述 */
@Excel(name = "产品描述")
private String productDesc;
/** 产品数量 */
@Excel(name = "产品数量")
private Long quantity;
/** 目录单价 */
@Excel(name = "目录单价")
private BigDecimal cataloguePrice;
/** 目录总价 */
@Excel(name = "目录总价")
private BigDecimal catalogueAllPrice;
/** 单价 */
@Excel(name = "单价")
private BigDecimal price;
/** 总价 */
@Excel(name = "总价")
private BigDecimal allPrice;
/** 指导折扣 */
@Excel(name = "指导折扣")
private BigDecimal guidanceDiscount;
/** 折扣 */
@Excel(name = "折扣")
private BigDecimal discount;
}

View File

@ -7,21 +7,39 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="ProjectProductInfo" id="ProjectProductInfoResult">
<result property="id" column="id" />
<result property="projectId" column="project_id" />
<result property="productBomCode" column="product_bom_code" />
<result property="model" column="model" />
<result property="productCode" column="product_code" />
<result property="productDesc" column="product_desc" />
<result property="quantity" column="quantity" />
<result property="cataloguePrice" column="catalogue_price" />
<result property="catalogueAllPrice" column="catalogue_all_price" />
<result property="price" column="price" />
<result property="allPrice" column="all_price" />
<result property="guidanceDiscount" column="guidance_discount" />
<result property="discount" column="discount" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectProjectProductInfoVo">
select id, project_id, product_code, quantity, remark from project_product_info
select id, project_id, product_bom_code, model, product_code, product_desc, quantity, catalogue_price, catalogue_all_price, price, all_price, guidance_discount, discount, remark from project_product_info
</sql>
<select id="selectProjectProductInfoList" parameterType="ProjectProductInfo" resultMap="ProjectProductInfoResult">
<include refid="selectProjectProductInfoVo"/>
<where>
<if test="projectId != null "> and project_id = #{projectId}</if>
<if test="productBomCode != null and productBomCode != ''"> and product_bom_code = #{productBomCode}</if>
<if test="model != null and model != ''"> and model = #{model}</if>
<if test="productCode != null and productCode != ''"> and product_code = #{productCode}</if>
<if test="productDesc != null and productDesc != ''"> and product_desc = #{productDesc}</if>
<if test="quantity != null "> and quantity = #{quantity}</if>
<if test="cataloguePrice != null "> and catalogue_price = #{cataloguePrice}</if>
<if test="catalogueAllPrice != null "> and catalogue_all_price = #{catalogueAllPrice}</if>
<if test="price != null "> and price = #{price}</if>
<if test="allPrice != null "> and all_price = #{allPrice}</if>
<if test="guidanceDiscount != null "> and guidance_discount = #{guidanceDiscount}</if>
<if test="discount != null "> and discount = #{discount}</if>
</where>
</select>
@ -30,43 +48,72 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id}
</select>
<select id="selectProjectProductInfoListByProjectId" resultType="com.ruoyi.sip.domain.ProjectProductInfo">
select t1.id, t1.project_id, t1.product_code, t1.quantity, t1.remark
,t2.type,t2.model
from project_product_info t1
left join product_info t2 on t1.product_code=t2.product_code
where t1.project_id=#{projectId}
order by t2.type
<include refid="selectProjectProductInfoVo"/>
where project_id = #{projectId}
</select>
<insert id="insertProjectProductInfo" parameterType="ProjectProductInfo" useGeneratedKeys="true" keyProperty="id">
insert into project_product_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="projectId != null">project_id,</if>
<if test="productBomCode != null and productBomCode != ''">product_bom_code,</if>
<if test="model != null">model,</if>
<if test="productCode != null">product_code,</if>
<if test="productDesc != null">product_desc,</if>
<if test="quantity != null">quantity,</if>
<if test="cataloguePrice != null">catalogue_price,</if>
<if test="catalogueAllPrice != null">catalogue_all_price,</if>
<if test="price != null">price,</if>
<if test="allPrice != null">all_price,</if>
<if test="guidanceDiscount != null">guidance_discount,</if>
<if test="discount != null">discount,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="projectId != null">#{projectId},</if>
<if test="productBomCode != null and productBomCode != ''">#{productBomCode},</if>
<if test="model != null">#{model},</if>
<if test="productCode != null">#{productCode},</if>
<if test="productDesc != null">#{productDesc},</if>
<if test="quantity != null">#{quantity},</if>
<if test="cataloguePrice != null">#{cataloguePrice},</if>
<if test="catalogueAllPrice != null">#{catalogueAllPrice},</if>
<if test="price != null">#{price},</if>
<if test="allPrice != null">#{allPrice},</if>
<if test="guidanceDiscount != null">#{guidanceDiscount},</if>
<if test="discount != null">#{discount},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<insert id="saveBatch">
insert into project_product_info (project_id, product_code, quantity, remark) values
<foreach item="item" index="index" collection="list" separator=",">
(#{item.projectId}, #{item.productCode}, #{item.quantity}, #{item.remark})
insert into project_product_info (project_id, product_bom_code, model, product_code, product_desc, quantity,
catalogue_price, catalogue_all_price, price, all_price, guidance_discount, discount, remark) values
<foreach collection="list" item="item" separator=",">
(#{item.projectId}, #{item.productBomCode}, #{item.model}, #{item.productCode}, #{item.productDesc},
#{item.quantity}, #{item.cataloguePrice}, #{item.catalogueAllPrice}, #{item.price}, #{item.allPrice},
#{item.guidanceDiscount}, #{item.discount}, #{item.remark})
</foreach>
on duplicate key update product_code = values(product_code), quantity = values(quantity), remark = values(remark)
ON DUPLICATE KEY UPDATE product_bom_code = #{productBomCode}, model = #{model},
product_code = #{productCode}, product_desc = #{productDesc}, quantity = #{quantity}, catalogue_price = #{cataloguePrice},
catalogue_all_price = #{catalogueAllPrice}, price = #{price}, all_price = #{allPrice}, guidance_discount = #{guidanceDiscount},
discount = #{discount}, remark = #{remark}
</insert>
<update id="updateProjectProductInfo" parameterType="ProjectProductInfo">
update project_product_info
<trim prefix="SET" suffixOverrides=",">
<if test="projectId != null">project_id = #{projectId},</if>
<if test="productBomCode != null and productBomCode != ''">product_bom_code = #{productBomCode},</if>
<if test="model != null">model = #{model},</if>
<if test="productCode != null">product_code = #{productCode},</if>
<if test="productDesc != null">product_desc = #{productDesc},</if>
<if test="quantity != null">quantity = #{quantity},</if>
<if test="cataloguePrice != null">catalogue_price = #{cataloguePrice},</if>
<if test="catalogueAllPrice != null">catalogue_all_price = #{catalogueAllPrice},</if>
<if test="price != null">price = #{price},</if>
<if test="allPrice != null">all_price = #{allPrice},</if>
<if test="guidanceDiscount != null">guidance_discount = #{guidanceDiscount},</if>
<if test="discount != null">discount = #{discount},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}