forked from opentiny/tiny-engine-backend-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAppExtensionMapper.xml
More file actions
190 lines (178 loc) · 6.16 KB
/
AppExtensionMapper.xml
File metadata and controls
190 lines (178 loc) · 6.16 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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
<?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.tinyengine.it.mapper.AppExtensionMapper">
<!-- 通用设置 -->
<!-- 通用查询列 -->
<sql id="Base_Column_List">
id
, name, type, content, app_id, category, created_by, last_updated_by, created_time, last_updated_time,
tenant_id, renter_id, site_id
</sql>
<!-- 通用条件列 -->
<sql id="AppExtensionByCondition">
<if test="name!=null and name!=''">
AND name = #{name}
</if>
<if test="type!=null and type!=''">
AND type = #{type}
</if>
<if test="content!=null and content!=''">
AND content = #{content}
</if>
<if test="app!=null and app!=''">
AND app_id = #{app}
</if>
<if test="category!=null and category!=''">
AND category = #{category}
</if>
<if test="createdBy!=null and createdBy!=''">
AND created_by = #{createdBy}
</if>
<if test="lastUpdatedBy!=null and lastUpdatedBy!=''">
AND last_updated_by = #{lastUpdatedBy}
</if>
<if test="createdTime!=null and createdTime!=''">
AND created_time = #{createdTime}
</if>
<if test="lastUpdatedTime!=null and lastUpdatedTime!=''">
AND last_updated_time = #{lastUpdatedTime}
</if>
<if test="tenantId!=null and tenantId!=''">
AND tenant_id = #{tenantId}
</if>
<if test="renterId!=null and renterId!=''">
AND renter_id = #{renterId}
</if>
<if test="siteId!=null and siteId!=''">
AND site_id = #{siteId}
</if>
</sql>
<!-- 通用设置列 -->
<sql id="AppExtensionSetColumns">
<if test="name!=null and name!=''">
name = #{name},
</if>
<if test="type!=null and type!=''">
type = #{type},
</if>
<if test="content!=null and content!=''">
content = #{content},
</if>
<if test="app!=null and app!=''">
app_id = #{app},
</if>
<if test="category!=null and category!=''">
category = #{category},
</if>
<if test="createdBy!=null and createdBy!=''">
created_by = #{createdBy},
</if>
<if test="lastUpdatedBy!=null and lastUpdatedBy!=''">
last_updated_by = #{lastUpdatedBy},
</if>
<if test="createdTime!=null and createdTime!=''">
created_time = #{createdTime},
</if>
<if test="lastUpdatedTime!=null and lastUpdatedTime!=''">
last_updated_time = #{lastUpdatedTime},
</if>
<if test="tenantId!=null and tenantId!=''">
tenant_id = #{tenantId},
</if>
<if test="renterId!=null and renterId!=''">
renter_id = #{renterId},
</if>
<if test="siteId!=null and siteId!=''">
site_id = #{siteId},
</if>
</sql>
<!-- 通用查询映射结果 -->
<resultMap id="AppExtensionMap" type="com.tinyengine.it.model.entity.AppExtension">
<id column="id" property="id"/>
<result column="name" property="name"/>
<result column="type" property="type"/>
<result column="content" property="content"/>
<result column="app_id" property="app"/>
<result column="category" property="category"/>
<result column="created_by" property="createdBy"/>
<result column="last_updated_by" property="lastUpdatedBy"/>
<result column="created_time" property="createdTime"/>
<result column="last_updated_time" property="lastUpdatedTime"/>
<result column="tenant_id" property="tenantId"/>
<result column="renter_id" property="renterId"/>
<result column="site_id" property="siteId"/>
</resultMap>
<!-- 查询表t_app_extension所有数据 -->
<select id="queryAllAppExtension" resultMap="AppExtensionMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_app_extension
</select>
<!-- 根据主键id查询表t_app_extension信息 -->
<select id="queryAppExtensionById" resultMap="AppExtensionMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_app_extension
WHERE id=#{id}
</select>
<!-- 根据条件查询表t_app_extension数据 -->
<select id="queryAppExtensionByCondition" resultMap="AppExtensionMap">
SELECT
<include refid="Base_Column_List"/>
FROM t_app_extension
WHERE 1=1
<include refid="AppExtensionByCondition"/>
</select>
<!-- 根据主键id删除表t_app_extension数据 -->
<delete id="deleteAppExtensionById">
DELETE
FROM t_app_extension
WHERE id = #{id}
</delete>
<!-- 根据主键id更新表t_app_extension数据 -->
<update id="updateAppExtensionById" parameterType="com.tinyengine.it.model.entity.AppExtension">
UPDATE t_app_extension
<set>
<include refid="AppExtensionSetColumns"/>
</set>
<where>
id = #{id}
<if test="tenantId != null">
AND tenant_id = #{tenantId}
</if>
<if test="renterId != null">
AND renter_id = #{renterId}
</if>
</where>
</update>
<!-- 新增表t_app_extension数据 -->
<insert id="createAppExtension" useGeneratedKeys="true" keyProperty="id"
parameterType="com.tinyengine.it.model.entity.AppExtension">
INSERT INTO t_app_extension ( id
, name
, type
, content
, app_id
, category
, created_by
, last_updated_by
, created_time
, last_updated_time
, tenant_id
, renter_id
, site_id)
VALUES ( #{id}
, #{name}
, #{type}
, #{content}
, #{app}
, #{category}
, #{createdBy}
, #{lastUpdatedBy}
, #{createdTime}
, #{lastUpdatedTime}
, #{tenantId}
, #{renterId}
, #{siteId})
</insert>
</mapper>