summaryrefslogtreecommitdiffstats
path: root/appmarket-persistence/src/main/java/app/market/persistence/xml/app/AppMapper.xml
blob: d025f54ce6aaf2cdd8648ca21cbaacf76172af6e (plain)
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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
<?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="app.market.persistence.mapper.app.AppMapper" >
  <resultMap id="BaseResultMap" type="App" >
    <id column="APP_ID" property="appId" jdbcType="CHAR" />
    <result column="APP_NAME" property="appName" jdbcType="VARCHAR" />
    <result column="APP_ABSTRACT" property="appAbstract" jdbcType="VARCHAR" />
    <result column="APP_TYPE_ID" property="typeId" jdbcType="CHAR" />
    <result column="APP_DEVICE_TYPE_ID" property="appDeviceTypeId" jdbcType="CHAR" />
    <result column="APP_DEVICE_TYPE_NAME" property="appDeviceTypeName" jdbcType="CHAR" />
    <result column="TYPE_NAME" property="typeName" jdbcType="VARCHAR" />
    <result column="DEVELOPER" property="developer" jdbcType="CHAR" />
    <result column="USER_NAME" property="developerName" jdbcType="VARCHAR" />
    <result column="VERSION_NAME" property="versionName" jdbcType="VARCHAR" />
    <result column="FILE_PATH" property="verFilePath" jdbcType="VARCHAR" />
    <result column="SIZE" property="verFileSize" jdbcType="INTEGER" />
    <result column="VERSION_CREATE_DATE" property="verCreateDate" jdbcType="TIMESTAMP" />
    <result column="APP_CREATE_DATE" property="createDate" jdbcType="TIMESTAMP" />
    <result column="APP_UPDATE_DATE" property="updateDate" jdbcType="TIMESTAMP" />
    <result column="APP_IS_DEL" property="isDel" jdbcType="CHAR" />
    <result column="MD5" property="hashcode" jdbcType="CHAR" />
    <result column="APP_IS_PUBLIC" property="appIsPublic" jdbcType="CHAR" />
    <result column="PUBLIC_LABLE" property="appIsPublicLable" jdbcType="CHAR" />
    <result column="APP_VERSION_ID" property="appVersionId" jdbcType="VARCHAR" />
    <result column="APP_ID_CUSTOM" property="appIdCustom" jdbcType="VARCHAR" />
    <result column="IMAGE_PATH" property="imagePath" jdbcType="VARCHAR" />
  </resultMap>
  <sql id="Example_Where_Clause" >
    <where >
      <foreach collection="oredCriteria" item="criteria" separator="or" >
        <if test="criteria.valid" >
          <trim prefix="(" suffix=")" prefixOverrides="and" >
            <foreach collection="criteria.criteria" item="criterion" >
              <choose >
                <when test="criterion.noValue" >
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue" >
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue" >
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue" >
                  and ${criterion.condition}
                  <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Update_By_Example_Where_Clause" >
    <where >
      <foreach collection="example.oredCriteria" item="criteria" separator="or" >
        <if test="criteria.valid" >
          <trim prefix="(" suffix=")" prefixOverrides="and" >
            <foreach collection="criteria.criteria" item="criterion" >
              <choose >
                <when test="criterion.noValue" >
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue" >
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue" >
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue" >
                  and ${criterion.condition}
                  <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Base_Column_List" >
    APP_ID, APP_NAME, APP_ABSTRACT,
    APP_TYPE_ID,APP_ID_CUSTOM,IMAGE_PATH,
    (select category.DIC_LABEL
      from t_dictionary as category
      where category.DIC_VALUE = APP_TYPE_ID and category.DIC_TYPE="0100"
    ) as TYPE_NAME,
    DEVELOPER,USER_NAME,
    APP_VERSION_ID, APP_CREATE_DATE, APP_UPDATE_DATE, APP_IS_DEL,
    FILE_PATH, SIZE, VERSION_CREATE_DATE, MD5, VERSION_NAME,
    APP_IS_PUBLIC,
    (select public.DIC_LABEL
      from t_dictionary as public
      where public.DIC_VALUE = APP_IS_PUBLIC and public.DIC_TYPE="0102"
    ) as PUBLIC_LABLE,
    APP_DEVICE_TYPE_ID,
    (select device.DIC_LABEL
      from t_dictionary as device
      where device.DIC_VALUE = APP_DEVICE_TYPE_ID and device.DIC_TYPE="0101"
    ) as APP_DEVICE_TYPE_NAME
  </sql>
  <select id="selectByExample" resultMap="BaseResultMap" parameterType="AppExample" >
    select
    <if test="distinct" >
      distinct
    </if>
    'true' as QUERYID,
    <include refid="Base_Column_List" />
    from t_app
    left join t_user on DEVELOPER = USER_ID
    left join t_app_version on (APP_VERSION_ID = VERSION_ID and APP_ID = V_APP_ID)
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null" >
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
    select
    <include refid="Base_Column_List" />
    from t_app
    left join t_user on DEVELOPER = USER_ID
    left join t_app_version on (APP_VERSION_ID = VERSION_ID and APP_ID = V_APP_ID)
    where APP_ID = #{appId,jdbcType=CHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
    delete from t_app
    where APP_ID = #{appId,jdbcType=CHAR}
  </delete>
  <delete id="deleteByExample" parameterType="AppExample" >
    delete from t_app
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="App" >
    insert into t_app (APP_ID, APP_NAME, APP_ABSTRACT,
      APP_TYPE_ID, APP_DEVICE_TYPE_ID, DEVELOPER, APP_CREATE_DATE,
      APP_UPDATE_DATE, APP_IS_DEL,APP_VERSION_ID, APP_IS_PUBLIC,
      APP_ID_CUSTOM)
    values (#{appId,jdbcType=CHAR}, #{appName,jdbcType=VARCHAR}, #{appAbstract,jdbcType=VARCHAR},
      #{typeId,jdbcType=CHAR}, #{appDeviceTypeId,jdbcType=CHAR}, #{developer,jdbcType=CHAR}, #{createDate,jdbcType=TIMESTAMP},
      #{updateDate,jdbcType=TIMESTAMP}, #{isDel,jdbcType=CHAR}, #{appVersionId,jdbcType=VARCHAR}, #{appIsPublic,jdbcType=CHAR},
      #{appIdCustom,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="App" >
    insert into t_app
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="appId != null" >
        APP_ID,
      </if>
      <if test="appName != null" >
        APP_NAME,
      </if>
      <if test="appAbstract != null" >
        APP_ABSTRACT,
      </if>
      <if test="typeId != null" >
        APP_TYPE_ID,
      </if>
      <if test="appDeviceTypeId != null" >
        APP_DEVICE_TYPE_ID,
      </if>
      <if test="developer != null" >
        DEVELOPER,
      </if>
      <if test="createDate != null" >
        APP_CREATE_DATE,
      </if>
      <if test="updateDate != null" >
        APP_UPDATE_DATE,
      </if>
      <if test="isDel != null" >
        APP_IS_DEL,
      </if>
      <if test="appVersionId != null" >
        APP_VERSION_ID,
      </if>
      <if test="appIsPublic != null" >
        APP_IS_PUBLIC,
      </if>
      <if test="appIdCustom != null" >
        APP_ID_CUSTOM,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="appId != null" >
        #{appId,jdbcType=CHAR},
      </if>
      <if test="appName != null" >
        #{appName,jdbcType=VARCHAR},
      </if>
      <if test="appAbstract != null" >
        #{appAbstract,jdbcType=VARCHAR},
      </if>
      <if test="typeId != null" >
        #{typeId,jdbcType=CHAR},
      </if>
      <if test="appDeviceTypeId != null" >
        #{appDeviceTypeId,jdbcType=CHAR},
      </if>
      <if test="developer != null" >
        #{developer,jdbcType=CHAR},
      </if>
      <if test="createDate != null" >
        #{createDate,jdbcType=TIMESTAMP},
      </if>
      <if test="updateDate != null" >
        #{updateDate,jdbcType=TIMESTAMP},
      </if>
      <if test="isDel != null" >
        #{isDel,jdbcType=CHAR},
      </if>
      <if test="appVersionId != null" >
        #{appVersionId,jdbcType=VARCHAR},
      </if>
      <if test="appIsPublic != null" >
        #{appIsPublic,jdbcType=CHAR},
      </if>
      <if test="appIdCustom != null" >
        #{appIdCustom,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="AppExample" resultType="java.lang.Integer" >
    select count(*) from t_app
    left join t_user on DEVELOPER = USER_ID
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map" >
    update t_app
    <set >
      <if test="record.appId != null" >
        APP_ID = #{record.appId,jdbcType=CHAR},
      </if>
      <if test="record.appName != null" >
        APP_NAME = #{record.appName,jdbcType=VARCHAR},
      </if>
      <if test="record.appAbstract != null" >
        APP_ABSTRACT = #{record.appAbstract,jdbcType=VARCHAR},
      </if>
      <if test="record.typeId != null" >
        APP_TYPE_ID = #{record.typeId,jdbcType=CHAR},
      </if>
      <if test="record.appDeviceTypeId != null" >
        APP_DEVICE_TYPE_ID = #{record.appDeviceTypeId,jdbcType=CHAR},
      </if>
      <if test="record.developer != null" >
        DEVELOPER = #{record.developer,jdbcType=CHAR},
      </if>
      <if test="record.createDate != null" >
        APP_CREATE_DATE = #{record.createDate,jdbcType=TIMESTAMP},
      </if>
      <if test="record.updateDate != null" >
        APP_UPDATE_DATE = #{record.updateDate,jdbcType=TIMESTAMP},
      </if>
      <if test="record.isDel != null" >
        APP_IS_DEL = #{record.isDel,jdbcType=CHAR},
      </if>
      <if test="record.appVersionId != null" >
        APP_VERSION_ID = #{record.appVersionId,jdbcType=VARCHAR},
      </if>
      <if test="record.appIsPublic != null" >
        APP_IS_PUBLIC = #{record.appIsPublic,jdbcType=CHAR},
      </if>
      <if test="record.appIdCustom != null" >
        APP_ID_CUSTOM = #{record.appIdCustom,jdbcType=VARCHAR},
      </if>
    </set>
    <if test="_parameter != null" >
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map" >
    update t_app
    set APP_ID = #{record.appId,jdbcType=CHAR},
      APP_NAME = #{record.appName,jdbcType=VARCHAR},
      APP_ABSTRACT = #{record.appAbstract,jdbcType=VARCHAR},
      APP_TYPE_ID = #{record.typeId,jdbcType=CHAR},
      APP_DEVICE_TYPE_ID = #{record.appDeviceTypeId,jdbcType=CHAR},
      DEVELOPER = #{record.developer,jdbcType=CHAR},
      APP_CREATE_DATE = #{record.createDate,jdbcType=TIMESTAMP},
      APP_UPDATE_DATE = #{record.updateDate,jdbcType=TIMESTAMP},
      APP_VERSION_ID = #{record.appVersionId,jdbcType=VARCHAR},
      APP_IS_DEL = #{record.isDel,jdbcType=CHAR},
      APP_IS_PUBLIC = #{record.appIsPublic,jdbcType=CHAR}
      APP_ID_CUSTOM = #{record.appIdCustom,jdbcType=VARCHAR}
    <if test="_parameter != null" >
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="App" >
    update t_app
    <set >
      <if test="appName != null" >
        APP_NAME = #{appName,jdbcType=VARCHAR},
      </if>
      <if test="appAbstract != null" >
        APP_ABSTRACT = #{appAbstract,jdbcType=VARCHAR},
      </if>
      <if test="typeId != null" >
        APP_TYPE_ID = #{typeId,jdbcType=CHAR},
      </if>
      <if test="appDeviceTypeId != null" >
        APP_DEVICE_TYPE_ID = #{appDeviceTypeId,jdbcType=CHAR},
      </if>
      <if test="developer != null" >
        DEVELOPER = #{developer,jdbcType=CHAR},
      </if>
      <if test="createDate != null" >
        APP_CREATE_DATE = #{createDate,jdbcType=TIMESTAMP},
      </if>
      <if test="updateDate != null" >
        APP_UPDATE_DATE = #{updateDate,jdbcType=TIMESTAMP},
      </if>
      <if test="appVersionId != null" >
      	APP_VERSION_ID = #{appVersionId,jdbcType=VARCHAR},
      </if>
      <if test="isDel != null" >
        APP_IS_DEL = #{isDel,jdbcType=CHAR},
      </if>
      <if test="appIsPublic != null" >
        APP_IS_PUBLIC = #{appIsPublic,jdbcType=CHAR},
      </if>
      <if test="appIdCustom != null" >
        APP_ID_CUSTOM = #{appIdCustom,jdbcType=VARCHAR},
      </if>
    </set>
    where APP_ID = #{appId,jdbcType=CHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="App" >
    update t_app
    set APP_NAME = #{appName,jdbcType=VARCHAR},
      APP_ABSTRACT = #{appAbstract,jdbcType=VARCHAR},
      APP_TYPE_ID = #{typeId,jdbcType=CHAR},
      APP_DEVICE_TYPE_ID = #{appDeviceTypeId,jdbcType=CHAR},
      DEVELOPER = #{developer,jdbcType=CHAR},
      APP_CREATE_DATE = #{createDate,jdbcType=TIMESTAMP},
      APP_UPDATE_DATE = #{updateDate,jdbcType=TIMESTAMP},
      APP_VERSION_ID = #{appVersionId,jdbcType=VARCHAR},
      APP_IS_DEL = #{isDel,jdbcType=CHAR},
      APP_IS_PUBLIC = #{appIsPublic,jdbcType=CHAR},
      APP_ID_CUSTOM = #{appIdCustom,jdbcType=VARCHAR}
    where APP_ID = #{appId,jdbcType=CHAR}
  </update>
  <update id="deleteByAppId" parameterType="java.lang.String" >
    update t_app
    set  APP_IS_DEL = "1", APP_ID_CUSTOM = concat(APP_ID_CUSTOM,"-",APP_ID)
    where APP_ID = #{appId,jdbcType=CHAR}
  </update>
  <select id="selectByCustomId" resultMap="BaseResultMap" parameterType="java.lang.String" >
    select
    <include refid="Base_Column_List" />
    from t_app
    left join t_user on DEVELOPER = USER_ID
    left join t_app_version on (APP_VERSION_ID = VERSION_ID and APP_ID = V_APP_ID)
    where APP_ID_CUSTOM = #{appIdCustom,jdbcType=VARCHAR}
  </select>

</mapper>