DspPlatformMapper.xml
4.2 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<?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.parking.module.park.dsp.dal.mysql.DspPlatformMapper">
<!--
下级平台准入(dsp_platform)
注意:
1. secret_key / secret_key_prev 只在验签时读取,任何管理端查询都要在 Service 层清空后再返回;
2. 平台编码全局唯一(uk_platform_code),删除是软删(deleted = 1)。
-->
<select id="selectByCode" resultType="com.zteits.parking.module.park.dsp.dal.dataobject.DspPlatformDO">
SELECT * FROM dsp_platform
WHERE platform_code = #{platformCode}
AND deleted = 0
LIMIT 1
</select>
<select id="selectById" resultType="com.zteits.parking.module.park.dsp.dal.dataobject.DspPlatformDO">
SELECT * FROM dsp_platform
WHERE id = #{id}
AND deleted = 0
</select>
<sql id="listCondition">
deleted = 0
<if test="platformCode != null and platformCode != ''">
AND platform_code LIKE CONCAT('%', #{platformCode}, '%')
</if>
<if test="platformName != null and platformName != ''">
AND platform_name LIKE CONCAT('%', #{platformName}, '%')
</if>
<if test="status != null">
AND status = #{status}
</if>
</sql>
<select id="selectList" resultType="com.zteits.parking.module.park.dsp.dal.dataobject.DspPlatformDO">
SELECT * FROM dsp_platform
<where>
<include refid="listCondition"/>
</where>
ORDER BY id DESC
</select>
<select id="selectCount" resultType="java.lang.Long">
SELECT COUNT(*) FROM dsp_platform
<where>
<include refid="listCondition"/>
</where>
</select>
<insert id="insert" useGeneratedKeys="true" keyProperty="id">
INSERT INTO dsp_platform (
platform_code, platform_name, platform_type, contact_name, contact_phone, contact_email,
secret_key, secret_key_prev, prev_key_expire_time, ip_whitelist, data_scope, status,
remark, deleted, create_time, create_op, modify_time, modify_op
) VALUES (
#{platformCode}, #{platformName}, #{platformType}, #{contactName}, #{contactPhone}, #{contactEmail},
#{secretKey}, #{secretKeyPrev}, #{prevKeyExpireTime}, #{ipWhitelist}, #{dataScope}, #{status},
#{remark}, 0, #{createTime}, #{createOp}, #{modifyTime}, #{modifyOp}
)
</insert>
<update id="update">
UPDATE dsp_platform
SET platform_name = #{platformName},
platform_type = #{platformType},
contact_name = #{contactName},
contact_phone = #{contactPhone},
contact_email = #{contactEmail},
ip_whitelist = #{ipWhitelist},
data_scope = #{dataScope},
remark = #{remark},
modify_time = #{modifyTime},
modify_op = #{modifyOp}
WHERE id = #{id}
AND deleted = 0
</update>
<update id="updateStatus">
UPDATE dsp_platform
SET status = #{status}, modify_time = #{modifyTime}, modify_op = #{modifyOp}
WHERE id = #{id}
AND deleted = 0
</update>
<update id="updateSecret">
UPDATE dsp_platform
SET secret_key = #{secretKey},
secret_key_prev = #{secretKeyPrev},
prev_key_expire_time = #{prevKeyExpireTime},
modify_time = #{modifyTime},
modify_op = #{modifyOp}
WHERE id = #{id}
AND deleted = 0
</update>
<update id="updateLastReport">
UPDATE dsp_platform
SET last_report_time = #{lastReportTime}
<if test="lastSuccessTime != null">
, last_success_time = #{lastSuccessTime}
</if>
WHERE platform_code = #{platformCode}
AND deleted = 0
</update>
<update id="deleteById">
UPDATE dsp_platform
SET deleted = 1, modify_time = #{modifyTime}, modify_op = #{modifyOp}
WHERE id = #{id}
AND deleted = 0
</update>
</mapper>