From 4b113079ca584c4114f9c648c156f17006e1bae2 Mon Sep 17 00:00:00 2001 From: qiaoqinzheng Date: Fri, 21 Jul 2023 10:53:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=88=A0=E9=99=A4=E6=8A=A5?= =?UTF-8?q?=E8=AD=A6=E4=BA=BA=E8=81=94=E7=B3=BB=E4=BA=BA=E7=BB=84=E4=B8=8B?= =?UTF-8?q?=E5=8D=95=E7=8B=AC=E8=81=94=E7=B3=BB=E4=BA=BA=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AlarmContactGroupController.java | 6 +++++ .../service/IAlarmContactGroupService.java | 2 ++ .../impl/AlarmContactGroupServiceImpl.java | 24 +++++++++---------- 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/controller/AlarmContactGroupController.java b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/controller/AlarmContactGroupController.java index 0d2981dc..25640db7 100644 --- a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/controller/AlarmContactGroupController.java +++ b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/controller/AlarmContactGroupController.java @@ -45,4 +45,10 @@ public class AlarmContactGroupController { return alarmContactGroupService.deleteById(id); } + @DeleteMapping("deleteUserById") + @ApiOperation(value = "删除报警人联系人组下单独联系人", notes = "删除报警联系人组下单独联系人") + public Result deleteUserById(String id, String userId){ + return alarmContactGroupService.deleteUserById(id, userId); + } + } diff --git a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/IAlarmContactGroupService.java b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/IAlarmContactGroupService.java index 8bb41e4a..7ce6721f 100644 --- a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/IAlarmContactGroupService.java +++ b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/IAlarmContactGroupService.java @@ -17,4 +17,6 @@ public interface IAlarmContactGroupService extends IService { Result deleteById(String id); + Result deleteUserById(String id, String userId); + } diff --git a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/impl/AlarmContactGroupServiceImpl.java b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/impl/AlarmContactGroupServiceImpl.java index 76c3d6aa..bb2dcc68 100644 --- a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/impl/AlarmContactGroupServiceImpl.java +++ b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/impl/AlarmContactGroupServiceImpl.java @@ -69,8 +69,6 @@ public class AlarmContactGroupServiceImpl extends ServiceImpl userList = systemClient.findUserMap(); //根据id查询对应的数据 判断数据是否在数据库中 LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(AlarmContactGroup::getId, id); @@ -86,16 +84,6 @@ public class AlarmContactGroupServiceImpl extends ServiceImpl userIds = contactGroupMembers.stream().map(AlarmContactGroupMember::getUserId).collect(Collectors.toList()); alarmContactGroup.setUserIds(userIds); - //根据用户id获得对应的用户信息 - List sysUsers = new LinkedList<>(); - if (CollectionUtils.isNotEmpty(userList)){ - for (String userId:userIds) { - if (userList.containsKey(userId)){ - sysUsers.add(userList.get(userId)); - } - } - } - alarmContactGroup.setUsers(sysUsers); } result.setSuccess(true); result.setResult(alarmContactGroup); @@ -180,4 +168,16 @@ public class AlarmContactGroupServiceImpl extends ServiceImpl contactGroupMemberQueryWrapper = new LambdaQueryWrapper<>(); + contactGroupMemberQueryWrapper.eq(AlarmContactGroupMember::getGroupId, id); + contactGroupMemberQueryWrapper.eq(AlarmContactGroupMember::getUserId, userId); + alarmContactGroupMemberMapper.delete(contactGroupMemberQueryWrapper); + result.setSuccess(true); + result.success("删除成功"); + return result; + } + }