Blame view

parking-module-pay/src/main/resources/mybatis/smapper/TdBApiSMapper.xml 2.5 KB
55f68655   王彪总   新项目
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
  <?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.zteits.pay.mapper.smapper.TdBApiSMapper">
    <resultMap id="BaseResultMap" type="com.zteits.pay.domain.TdBApi">
      <id column="id" jdbcType="BIGINT" property="id" />
      <result column="code" jdbcType="VARCHAR" property="code" />
      <result column="path" jdbcType="VARCHAR" property="path" />
      <result column="url" jdbcType="VARCHAR" property="url" />
      <result column="user_id" jdbcType="VARCHAR" property="userId" />
      <result column="api_type" jdbcType="INTEGER" property="apiType" />
      <result column="remark" jdbcType="VARCHAR" property="remark" />
      <result column="uddi" jdbcType="VARCHAR" property="uddi" />
      <result column="data_state" jdbcType="INTEGER" property="dataState" />
      <result column="create_empid" jdbcType="VARCHAR" property="createEmpid" />
      <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
      <result column="modfiy_empid" jdbcType="VARCHAR" property="modfiyEmpid" />
      <result column="modfiy_date" jdbcType="TIMESTAMP" property="modfiyDate" />
    </resultMap>
    <sql id="Base_Column_List">
      id, code, path, url, user_id, api_type, remark, uddi, data_state, create_empid, create_date, 
      modfiy_empid, modfiy_date
    </sql>
    <select id="queryApiHYCount" parameterType="java.lang.Integer" resultType="java.lang.Integer">
      
  	SELECT
  		count(a._count) count
  	FROM
  		(
  			SELECT
  				`code`,
  				count(`code`) _count
  			FROM
  				td_b_api_log
  			GROUP BY
  				`code`
  			HAVING
  				_count > 10
  		) a,
  		td_b_api b
  	WHERE
  		a.`code` = b.`code`
  	AND b.api_type =  #{apiType,jdbcType=INTEGER}
    </select>
    
    <select id="queryApiCount" parameterType="java.lang.Integer" resultType="java.lang.Integer">
      select 
      count(1) count
      from td_b_api
      where api_type= #{apiType,jdbcType=INTEGER}
    </select>
    
    <select id="queryApiRankingList" parameterType="java.lang.Integer" resultType="com.zteits.clouds.api.dto.pay.ApiListDTO">
      SELECT
  		a.uddi uddi,
  		a.url url,
  		count(b.`code`) apiCount
  	FROM
  		td_b_api a,
  		td_b_api_log b
  	WHERE
  		a.`code` = b.`code`
  	AND a.api_type = #{apiType,jdbcType=INTEGER}
  	GROUP BY
  		a.uddi,
  		a.url
  		order by apiCount desc
    </select>
    
     <select id="queryApiList" parameterType="java.lang.Integer" resultMap="BaseResultMap">
      select 
      <include refid="Base_Column_List" />
      from td_b_api
      where api_type = #{apiType,jdbcType=INTEGER}
    </select>
    
    
  </mapper>