File tree Expand file tree Collapse file tree 3 files changed +17
-3
lines changed
main/java/com/tinyengine/it
test/java/com/tinyengine/it/service/material/impl Expand file tree Collapse file tree 3 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -94,8 +94,16 @@ public interface BlockGroupBlockMapper extends BaseMapper<BlockGroupBlock> {
9494 * 通过区块分组id和区块删除区块与分组关联关系
9595 * @param blockId the block id
9696 * @param groupId the block group id
97- * @return the list
97+ * @return the Integer
9898 */
9999 @ Delete ("delete from r_block_group_block where block_group_id = #{groupId} and block_id = #{blockId}" )
100100 Integer deleteByGroupIdAndBlockId (Integer groupId , Integer blockId );
101+
102+ /**
103+ * 通过区块id删除区块与分组关联关系
104+ * @param blockId the block id
105+ * @return the Integer
106+ */
107+ @ Delete ("delete from r_block_group_block where block_id = #{blockId}" )
108+ Integer deleteByBlockId (Integer blockId );
101109}
Original file line number Diff line number Diff line change @@ -153,7 +153,8 @@ public List<Block> queryBlockByCondition(Block block) {
153153 */
154154 @ Override
155155 public Integer deleteBlockById (Integer id ) {
156- return baseMapper .deleteBlockById (id );
156+ baseMapper .deleteBlockById (id );
157+ return blockGroupBlockMapper .deleteByBlockId (id );
157158 }
158159
159160 /**
@@ -171,7 +172,7 @@ public Result<BlockDto> updateBlockById(BlockParam blockParam) {
171172 if (blockResult == null ) {
172173 return Result .failed (ExceptionEnum .CM001 );
173174 }
174- if (!Objects .equals (blockResult .getAppId (), blockParam . getAppId ())) {
175+ if (!Objects .equals (blockResult .getOccupierBy (), loginUserContext . getLoginUserId ())) {
175176 return Result .failed (ExceptionEnum .CM007 );
176177 }
177178 // 把前端传参赋值给实体
Original file line number Diff line number Diff line change 2727import com .tinyengine .it .common .base .Result ;
2828import com .tinyengine .it .common .context .LoginUserContext ;
2929import com .tinyengine .it .mapper .AppMapper ;
30+ import com .tinyengine .it .mapper .BlockGroupBlockMapper ;
3031import com .tinyengine .it .mapper .BlockGroupMapper ;
3132import com .tinyengine .it .mapper .BlockMapper ;
3233import com .tinyengine .it .mapper .UserMapper ;
@@ -69,6 +70,9 @@ class BlockServiceImplTest {
6970 @ Mock
7071 private LoginUserContext loginUserContext ;
7172
73+ @ Mock
74+ private BlockGroupBlockMapper blockGroupBlockMapper ;
75+
7276 @ InjectMocks
7377 private BlockServiceImpl blockServiceImpl ;
7478
@@ -110,6 +114,7 @@ void testQueryBlockByCondition() {
110114 @ Test
111115 void testDeleteBlockById () {
112116 when (blockMapper .deleteBlockById (123 )).thenReturn (1 );
117+ when (blockGroupBlockMapper .deleteByBlockId (123 )).thenReturn (1 );
113118
114119 Integer result = blockServiceImpl .deleteBlockById (123 );
115120 Assertions .assertEquals (1 , result );
You can’t perform that action at this time.
0 commit comments