TdCThirdAuthorizationPushSMapper.xml
3.82 KB
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
<?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.TdCThirdAuthorizationPushSMapper">
<resultMap id="BaseResultMap" type="com.zteits.pay.domain.TdCThirdAuthorizationPush">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="push_id" jdbcType="VARCHAR" property="pushId" />
<result column="app_id" jdbcType="VARCHAR" property="appId" />
<result column="pub_key" jdbcType="VARCHAR" property="pubKey" />
<result column="secret_key" jdbcType="VARCHAR" property="secretKey" />
<result column="source_type" jdbcType="INTEGER" property="sourceType" />
<result column="push_rule_type" jdbcType="INTEGER" property="pushRuleType" />
<result column="push_rule" jdbcType="VARCHAR" property="pushRule" />
<result column="push_ip_url" jdbcType="VARCHAR" property="pushIpUrl" />
<result column="description" jdbcType="VARCHAR" property="description" />
<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="modify_date" jdbcType="TIMESTAMP" property="modifyDate" />
<result column="org_id" jdbcType="BIGINT" property="orgId" />
</resultMap>
<sql id="Base_Column_List">
id, push_id, app_id, pub_key, secret_key, source_type, push_rule_type, push_rule,
push_ip_url, description, data_state, create_empid, create_date, modfiy_empid, modify_date,
org_id
</sql>
<select id="selecthirdAuthorizationPushList" parameterType="com.zteits.pay.domain.TdCThirdAuthorizationPushDO"
resultType="com.zteits.pay.domain.TdCThirdAuthorizationPushDO">
select MAX(a.push_id) pushId, -- 聚合:取分组内最大的push_id
MAX(a.app_id) appId, -- 聚合:取分组内最大的app_id
MAX(a.pub_key) pubKey, -- 聚合:取分组内最大的pubKey
MAX(a.secret_key) secretKey, -- 聚合:取分组内最大的secretKey
a.source_type sourceType, -- 分组列,可直接查询
MAX(a.push_rule_type) pushRuleType,
MAX(a.push_rule) pushRule,
MAX(a.push_ip_url) pushIpUrl,
b.push_type pushType, -- 分组列,可直接查询
MAX(a.create_empid) createEmpid,
MAX(a.modfiy_empid) modfiyEmpid,
MAX(a.description) description
from td_c_third_authorization_push a
inner join td_c_third_authorization_push_detail b -- 推荐显式JOIN,替代隐式逗号连接
on a.push_id = b.rlt_push_id
where a.data_state = 1
and b.data_state = 1
and a.org_id = #{orgId}
and b.push_type = #{pushType}
group by a.source_type, b.push_type
</select>
<select id="selecthirdAuthorizationPushBySouceType" parameterType="com.zteits.pay.domain.TdCThirdAuthorizationPushDO"
resultType="com.zteits.pay.domain.TdCThirdAuthorizationPushDO">
select
a.push_id pushId,
a.app_id appId,
a.pub_key pubKey,
a.secret_key secretKey,
a.source_type sourceType,
a.push_rule_type pushRuleType,
a.push_rule pushRule,
a.push_ip_url pushIpUrl,
b.push_type pushType
from td_c_third_authorization_push a left join td_c_third_authorization_push_detail b
on a.push_id = b.rlt_push_id and b.data_state = 1 and b.pl_no = #{plNo}
where a.source_type = #{sourceType} and a.data_state = 1
group by a.source_type
</select>
</mapper>