Skip to content

Commit d5dbde0

Browse files
authored
fix: Modify block group (#173)
* fix: update page history bug * fix: format code and fix style issue * fix: modify page histiry entity * feat: add code submission rules * fix: modify app schema for test * fix: modify t_i18n_entry u_idx_i18n_entity * fix: modify block update api * fix: Modify code format * fix: modify block group api * fix: modify block group mapper * fix: Update checkstyle.yml * fix: Modify block create and update api * fix: Modify code format * fix: Modify block group
1 parent d94f8d9 commit d5dbde0

File tree

3 files changed

+26
-20
lines changed

3 files changed

+26
-20
lines changed

base/src/main/java/com/tinyengine/it/service/material/impl/BlockGroupServiceImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ public List<BlockGroup> getBlockGroupByIdsOrAppId(List<Integer> ids, Integer app
183183
blockGroupsListResult = blockGroupMapper.queryAllBlockGroupAndBlock( blockCreatedBy, groupCreatedBy);
184184
}
185185

186-
if (blockGroupsListResult.isEmpty()) {
186+
if (blockGroupsListResult.isEmpty() || blockGroupsListResult.get(0).getId() == null) {
187187
return blockGroupsListResult;
188188
}
189189
// 对查询的结果的区块赋值current_version

base/src/main/java/com/tinyengine/it/service/material/impl/BlockServiceImpl.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,6 @@ public Result<BlockDto> deploy(BlockBuildDto blockBuildDto) {
556556
blockParam.setLatestVersion(blockHistory.getVersion());
557557
blockParam.setId(blockDto.getId());
558558
blockParam.setGroups(null);
559-
560559
return updateBlockById(blockParam, blockDto.getAppId());
561560
} catch (Exception e) {
562561
return Result.failed(ExceptionEnum.CM001);

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

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -183,12 +183,14 @@
183183
r_block_group_block rbg ON rbg.block_group_id = bg.id
184184
LEFT JOIN
185185
t_block b ON b.id = rbg.block_id
186-
<if test="blockCreatedBy != null">
187-
AND b.created_by = #{blockCreatedBy}
188-
</if>
189-
<if test="blockCreatedBy == null">
190-
AND b.last_build_info is not null and b.content is not null and b.assets is not null
191-
</if>
186+
<choose>
187+
<when test="blockCreatedBy != null">
188+
AND b.created_by = #{blockCreatedBy}
189+
</when>
190+
<otherwise>
191+
AND b.last_build_info is not null and b.content is not null
192+
</otherwise>
193+
</choose>
192194
<where>
193195
<if test="groupCreatedBy != null">
194196
AND bg.created_by = #{groupCreatedBy}
@@ -246,12 +248,14 @@
246248
r_block_group_block rbg ON rbg.block_group_id = bg.id
247249
LEFT JOIN
248250
t_block b ON b.id = rbg.block_id
249-
<if test="blockCreatedBy != null">
250-
AND b.created_by = #{blockCreatedBy}
251-
</if>
252-
<if test="blockCreatedBy == null">
253-
AND b.last_build_info is not null and b.content is not null and b.assets is not null
254-
</if>
251+
<choose>
252+
<when test="blockCreatedBy != null">
253+
AND b.created_by = #{blockCreatedBy}
254+
</when>
255+
<otherwise>
256+
AND b.last_build_info is not null and b.content is not null
257+
</otherwise>
258+
</choose>
255259
<where>
256260
<if test="appId != null">
257261
AND bg.app_id = #{appId}
@@ -311,12 +315,14 @@
311315
r_block_group_block rbg ON rbg.block_group_id = bg.id
312316
LEFT JOIN
313317
t_block b ON b.id = rbg.block_id
314-
<if test="blockCreatedBy != null">
315-
AND b.created_by = #{blockCreatedBy}
316-
</if>
317-
<if test="blockCreatedBy == null">
318-
AND b.last_build_info is not null and b.content is not null and b.assets is not null
319-
</if>
318+
<choose>
319+
<when test="blockCreatedBy != null">
320+
AND b.created_by = #{blockCreatedBy}
321+
</when>
322+
<otherwise>
323+
AND b.last_build_info is not null and b.content is not null
324+
</otherwise>
325+
</choose>
320326
<where>
321327
<if test="id != null">
322328
AND bg.id = #{id}
@@ -327,6 +333,7 @@
327333
</where>
328334
</select>
329335

336+
330337
<!-- 根据条件查询表t_block_group数据 -->
331338
<select id="queryBlockGroupByCondition" resultMap="BlockGroupMap">
332339
SELECT

0 commit comments

Comments
 (0)