Skip to content

Commit bf97162

Browse files
authored
fix:根据id查询数据时,如id为空值会导致查询结果可能为多条记录引发TooManyResultsException问题修复 (#212)
1 parent 7210c0a commit bf97162

13 files changed

Lines changed: 13 additions & 40 deletions

base/src/main/resources/mappers/AppExtensionMapper.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,7 @@
147147
<include refid="AppExtensionSetColumns"/>
148148
</set>
149149
<where>
150-
<if test="id != null">
151-
AND id = #{id}
152-
</if>
150+
id = #{id}
153151
<if test="tenantId != null">
154152
AND tenant_id = #{tenantId}
155153
</if>

base/src/main/resources/mappers/AppMapper.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -328,9 +328,7 @@
328328
<include refid="Base_Column_List"/>
329329
FROM t_app
330330
<where>
331-
<if test="id != null">
332-
AND id = #{id}
333-
</if>
331+
id = #{id}
334332
</where>
335333
</select>
336334

base/src/main/resources/mappers/BlockGroupMapper.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -324,9 +324,7 @@
324324
</otherwise>
325325
</choose>
326326
<where>
327-
<if test="id != null">
328-
AND bg.id = #{id}
329-
</if>
327+
bg.id = #{id}
330328
<if test="groupCreatedBy != null">
331329
AND bg.created_by = #{groupCreatedBy}
332330
</if>

base/src/main/resources/mappers/BlockHistoryMapper.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,9 +249,7 @@
249249
<include refid="Base_Column_List"/>
250250
FROM t_block_history
251251
<where>
252-
<if test="id != null">
253-
AND id = #{id}
254-
</if>
252+
id = #{id}
255253
</where>
256254
</select>
257255

base/src/main/resources/mappers/BlockMapper.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,9 +243,7 @@
243243
<include refid="Base_Column_List"/>
244244
FROM t_block
245245
<where>
246-
<if test="id != null">
247-
AND id = #{id}
248-
</if>
246+
id = #{id}
249247
</where>
250248
</select>
251249

base/src/main/resources/mappers/ComponentLibraryMapper.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -337,9 +337,7 @@
337337
FROM t_component_library CL
338338
LEFT JOIN t_component C ON CL.id = C.library_id
339339
<where>
340-
<if test="id != null">
341-
AND CL.id = #{id}
342-
</if>
340+
CL.id = #{id}
343341
</where>
344342
</select>
345343

base/src/main/resources/mappers/ComponentMapper.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,9 +257,7 @@
257257
<include refid="Base_Column_List"/>
258258
FROM t_component
259259
<where>
260-
<if test="id != null">
261-
AND id = #{id}
262-
</if>
260+
id = #{id}
263261
</where>
264262
</select>
265263

base/src/main/resources/mappers/DatasourceMapper.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,7 @@
129129
<include refid="Base_Column_List"/>
130130
FROM t_datasource
131131
<where>
132-
<if test="id != null">
133-
AND id = #{id}
134-
</if>
132+
id = #{id}
135133
</where>
136134
</select>
137135

base/src/main/resources/mappers/I18nEntryMapper.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,7 @@
154154
FROM t_i18n_entry E
155155
LEFT JOIN t_i18n_lang L ON E.lang_id = L.id
156156
<where>
157-
<if test="id != null">
158-
AND E.id = #{id}
159-
</if>
157+
E.id = #{id}
160158
</where>
161159
</select>
162160

base/src/main/resources/mappers/MaterialMapper.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,9 +229,7 @@
229229
<include refid="Base_Column_List"/>
230230
FROM t_material
231231
<where>
232-
<if test="id != null">
233-
AND id = #{id}
234-
</if>
232+
id = #{id}
235233
</where>
236234
</select>
237235

0 commit comments

Comments
 (0)