Implement product Excel file import functionality, including new service methods for handling Excel attachments. Update the ProductController to list imported Excel files by product code. Enhance BmsProduct and related entities to store references to the imported Excel files. Update front-end components to support displaying and managing Excel file attachments for products.

This commit is contained in:
wuweihua
2026-10-09 16:46:52 +08:00
parent 853187ad58
commit 533d360cdc
21 changed files with 589 additions and 31 deletions
@@ -17,6 +17,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="expireDate" column="expire_date" />
<result property="status" column="status" />
<result property="sourceSheet" column="source_sheet" />
<result property="pefId" column="pef_id" />
<result property="remark" column="remark" />
<result property="tmsId" column="tms_id" />
<result property="createBy" column="created_by" />
@@ -30,7 +31,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="selectBmsProductVo">
select p.product_id, p.product_code, p.product_name, p.service_level, p.cargo_attr,
p.dest_region, p.update_note, p.tax_mode, p.effective_date, p.expire_date, p.status,
p.source_sheet, p.remark, p.tms_id, p.created_by, p.create_time, p.updated_by, p.update_time,
p.source_sheet, p.pef_id, p.remark, p.tms_id, p.created_by, p.create_time, p.updated_by, p.update_time,
(select count(distinct c.country_name) from product_country c
where c.product_id = p.product_id
or (c.product_id is null and c.product_code = p.product_code
@@ -139,6 +140,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="expireDate != null">expire_date,</if>
<if test="status != null and status != ''">status,</if>
<if test="sourceSheet != null">source_sheet,</if>
<if test="pefId != null">pef_id,</if>
<if test="remark != null">remark,</if>
<if test="tmsId != null">tms_id,</if>
<if test="createBy != null and createBy != ''">created_by,</if>
@@ -155,6 +157,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="expireDate != null">#{expireDate},</if>
<if test="status != null and status != ''">#{status},</if>
<if test="sourceSheet != null">#{sourceSheet},</if>
<if test="pefId != null">#{pefId},</if>
<if test="remark != null">#{remark},</if>
<if test="tmsId != null">#{tmsId},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
@@ -176,6 +179,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
expire_date = #{expireDate},
<if test="status != null and status != ''">status = #{status},</if>
<if test="sourceSheet != null">source_sheet = #{sourceSheet},</if>
<if test="pefId != null">pef_id = #{pefId},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="tmsId != null">tms_id = #{tmsId},</if>
<if test="updateBy != null and updateBy != ''">updated_by = #{updateBy},</if>
@@ -0,0 +1,116 @@
<?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.bms.price.mapper.PrcPriceExcelFileMapper">
<resultMap type="PrcPriceExcelFile" id="PrcPriceExcelFileResult">
<id property="pefId" column="pef_id" />
<result property="excelType" column="excel_type" />
<result property="effectiveTime" column="effective_time" />
<result property="fileName" column="file_name" />
<result property="filePath" column="file_path" />
<result property="fileSize" column="file_size" />
<result property="contentType" column="content_type" />
<result property="fileExtension" column="file_extension" />
<result property="ossId" column="oss_id" />
<result property="sheetNames" column="sheet_names" />
<result property="remark" column="remark" />
<result property="createBy" column="created_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="updated_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectPrcPriceExcelFileVo">
select pef_id, excel_type, effective_time, file_name, file_path, file_size, content_type,
file_extension, oss_id, sheet_names, remark, created_by, create_time, updated_by, update_time
from prc_price_excel_file
</sql>
<select id="selectPrcPriceExcelFileById" parameterType="Long" resultMap="PrcPriceExcelFileResult">
<include refid="selectPrcPriceExcelFileVo"/>
where pef_id = #{pefId}
</select>
<select id="selectPrcPriceExcelFileList" parameterType="PrcPriceExcelFile" resultMap="PrcPriceExcelFileResult">
<include refid="selectPrcPriceExcelFileVo"/>
<where>
<if test="excelType != null and excelType != ''">
AND excel_type = #{excelType}
</if>
<if test="fileName != null and fileName != ''">
AND file_name like concat('%', #{fileName}, '%')
</if>
</where>
order by pef_id desc
</select>
<select id="selectByProductCode" resultMap="PrcPriceExcelFileResult">
select distinct f.pef_id, f.excel_type, f.effective_time, f.file_name, f.file_path, f.file_size,
f.content_type, f.file_extension, f.oss_id, f.sheet_names, f.remark,
f.created_by, f.create_time, f.updated_by, f.update_time
from prc_price_excel_file f
inner join product p on p.pef_id = f.pef_id
where p.product_code = #{productCode}
and p.pef_id is not null
order by f.effective_time desc, f.pef_id desc
</select>
<insert id="insertPrcPriceExcelFile" parameterType="PrcPriceExcelFile" useGeneratedKeys="true" keyProperty="pefId">
insert into prc_price_excel_file (
<if test="excelType != null and excelType != ''">excel_type,</if>
<if test="effectiveTime != null">effective_time,</if>
<if test="fileName != null and fileName != ''">file_name,</if>
<if test="filePath != null and filePath != ''">file_path,</if>
<if test="fileSize != null">file_size,</if>
<if test="contentType != null">content_type,</if>
<if test="fileExtension != null">file_extension,</if>
<if test="ossId != null">oss_id,</if>
<if test="sheetNames != null">sheet_names,</if>
<if test="remark != null">remark,</if>
<if test="createBy != null and createBy != ''">created_by,</if>
create_time
) values (
<if test="excelType != null and excelType != ''">#{excelType},</if>
<if test="effectiveTime != null">#{effectiveTime},</if>
<if test="fileName != null and fileName != ''">#{fileName},</if>
<if test="filePath != null and filePath != ''">#{filePath},</if>
<if test="fileSize != null">#{fileSize},</if>
<if test="contentType != null">#{contentType},</if>
<if test="fileExtension != null">#{fileExtension},</if>
<if test="ossId != null">#{ossId},</if>
<if test="sheetNames != null">#{sheetNames},</if>
<if test="remark != null">#{remark},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate()
)
</insert>
<update id="updatePrcPriceExcelFile" parameterType="PrcPriceExcelFile">
update prc_price_excel_file
<set>
<if test="excelType != null and excelType != ''">excel_type = #{excelType},</if>
<if test="effectiveTime != null">effective_time = #{effectiveTime},</if>
<if test="fileName != null and fileName != ''">file_name = #{fileName},</if>
<if test="filePath != null and filePath != ''">file_path = #{filePath},</if>
<if test="fileSize != null">file_size = #{fileSize},</if>
<if test="contentType != null">content_type = #{contentType},</if>
<if test="fileExtension != null">file_extension = #{fileExtension},</if>
<if test="ossId != null">oss_id = #{ossId},</if>
<if test="sheetNames != null">sheet_names = #{sheetNames},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="updateBy != null and updateBy != ''">updated_by = #{updateBy},</if>
update_time = sysdate()
</set>
where pef_id = #{pefId}
</update>
<delete id="deletePrcPriceExcelFileByIds" parameterType="Long">
delete from prc_price_excel_file where pef_id in
<foreach item="pefId" collection="array" open="(" separator="," close=")">
#{pefId}
</foreach>
</delete>
</mapper>
@@ -17,13 +17,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="taxMode" column="tax_mode" />
<result property="sourceProductId" column="source_product_id" />
<result property="sourceSheet" column="source_sheet" />
<result property="pefId" column="pef_id" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectVo">
select psp_id, price_set_id, psv_id, product_code, product_name, service_level, cargo_attr,
dest_region, update_note, tax_mode, source_product_id, source_sheet, create_time, update_time
dest_region, update_note, tax_mode, source_product_id, source_sheet, pef_id,
create_time, update_time
from prc_price_set_product
</sql>
@@ -52,10 +54,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert id="insertPrcPriceSetProduct" parameterType="PrcPriceSetProduct" useGeneratedKeys="true" keyProperty="pspId">
insert into prc_price_set_product (
price_set_id, psv_id, product_code, product_name, service_level, cargo_attr,
dest_region, update_note, tax_mode, source_product_id, source_sheet, create_time
dest_region, update_note, tax_mode, source_product_id, source_sheet, pef_id, create_time
) values (
#{priceSetId}, #{psvId}, #{productCode}, #{productName}, #{serviceLevel}, #{cargoAttr},
#{destRegion}, #{updateNote}, #{taxMode}, #{sourceProductId}, #{sourceSheet}, sysdate()
#{destRegion}, #{updateNote}, #{taxMode}, #{sourceProductId}, #{sourceSheet}, #{pefId}, sysdate()
)
</insert>
@@ -70,6 +72,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="taxMode != null and taxMode != ''">tax_mode = #{taxMode},</if>
<if test="sourceProductId != null">source_product_id = #{sourceProductId},</if>
<if test="sourceSheet != null">source_sheet = #{sourceSheet},</if>
<if test="pefId != null">pef_id = #{pefId},</if>
update_time = sysdate()
</set>
where psp_id = #{pspId}
@@ -88,11 +91,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert id="copyFromVersion">
insert into prc_price_set_product (
price_set_id, psv_id, product_code, product_name, service_level, cargo_attr,
dest_region, update_note, tax_mode, source_product_id, source_sheet, create_time
dest_region, update_note, tax_mode, source_product_id, source_sheet, pef_id, create_time
)
select
price_set_id, #{newPsvId}, product_code, product_name, service_level, cargo_attr,
dest_region, update_note, tax_mode, source_product_id, source_sheet, sysdate()
dest_region, update_note, tax_mode, source_product_id, source_sheet, pef_id, sysdate()
from prc_price_set_product
where psv_id = #{srcPsvId}
order by psp_id asc
@@ -159,4 +162,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and (d.psp_id is null or d.psp_id &lt;&gt; sp.psp_id)
</update>
<update id="updatePefIdByPsvId">
update prc_price_set_product
set pef_id = #{pefId}, update_time = sysdate()
where psv_id = #{psvId}
<if test="productCodes != null and productCodes.size() &gt; 0">
and product_code in
<foreach item="code" collection="productCodes" open="(" separator="," close=")">
#{code}
</foreach>
</if>
</update>
</mapper>