Browse Source

2025-11-27

接口日志管理调整
master
fengyuan_yang 2 months ago
parent
commit
2150d84d65
  1. 105
      src/main/resources/mapper/sys/InterfaceLogDao.xml

105
src/main/resources/mapper/sys/InterfaceLogDao.xml

@ -6,66 +6,71 @@
<!-- 查询接口日志列表 -->
<select id="queryList" resultType="map">
SELECT
id,
site,
bu_no AS buNo,
request_id AS requestId,
interface_name AS interfaceName,
request_group_id AS requestGroupId,
re_document_no AS reDocumentNo,
re_document_type AS reDocumentType,
order_no AS orderNo,
seq_no AS seqNo,
status_code AS statusCode,
message,
source_system AS sourceSystem,
target_system AS targetSystem,
need_retry_flag AS needRetryFlag,
retry_count AS retryCount,
max_retry_count AS maxRetryCount,
retry_interval AS retryInterval,
next_retry_time AS nextRetryTime,
last_retry_time AS lastRetryTime,
warehouse_id AS warehouseId,
created_by AS createdBy,
created_date AS createdDate
FROM api_log
a.id,
a.site,
a.bu_no AS buNo,
a.request_id AS requestId,
a.interface_name AS interfaceName,
a.request_group_id AS requestGroupId,
a.re_document_no AS reDocumentNo,
a.re_document_type AS reDocumentType,
a.order_no AS orderNo,
a.seq_no AS seqNo,
a.status_code AS statusCode,
a.message,
a.source_system AS sourceSystem,
a.target_system AS targetSystem,
a.need_retry_flag AS needRetryFlag,
a.retry_count AS retryCount,
a.max_retry_count AS maxRetryCount,
a.retry_interval AS retryInterval,
a.next_retry_time AS nextRetryTime,
a.last_retry_time AS lastRetryTime,
a.warehouse_id AS warehouseId,
a.created_by AS createdBy,
a.created_date AS createdDate,
b.interface_type AS interfaceType
FROM api_log as a
left join api_Interface as b on a.interface_name = b.interface_name AND a.site = b.site and a.bu_no = b.bu_no
<where>
a.site in (select site from AccessSite where userID = #{userName})
and a.bu_no in (select bu_no from AccessBu where username = #{userName})
and type = 'Interface'
<if test="interfaceName != null and interfaceName.trim() != ''">
AND interface_name LIKE '%' + #{interfaceName} + '%'
AND a.interface_name LIKE '%' + #{interfaceName} + '%'
</if>
<if test="requestId != null and requestId.trim() != ''">
AND request_id = #{requestId}
AND a.request_id = #{requestId}
</if>
<if test="reDocumentNo != null and reDocumentNo.trim() != ''">
AND re_document_no LIKE '%' + #{reDocumentNo} + '%'
AND a.re_document_no LIKE '%' + #{reDocumentNo} + '%'
</if>
<if test="reDocumentType != null and reDocumentType.trim() != ''">
AND re_document_type LIKE '%' + #{reDocumentType} + '%'
AND a.re_document_type LIKE '%' + #{reDocumentType} + '%'
</if>
<if test="statusCode != null and statusCode.trim() != ''">
AND status_code = #{statusCode}
AND a.status_code = #{statusCode}
</if>
<if test="sourceSystem != null and sourceSystem.trim() != ''">
AND source_system = #{sourceSystem}
AND a.source_system = #{sourceSystem}
</if>
<if test="targetSystem != null and targetSystem.trim() != ''">
AND target_system = #{targetSystem}
AND a.target_system = #{targetSystem}
</if>
<if test="needRetryFlag != null">
AND need_retry_flag = #{needRetryFlag}
AND a.need_retry_flag = #{needRetryFlag}
</if>
<if test="warehouseId != null and warehouseId.trim() != ''">
AND warehouse_id = #{warehouseId}
AND a.warehouse_id = #{warehouseId}
</if>
<if test="startDate != null and startDate.trim() != ''">
AND CONVERT(varchar(10), created_date, 23) &gt;= #{startDate}
AND CONVERT(varchar(10), a.created_date, 23) &gt;= #{startDate}
</if>
<if test="endDate != null and endDate.trim() != ''">
AND CONVERT(varchar(10), created_date, 23) &lt;= #{endDate}
AND CONVERT(varchar(10), a.created_date, 23) &lt;= #{endDate}
</if>
</where>
ORDER BY created_date DESC
ORDER BY a.created_date DESC
<if test="offset != null and limit != null">
OFFSET #{offset} ROWS
FETCH NEXT #{limit} ROWS ONLY
@ -75,40 +80,44 @@
<!-- 查询接口日志总数 -->
<select id="queryTotal" resultType="int">
SELECT COUNT(*)
FROM api_log
FROM api_log as a
left join api_Interface as b on a.interface_name = b.interface_name AND a.site = b.site
<where>
a.site in (select site from AccessSite where userID = #{userName})
and a.bu_no in (select bu_no from AccessBu where username = #{userName})
and type = 'Interface'
<if test="interfaceName != null and interfaceName.trim() != ''">
AND interface_name LIKE '%' + #{interfaceName} + '%'
AND a.interface_name LIKE '%' + #{interfaceName} + '%'
</if>
<if test="requestId != null and requestId.trim() != ''">
AND request_id = #{requestId}
AND a.request_id = #{requestId}
</if>
<if test="reDocumentNo != null and reDocumentNo.trim() != ''">
AND re_document_no LIKE '%' + #{reDocumentNo} + '%'
AND a.re_document_no LIKE '%' + #{reDocumentNo} + '%'
</if>
<if test="reDocumentType != null and reDocumentType.trim() != ''">
AND re_document_type LIKE '%' + #{reDocumentType} + '%'
AND a.re_document_type LIKE '%' + #{reDocumentType} + '%'
</if>
<if test="statusCode != null and statusCode.trim() != ''">
AND status_code = #{statusCode}
AND a.status_code = #{statusCode}
</if>
<if test="sourceSystem != null and sourceSystem.trim() != ''">
AND source_system = #{sourceSystem}
AND a.source_system = #{sourceSystem}
</if>
<if test="targetSystem != null and targetSystem.trim() != ''">
AND target_system = #{targetSystem}
AND a.target_system = #{targetSystem}
</if>
<if test="needRetryFlag != null">
AND need_retry_flag = #{needRetryFlag}
AND a.need_retry_flag = #{needRetryFlag}
</if>
<if test="warehouseId != null and warehouseId.trim() != ''">
AND warehouse_id = #{warehouseId}
AND a.warehouse_id = #{warehouseId}
</if>
<if test="startDate != null and startDate.trim() != ''">
AND CONVERT(varchar(10), created_date, 23) &gt;= #{startDate}
AND CONVERT(varchar(10), a.created_date, 23) &gt;= #{startDate}
</if>
<if test="endDate != null and endDate.trim() != ''">
AND CONVERT(varchar(10), created_date, 23) &lt;= #{endDate}
AND CONVERT(varchar(10), a.created_date, 23) &lt;= #{endDate}
</if>
</where>
</select>

Loading…
Cancel
Save