472 lines
15 KiB
XML
472 lines
15 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="ink.wgink.gatewaymanage.dao.api.IApiDao">
|
||
|
|
||
|
<resultMap id="apiDTO" type="ink.wgink.gatewaymanage.pojo.dtos.api.ApiDTO">
|
||
|
<result column="api_id" property="apiId"/>
|
||
|
<result column="system_id" property="systemId"/>
|
||
|
<result column="title" property="title"/>
|
||
|
<result column="summary" property="summary"/>
|
||
|
<result column="url" property="url"/>
|
||
|
<result column="method" property="method"/>
|
||
|
<result column="request_example_url" property="requestExampleUrl"/>
|
||
|
<result column="request_example_body" property="requestExampleBody"/>
|
||
|
<result column="response_success_example" property="responseSuccessExample"/>
|
||
|
<result column="response_fail_example" property="responseFailExample"/>
|
||
|
<result column="audit_status" property="auditStatus"/>
|
||
|
<result column="audit_time" property="auditTime"/>
|
||
|
<result column="auditor" property="auditor"/>
|
||
|
<result column="audit_reason" property="auditReason"/>
|
||
|
<result column="is_publish" property="isPublish"/>
|
||
|
<result column="publish_time" property="publishTime"/>
|
||
|
<result column="is_can_claim" property="isCanClaim"/>
|
||
|
<result column="is_usable" property="isUsable"/>
|
||
|
<result column="gmt_create" property="gmtCreate"/>
|
||
|
<result column="gmt_modified" property="gmtModified"/>
|
||
|
</resultMap>
|
||
|
|
||
|
<resultMap id="apiBO" type="ink.wgink.gatewaymanage.pojo.bos.api.ApiBO">
|
||
|
<result column="api_id" property="apiId"/>
|
||
|
<result column="system_id" property="systemId"/>
|
||
|
<result column="title" property="title"/>
|
||
|
<result column="summary" property="summary"/>
|
||
|
<result column="url" property="url"/>
|
||
|
<result column="method" property="method"/>
|
||
|
<result column="request_example_url" property="requestExampleUrl"/>
|
||
|
<result column="request_example_body" property="requestExampleBody"/>
|
||
|
<result column="response_success_example" property="responseSuccessExample"/>
|
||
|
<result column="response_fail_example" property="responseFailExample"/>
|
||
|
<result column="audit_status" property="auditStatus"/>
|
||
|
<result column="audit_time" property="auditTime"/>
|
||
|
<result column="auditor" property="auditor"/>
|
||
|
<result column="audit_reason" property="auditReason"/>
|
||
|
<result column="is_publish" property="isPublish"/>
|
||
|
<result column="publish_time" property="publishTime"/>
|
||
|
<result column="is_can_claim" property="isCanClaim"/>
|
||
|
<result column="is_usable" property="isUsable"/>
|
||
|
<result column="gmt_create" property="gmtCreate"/>
|
||
|
<result column="creator" property="creator"/>
|
||
|
<result column="gmt_modified" property="gmtModified"/>
|
||
|
<result column="modifier" property="modifier"/>
|
||
|
<result column="is_delete" property="isDelete"/>
|
||
|
</resultMap>
|
||
|
|
||
|
<resultMap id="apiPO" type="ink.wgink.gatewaymanage.pojo.pos.api.ApiPO">
|
||
|
<result column="api_id" property="apiId"/>
|
||
|
<result column="system_id" property="systemId"/>
|
||
|
<result column="title" property="title"/>
|
||
|
<result column="summary" property="summary"/>
|
||
|
<result column="url" property="url"/>
|
||
|
<result column="method" property="method"/>
|
||
|
<result column="request_example_url" property="requestExampleUrl"/>
|
||
|
<result column="request_example_body" property="requestExampleBody"/>
|
||
|
<result column="response_success_example" property="responseSuccessExample"/>
|
||
|
<result column="response_fail_example" property="responseFailExample"/>
|
||
|
<result column="audit_status" property="auditStatus"/>
|
||
|
<result column="audit_time" property="auditTime"/>
|
||
|
<result column="auditor" property="auditor"/>
|
||
|
<result column="audit_reason" property="auditReason"/>
|
||
|
<result column="is_publish" property="isPublish"/>
|
||
|
<result column="publish_time" property="publishTime"/>
|
||
|
<result column="is_can_claim" property="isCanClaim"/>
|
||
|
<result column="is_usable" property="isUsable"/>
|
||
|
<result column="gmt_create" property="gmtCreate"/>
|
||
|
<result column="creator" property="creator"/>
|
||
|
<result column="gmt_modified" property="gmtModified"/>
|
||
|
<result column="modifier" property="modifier"/>
|
||
|
<result column="is_delete" property="isDelete"/>
|
||
|
</resultMap>
|
||
|
|
||
|
<!-- 新增接口 -->
|
||
|
<insert id="save" parameterType="map">
|
||
|
INSERT INTO api_api(
|
||
|
api_id,
|
||
|
system_id,
|
||
|
title,
|
||
|
summary,
|
||
|
url,
|
||
|
method,
|
||
|
request_example_url,
|
||
|
request_example_body,
|
||
|
response_success_example,
|
||
|
response_fail_example,
|
||
|
audit_status,
|
||
|
audit_time,
|
||
|
auditor,
|
||
|
audit_reason,
|
||
|
is_publish,
|
||
|
publish_time,
|
||
|
is_can_claim,
|
||
|
is_usable,
|
||
|
gmt_create,
|
||
|
creator,
|
||
|
gmt_modified,
|
||
|
modifier,
|
||
|
is_delete
|
||
|
) VALUES(
|
||
|
#{apiId},
|
||
|
#{systemId},
|
||
|
#{title},
|
||
|
#{summary},
|
||
|
#{url},
|
||
|
#{method},
|
||
|
#{requestExampleUrl},
|
||
|
#{requestExampleBody},
|
||
|
#{responseSuccessExample},
|
||
|
#{responseFailExample},
|
||
|
#{auditStatus},
|
||
|
#{auditTime},
|
||
|
#{auditor},
|
||
|
#{auditReason},
|
||
|
#{isPublish},
|
||
|
#{publishTime},
|
||
|
#{isCanClaim},
|
||
|
#{isUsable},
|
||
|
#{gmtCreate},
|
||
|
#{creator},
|
||
|
#{gmtModified},
|
||
|
#{modifier},
|
||
|
#{isDelete}
|
||
|
)
|
||
|
</insert>
|
||
|
|
||
|
<!-- 删除接口 -->
|
||
|
<update id="remove" parameterType="map">
|
||
|
UPDATE
|
||
|
api_api
|
||
|
SET
|
||
|
gmt_modified = #{gmtModified},
|
||
|
modifier = #{modifier},
|
||
|
is_delete = 1
|
||
|
WHERE
|
||
|
api_id IN
|
||
|
<foreach collection="apiIds" index="index" open="(" separator="," close=")">
|
||
|
#{apiIds[${index}]}
|
||
|
</foreach>
|
||
|
</update>
|
||
|
|
||
|
<!-- 删除接口(物理) -->
|
||
|
<update id="delete" parameterType="map">
|
||
|
DELETE FROM
|
||
|
api_api
|
||
|
WHERE
|
||
|
api_id IN
|
||
|
<foreach collection="apiIds" index="index" open="(" separator="," close=")">
|
||
|
#{apiIds[${index}]}
|
||
|
</foreach>
|
||
|
</update>
|
||
|
|
||
|
<!-- 修改接口 -->
|
||
|
<update id="update" parameterType="map">
|
||
|
UPDATE
|
||
|
api_api
|
||
|
SET
|
||
|
<if test="systemId != null and systemId != ''">
|
||
|
system_id = #{systemId},
|
||
|
</if>
|
||
|
<if test="title != null and title != ''">
|
||
|
title = #{title},
|
||
|
</if>
|
||
|
<if test="summary != null and summary != ''">
|
||
|
summary = #{summary},
|
||
|
</if>
|
||
|
<if test="url != null and url != ''">
|
||
|
url = #{url},
|
||
|
</if>
|
||
|
<if test="method != null and method != ''">
|
||
|
method = #{method},
|
||
|
</if>
|
||
|
<if test="requestExampleUrl != null and requestExampleUrl != ''">
|
||
|
request_example_url = #{requestExampleUrl},
|
||
|
</if>
|
||
|
<if test="requestExampleBody != null and requestExampleBody != ''">
|
||
|
request_example_body = #{requestExampleBody},
|
||
|
</if>
|
||
|
<if test="responseSuccessExample != null and responseSuccessExample != ''">
|
||
|
response_success_example = #{responseSuccessExample},
|
||
|
</if>
|
||
|
<if test="responseFailExample != null and responseFailExample != ''">
|
||
|
response_fail_example = #{responseFailExample},
|
||
|
</if>
|
||
|
<if test="isPublish != null">
|
||
|
is_publish = #{isPublish},
|
||
|
</if>
|
||
|
<if test="isCanClaim != null">
|
||
|
is_can_claim = #{isCanClaim},
|
||
|
</if>
|
||
|
<if test="isUsable != null">
|
||
|
is_usable = #{isUsable},
|
||
|
</if>
|
||
|
gmt_modified = #{gmtModified},
|
||
|
modifier = #{modifier},
|
||
|
api_id = api_id
|
||
|
WHERE
|
||
|
api_id = #{apiId}
|
||
|
</update>
|
||
|
|
||
|
<!-- 接口详情 -->
|
||
|
<select id="get" parameterType="map" resultMap="apiDTO">
|
||
|
SELECT
|
||
|
t1.system_id,
|
||
|
t1.title,
|
||
|
t1.summary,
|
||
|
t1.url,
|
||
|
t1.method,
|
||
|
t1.request_example_url,
|
||
|
t1.request_example_body,
|
||
|
t1.response_success_example,
|
||
|
t1.response_fail_example,
|
||
|
t1.is_publish,
|
||
|
t1.is_can_claim,
|
||
|
t1.is_usable,
|
||
|
t1.api_id
|
||
|
FROM
|
||
|
api_api t1
|
||
|
WHERE
|
||
|
t1.is_delete = 0
|
||
|
<if test="apiId != null and apiId != ''">
|
||
|
AND
|
||
|
t1.api_id = #{apiId}
|
||
|
</if>
|
||
|
</select>
|
||
|
|
||
|
<!-- 接口详情 -->
|
||
|
<select id="getBO" parameterType="map" resultMap="apiBO">
|
||
|
SELECT
|
||
|
t1.api_id,
|
||
|
t1.system_id,
|
||
|
t1.title,
|
||
|
t1.summary,
|
||
|
t1.url,
|
||
|
t1.method,
|
||
|
t1.request_example_url,
|
||
|
t1.request_example_body,
|
||
|
t1.response_success_example,
|
||
|
t1.response_fail_example,
|
||
|
t1.audit_status,
|
||
|
t1.audit_time,
|
||
|
t1.auditor,
|
||
|
t1.audit_reason,
|
||
|
t1.is_publish,
|
||
|
t1.publish_time,
|
||
|
t1.is_can_claim,
|
||
|
t1.is_usable,
|
||
|
t1.gmt_create,
|
||
|
t1.creator,
|
||
|
t1.gmt_modified,
|
||
|
t1.modifier,
|
||
|
t1.is_delete
|
||
|
FROM
|
||
|
api_api t1
|
||
|
WHERE
|
||
|
t1.is_delete = 0
|
||
|
<if test="apiId != null and apiId != ''">
|
||
|
AND
|
||
|
t1.api_id = #{apiId}
|
||
|
</if>
|
||
|
</select>
|
||
|
|
||
|
<!-- 接口详情 -->
|
||
|
<select id="getPO" parameterType="map" resultMap="apiPO">
|
||
|
SELECT
|
||
|
t1.api_id,
|
||
|
t1.system_id,
|
||
|
t1.title,
|
||
|
t1.summary,
|
||
|
t1.url,
|
||
|
t1.method,
|
||
|
t1.request_example_url,
|
||
|
t1.request_example_body,
|
||
|
t1.response_success_example,
|
||
|
t1.response_fail_example,
|
||
|
t1.audit_status,
|
||
|
t1.audit_time,
|
||
|
t1.auditor,
|
||
|
t1.audit_reason,
|
||
|
t1.is_publish,
|
||
|
t1.publish_time,
|
||
|
t1.is_can_claim,
|
||
|
t1.is_usable,
|
||
|
t1.gmt_create,
|
||
|
t1.creator,
|
||
|
t1.gmt_modified,
|
||
|
t1.modifier,
|
||
|
t1.is_delete
|
||
|
FROM
|
||
|
api_api t1
|
||
|
WHERE
|
||
|
t1.is_delete = 0
|
||
|
<if test="apiId != null and apiId != ''">
|
||
|
AND
|
||
|
t1.api_id = #{apiId}
|
||
|
</if>
|
||
|
</select>
|
||
|
|
||
|
<!-- 接口列表 -->
|
||
|
<select id="list" parameterType="map" resultMap="apiDTO">
|
||
|
SELECT
|
||
|
t1.api_id,
|
||
|
t1.system_id,
|
||
|
t1.title,
|
||
|
t1.summary,
|
||
|
t1.url,
|
||
|
t1.method,
|
||
|
t1.request_example_url,
|
||
|
t1.request_example_body,
|
||
|
t1.response_success_example,
|
||
|
t1.response_fail_example,
|
||
|
t1.audit_status,
|
||
|
t1.audit_time,
|
||
|
t1.auditor,
|
||
|
t1.audit_reason,
|
||
|
t1.is_publish,
|
||
|
t1.publish_time,
|
||
|
t1.is_can_claim,
|
||
|
t1.is_usable,
|
||
|
t1.gmt_create,
|
||
|
t1.gmt_modified,
|
||
|
1
|
||
|
FROM
|
||
|
api_api t1
|
||
|
WHERE
|
||
|
t1.is_delete = 0
|
||
|
<if test="keywords != null and keywords != ''">
|
||
|
AND (
|
||
|
<!-- 这里添加其他条件 -->
|
||
|
t1.id LIKE CONCAT('%', #{keywords}, '%')
|
||
|
)
|
||
|
</if>
|
||
|
<if test="startTime != null and startTime != ''">
|
||
|
AND
|
||
|
LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
|
||
|
</if>
|
||
|
<if test="endTime != null and endTime != ''">
|
||
|
AND
|
||
|
LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
|
||
|
</if>
|
||
|
<if test="apiIds != null and apiIds.size > 0">
|
||
|
AND
|
||
|
t1.api_id IN
|
||
|
<foreach collection="apiIds" index="index" open="(" separator="," close=")">
|
||
|
#{apiIds[${index}]}
|
||
|
</foreach>
|
||
|
</if>
|
||
|
</select>
|
||
|
|
||
|
<!-- 接口列表 -->
|
||
|
<select id="listBO" parameterType="map" resultMap="apiBO">
|
||
|
SELECT
|
||
|
t1.api_id,
|
||
|
t1.system_id,
|
||
|
t1.title,
|
||
|
t1.summary,
|
||
|
t1.url,
|
||
|
t1.method,
|
||
|
t1.request_example_url,
|
||
|
t1.request_example_body,
|
||
|
t1.response_success_example,
|
||
|
t1.response_fail_example,
|
||
|
t1.audit_status,
|
||
|
t1.audit_time,
|
||
|
t1.auditor,
|
||
|
t1.audit_reason,
|
||
|
t1.is_publish,
|
||
|
t1.publish_time,
|
||
|
t1.is_can_claim,
|
||
|
t1.is_usable,
|
||
|
t1.gmt_create,
|
||
|
t1.creator,
|
||
|
t1.gmt_modified,
|
||
|
t1.modifier,
|
||
|
t1.is_delete
|
||
|
FROM
|
||
|
api_api t1
|
||
|
WHERE
|
||
|
t1.is_delete = 0
|
||
|
<if test="keywords != null and keywords != ''">
|
||
|
AND (
|
||
|
<!-- 这里添加其他条件 -->
|
||
|
t1.id LIKE CONCAT('%', #{keywords}, '%')
|
||
|
)
|
||
|
</if>
|
||
|
<if test="startTime != null and startTime != ''">
|
||
|
AND
|
||
|
LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
|
||
|
</if>
|
||
|
<if test="endTime != null and endTime != ''">
|
||
|
AND
|
||
|
LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
|
||
|
</if>
|
||
|
<if test="apiIds != null and apiIds.size > 0">
|
||
|
AND
|
||
|
t1.api_id IN
|
||
|
<foreach collection="apiIds" index="index" open="(" separator="," close=")">
|
||
|
#{apiIds[${index}]}
|
||
|
</foreach>
|
||
|
</if>
|
||
|
</select>
|
||
|
|
||
|
<!-- 接口列表 -->
|
||
|
<select id="listPO" parameterType="map" resultMap="apiPO">
|
||
|
SELECT
|
||
|
t1.api_id,
|
||
|
t1.system_id,
|
||
|
t1.title,
|
||
|
t1.summary,
|
||
|
t1.url,
|
||
|
t1.method,
|
||
|
t1.request_example_url,
|
||
|
t1.request_example_body,
|
||
|
t1.response_success_example,
|
||
|
t1.response_fail_example,
|
||
|
t1.audit_status,
|
||
|
t1.audit_time,
|
||
|
t1.auditor,
|
||
|
t1.audit_reason,
|
||
|
t1.is_publish,
|
||
|
t1.publish_time,
|
||
|
t1.is_can_claim,
|
||
|
t1.is_usable,
|
||
|
t1.gmt_create,
|
||
|
t1.creator,
|
||
|
t1.gmt_modified,
|
||
|
t1.modifier,
|
||
|
t1.is_delete
|
||
|
FROM
|
||
|
api_api t1
|
||
|
WHERE
|
||
|
t1.is_delete = 0
|
||
|
<if test="keywords != null and keywords != ''">
|
||
|
AND (
|
||
|
<!-- 这里添加其他条件 -->
|
||
|
t1.id LIKE CONCAT('%', #{keywords}, '%')
|
||
|
)
|
||
|
</if>
|
||
|
<if test="startTime != null and startTime != ''">
|
||
|
AND
|
||
|
LEFT(t1.gmt_create, 10) <![CDATA[ >= ]]> #{startTime}
|
||
|
</if>
|
||
|
<if test="endTime != null and endTime != ''">
|
||
|
AND
|
||
|
LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
|
||
|
</if>
|
||
|
<if test="apiIds != null and apiIds.size > 0">
|
||
|
AND
|
||
|
t1.api_id IN
|
||
|
<foreach collection="apiIds" index="index" open="(" separator="," close=")">
|
||
|
#{apiIds[${index}]}
|
||
|
</foreach>
|
||
|
</if>
|
||
|
</select>
|
||
|
|
||
|
<!-- 接口统计 -->
|
||
|
<select id="count" parameterType="map" resultType="Integer">
|
||
|
SELECT
|
||
|
COUNT(*)
|
||
|
FROM
|
||
|
api_api t1
|
||
|
WHERE
|
||
|
t1.is_delete = 0
|
||
|
</select>
|
||
|
|
||
|
</mapper>
|