104 lines
4.4 KiB
XML
104 lines
4.4 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.ruoyi.ar.mapper.ArBillExportMapper">
|
|
<!-- 导出任务和历史记录;PROCESSING/SUCCESS/FAILED 由异步执行器更新。 -->
|
|
<resultMap id="ArBillExportResult" type="ArBillExport">
|
|
<id property="exportId" column="export_id"/>
|
|
<result property="arBillId" column="ar_bill_id"/>
|
|
<result property="fileName" column="file_name"/>
|
|
<result property="fileType" column="file_type"/>
|
|
<result property="templateId" column="template_id"/>
|
|
<result property="templateCode" column="template_code"/>
|
|
<result property="templateVersion" column="template_version"/>
|
|
<result property="templateStorageType" column="template_storage_type"/>
|
|
<result property="templateStorageKey" column="template_storage_key"/>
|
|
<result property="templateHash" column="template_hash"/>
|
|
<result property="storageKey" column="storage_key"/>
|
|
<result property="fileSize" column="file_size"/>
|
|
<result property="fileHash" column="file_hash"/>
|
|
<result property="rowCount" column="row_count"/>
|
|
<result property="exportStatus" column="export_status"/>
|
|
<result property="exportBy" column="export_by"/>
|
|
<result property="exportTime" column="export_time"/>
|
|
<result property="remark" column="remark"/>
|
|
</resultMap>
|
|
|
|
<sql id="selectExportColumns">
|
|
select export_id,
|
|
ar_bill_id,
|
|
file_name,
|
|
file_type,
|
|
template_id,
|
|
template_code,
|
|
template_version,
|
|
template_storage_type,
|
|
template_storage_key,
|
|
template_hash,
|
|
storage_key,
|
|
file_size,
|
|
file_hash,
|
|
row_count,
|
|
export_status,
|
|
export_by,
|
|
export_time,
|
|
remark
|
|
from ar_bill_export
|
|
</sql>
|
|
|
|
<select id="selectByBillId" parameterType="long" resultMap="ArBillExportResult">
|
|
<include refid="selectExportColumns"/> where ar_bill_id = #{arBillId} order by export_time desc
|
|
</select>
|
|
|
|
<select id="selectById" parameterType="long" resultMap="ArBillExportResult">
|
|
<include refid="selectExportColumns"/> where export_id = #{exportId}
|
|
</select>
|
|
|
|
<select id="selectLatestSuccessByBillId" parameterType="long" resultMap="ArBillExportResult">
|
|
<include refid="selectExportColumns"/>
|
|
where ar_bill_id = #{arBillId} and export_status = 'SUCCESS'
|
|
order by export_time desc limit 1
|
|
</select>
|
|
|
|
<select id="selectProcessingByBillId" parameterType="long" resultMap="ArBillExportResult">
|
|
<include refid="selectExportColumns"/>
|
|
where ar_bill_id = #{arBillId} and export_status = 'PROCESSING'
|
|
order by export_id desc limit 1
|
|
</select>
|
|
|
|
<insert id="insert" parameterType="ArBillExport" useGeneratedKeys="true" keyProperty="exportId">
|
|
insert into ar_bill_export (
|
|
ar_bill_id, file_name, file_type, template_id, template_code, template_version,
|
|
template_storage_type, template_storage_key, template_hash, storage_key,
|
|
file_size, file_hash, row_count, export_status, export_by, export_time, remark
|
|
) values (
|
|
#{arBillId}, #{fileName}, #{fileType}, #{templateId}, #{templateCode}, #{templateVersion},
|
|
#{templateStorageType}, #{templateStorageKey}, #{templateHash}, #{storageKey},
|
|
#{fileSize}, #{fileHash}, #{rowCount}, #{exportStatus}, #{exportBy}, sysdate(), #{remark}
|
|
)
|
|
</insert>
|
|
|
|
<update id="markSuccess" parameterType="ArBillExport">
|
|
update ar_bill_export
|
|
set storage_key = #{storageKey},
|
|
file_size = #{fileSize},
|
|
file_hash = #{fileHash},
|
|
export_status = 'SUCCESS',
|
|
remark = null
|
|
where export_id = #{exportId} and export_status = 'PROCESSING'
|
|
</update>
|
|
|
|
<update id="markFailed">
|
|
update ar_bill_export
|
|
set export_status = 'FAILED', remark = #{remark}
|
|
where export_id = #{exportId} and export_status = 'PROCESSING'
|
|
</update>
|
|
|
|
<update id="markExpiredProcessingAsFailed">
|
|
update ar_bill_export
|
|
set export_status = 'FAILED', remark = #{remark}
|
|
where export_status = 'PROCESSING' and export_time < #{expiredBefore}
|
|
</update>
|
|
</mapper>
|