You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
192 lines
7.9 KiB
192 lines
7.9 KiB
<?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.gaotao.modules.sys.dao.SystemLogDao">
|
|
|
|
<!-- 查询系统日志列表 -->
|
|
<select id="queryList" resultType="map">
|
|
SELECT
|
|
a.id,
|
|
a.site,
|
|
a.bu_no AS buNo,
|
|
a.request_id AS requestId,
|
|
a.transaction_id AS transactionId,
|
|
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}) OR a.site = '*'
|
|
and a.bu_no in (select bu_no from AccessBu where username = #{userName}) OR a.bu_no = '*')
|
|
and a.type <![CDATA[<>]]> 'Interface'
|
|
<if test="interfaceName != null and interfaceName.trim() != ''">
|
|
AND a.interface_name LIKE '%' + #{interfaceName} + '%'
|
|
</if>
|
|
<if test="requestId != null and requestId.trim() != ''">
|
|
AND a.request_id = #{requestId}
|
|
</if>
|
|
<if test="orderNo != null and orderNo.trim() != ''">
|
|
AND a.order_no LIKE '%' + #{orderNo} + '%'
|
|
</if>
|
|
<if test="interfaceType != null and interfaceType.trim() != ''">
|
|
AND b.interface_type LIKE '%' + #{interfaceType} + '%'
|
|
</if>
|
|
<if test="statusCode != null and statusCode.trim() != ''">
|
|
AND a.status_code = #{statusCode}
|
|
</if>
|
|
<if test="sourceSystem != null and sourceSystem.trim() != ''">
|
|
AND a.source_system = #{sourceSystem}
|
|
</if>
|
|
<if test="targetSystem != null and targetSystem.trim() != ''">
|
|
AND a.target_system = #{targetSystem}
|
|
</if>
|
|
<if test="needRetryFlag != null">
|
|
AND a.need_retry_flag = #{needRetryFlag}
|
|
</if>
|
|
<if test="warehouseId != null and warehouseId.trim() != ''">
|
|
AND a.warehouse_id = #{warehouseId}
|
|
</if>
|
|
<if test="transactionId != null and transactionId.trim() != ''">
|
|
AND a.transaction_id LIKE '%' + #{transactionId} + '%'
|
|
</if>
|
|
<if test="startDate != null and startDate.trim() != ''">
|
|
AND CONVERT(varchar(10), a.created_date, 23) >= #{startDate}
|
|
</if>
|
|
<if test="endDate != null and endDate.trim() != ''">
|
|
AND CONVERT(varchar(10), a.created_date, 23) <= #{endDate}
|
|
</if>
|
|
</where>
|
|
ORDER BY a.created_date DESC
|
|
<if test="offset != null and limit != null">
|
|
OFFSET #{offset} ROWS
|
|
FETCH NEXT #{limit} ROWS ONLY
|
|
</if>
|
|
</select>
|
|
|
|
<!-- 查询系统日志总数 -->
|
|
<select id="queryTotal" resultType="int">
|
|
SELECT COUNT(*)
|
|
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}) OR a.site = '*'
|
|
and a.bu_no in (select bu_no from AccessBu where username = #{userName}) OR a.bu_no = '*')
|
|
and a.type <![CDATA[<>]]> 'Interface'
|
|
<if test="interfaceName != null and interfaceName.trim() != ''">
|
|
AND a.interface_name LIKE '%' + #{interfaceName} + '%'
|
|
</if>
|
|
<if test="requestId != null and requestId.trim() != ''">
|
|
AND a.request_id = #{requestId}
|
|
</if>
|
|
<if test="orderNo != null and orderNo.trim() != ''">
|
|
AND a.order_no LIKE '%' + #{orderNo} + '%'
|
|
</if>
|
|
<if test="interfaceType != null and interfaceType.trim() != ''">
|
|
AND b.interface_type LIKE '%' + #{interfaceType} + '%'
|
|
</if>
|
|
<if test="statusCode != null and statusCode.trim() != ''">
|
|
AND a.status_code = #{statusCode}
|
|
</if>
|
|
<if test="sourceSystem != null and sourceSystem.trim() != ''">
|
|
AND a.source_system = #{sourceSystem}
|
|
</if>
|
|
<if test="targetSystem != null and targetSystem.trim() != ''">
|
|
AND a.target_system = #{targetSystem}
|
|
</if>
|
|
<if test="needRetryFlag != null">
|
|
AND a.need_retry_flag = #{needRetryFlag}
|
|
</if>
|
|
<if test="warehouseId != null and warehouseId.trim() != ''">
|
|
AND a.warehouse_id = #{warehouseId}
|
|
</if>
|
|
<if test="transactionId != null and transactionId.trim() != ''">
|
|
AND a.transaction_id LIKE '%' + #{transactionId} + '%'
|
|
</if>
|
|
<if test="startDate != null and startDate.trim() != ''">
|
|
AND CONVERT(varchar(10), a.created_date, 23) >= #{startDate}
|
|
</if>
|
|
<if test="endDate != null and endDate.trim() != ''">
|
|
AND CONVERT(varchar(10), a.created_date, 23) <= #{endDate}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!-- 批量删除 -->
|
|
<delete id="deleteBatch">
|
|
DELETE FROM api_log WHERE id IN
|
|
<foreach item="id" collection="ids" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
|
|
<!-- 查询单条api_log记录 -->
|
|
<select id="getApiLog" resultType="map">
|
|
SELECT
|
|
id,
|
|
site,
|
|
bu_no AS buNo,
|
|
request_id AS requestId,
|
|
transaction_id AS transactionId,
|
|
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,
|
|
request_data AS requestData,
|
|
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,
|
|
last_response_data AS lastResponseData,
|
|
created_by AS createdBy,
|
|
created_date AS createdDate
|
|
FROM api_log WITH(NOLOCK)
|
|
WHERE site = #{site}
|
|
AND bu_no = #{buNo}
|
|
AND request_id = #{requestId}
|
|
AND request_group_id = #{requestGroupId}
|
|
and interface_name = #{interfaceName}
|
|
</select>
|
|
|
|
<!-- 更新接口重试信息 -->
|
|
<update id="updateRetryInfo">
|
|
UPDATE api_log
|
|
SET status_code = #{statusCode},
|
|
message = #{message},
|
|
last_response_data = #{lastResponseData},
|
|
retry_count = #{retryCount},
|
|
last_retry_time = GETDATE()
|
|
WHERE site = #{site}
|
|
AND bu_no = #{buNo}
|
|
AND request_id = #{requestId}
|
|
AND request_group_id = #{requestGroupId}
|
|
</update>
|
|
|
|
</mapper>
|
|
|
|
|