Files
BMS/bms-back/bms-system/src/main/resources/mapper/price/PrcPriceExcelFileMapper.xml
T
2026-10-12 09:52:24 +08:00

129 lines
6.5 KiB
XML

<?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 and ifnull(p.is_del, '0') = '0'
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>
<select id="selectByRedlineProductCode" 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 redline_product p on p.pef_id = f.pef_id and ifnull(p.is_del, '0') = '0'
where p.product_code = #{productCode}
and p.pef_id is not null
order by f.effective_time desc, f.pef_id desc
</select>
</mapper>