潘志宝
2024-08-15 31802db28f0dd6f34b50e6e588591ad1d6c3e4c1
提交 | 用户 | 时间
a6de49 1 <?xml version="1.0" encoding="UTF-8"?>
H 2 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3 <mapper namespace="com.iailab.module.data.gateway.dao.ApiAuthorizedDao">
4     <resultMap id="ApiAuthorizedEntity" type="com.iailab.module.data.gateway.entity.ApiAuthorizedEntity">
5         <result property="id" column="id"/>
6         <result property="appId" column="app_id"/>
7         <result property="appKey" column="app_key"/>
8         <result property="serverName" column="server_name"/>
9         <result property="apiId" column="api_id"/>
10         <result property="apiName" column="api_name"/>
11         <result property="limitMin" column="limit_min"/>
12         <result property="limitHour" column="limit_hour"/>
13         <result property="limitDay" column="limit_day"/>
14         <result property="createTime" column="create_time"/>
15     </resultMap>
16
17     <resultMap id="SysGatewayApi" type="com.iailab.module.data.gateway.vo.SysGatewayApi">
18         <result property="appKey" column="app_key"/>
19         <result property="apiStatus" column="api_status"/>
20         <result property="apiAddress" column="api_address"/>
21         <result property="serverName" column="server_name"/>
22     </resultMap>
23
24     <select id="queryList" parameterType="map" resultMap="ApiAuthorizedEntity">
25       SELECT t1.*,
26         t2.api_name,
27         t2.api_address,
28         t3.server_name
29       FROM t_api_authorized t1
30       LEFT JOIN t_api_info t2 ON t2.id = t1.api_id
31       LEFT JOIN t_api_server t3 ON t3.id = t2.api_server_id
32       <where>
33           <if test="params.appId != null and params.appId != ''">
34             AND t1.app_id = #{params.appId}
35           </if>
36       </where>
37       ORDER BY t1.create_time DESC
38     </select>
39
40     <select id="queryListGatewayApi" parameterType="map" resultMap="SysGatewayApi">
41       SELECT
42         t1.app_key,
43         t2.api_address,
44         t3.server_name,
45         t2.status as api_status
46       FROM
47           t_api_authorized t1
48       LEFT JOIN t_api_info t2 ON t2.id = t1.api_id
49       LEFT JOIN t_api_server t3 ON t3.id = t2.api_server_id
50         <where>
51             <if test="apiStatus != null and apiStatus != ''">
52                 AND t2.status = #{apiStatus}
53             </if>
54             <if test="serverStatus != null and serverStatus != ''">
55                 AND t3.status = #{serverStatus}
56             </if>
57         </where>
58     </select>
59
60 </mapper>