From f4703186e07b6012be7afc7ad59298e3dfe997e1 Mon Sep 17 00:00:00 2001 From: shaoyong Date: Wed, 15 May 2024 10:41:29 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=9A=E7=9F=A5=E5=85=AC=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../op/system/api/domain/SysNoticeGroup.java | 6 ++--- .../controller/SysNoticeGroupController.java | 15 ++++++------ .../system/mapper/SysNoticeGroupMapper.java | 6 ++++- .../service/ISysNoticeGroupService.java | 5 +++- .../impl/SysNoticeGroupServiceImpl.java | 23 +++++++++++++++---- .../mapper/system/SysNoticeGroupMapper.xml | 20 ++++++++++++---- 6 files changed, 53 insertions(+), 22 deletions(-) diff --git a/op-api/op-api-system/src/main/java/com/op/system/api/domain/SysNoticeGroup.java b/op-api/op-api-system/src/main/java/com/op/system/api/domain/SysNoticeGroup.java index 30fb0dc7..1b8ad09b 100644 --- a/op-api/op-api-system/src/main/java/com/op/system/api/domain/SysNoticeGroup.java +++ b/op-api/op-api-system/src/main/java/com/op/system/api/domain/SysNoticeGroup.java @@ -17,7 +17,7 @@ public class SysNoticeGroup extends BaseEntity { /** * 公告ID */ - private Long id; + private String id; /** * 公告标题 @@ -46,11 +46,11 @@ public class SysNoticeGroup extends BaseEntity { private String[] groupNames; - public void setId(Long id) { + public void setId(String id) { this.id = id; } - public Long getId() { + public String getId() { return id; } diff --git a/op-modules/op-system/src/main/java/com/op/system/controller/SysNoticeGroupController.java b/op-modules/op-system/src/main/java/com/op/system/controller/SysNoticeGroupController.java index 35bc30af..41e979ac 100644 --- a/op-modules/op-system/src/main/java/com/op/system/controller/SysNoticeGroupController.java +++ b/op-modules/op-system/src/main/java/com/op/system/controller/SysNoticeGroupController.java @@ -61,10 +61,10 @@ public class SysNoticeGroupController extends BaseController { /** * 获取通知公告-班组详细信息 */ - @RequiresPermissions("noticeGroup:noticeGroup:query") @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") Long id) { - return success(sysNoticeGroupService.selectSysNoticeGroupById(id)); + public TableDataInfo getInfo(@PathVariable("id") String id) { + List list = sysNoticeGroupService.selectByNoticeId(id); + return getDataTable(list); } /** @@ -90,11 +90,10 @@ public class SysNoticeGroupController extends BaseController { /** * 删除通知公告-班组 */ - @RequiresPermissions("noticeGroup:noticeGroup:remove") - @Log(title = "通知公告-班组", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable Long[] ids) { - return toAjax(sysNoticeGroupService.deleteSysNoticeGroupByIds(ids)); + + @PostMapping("/delNoticeGroup") + public AjaxResult delNoticeGroup(@RequestBody SysNoticeGroup sysNoticeGroup) { + return toAjax(sysNoticeGroupService.deleteByNoticeId(sysNoticeGroup)); } @PostMapping("/teamBind") diff --git a/op-modules/op-system/src/main/java/com/op/system/mapper/SysNoticeGroupMapper.java b/op-modules/op-system/src/main/java/com/op/system/mapper/SysNoticeGroupMapper.java index fad50935..7bdba7a8 100644 --- a/op-modules/op-system/src/main/java/com/op/system/mapper/SysNoticeGroupMapper.java +++ b/op-modules/op-system/src/main/java/com/op/system/mapper/SysNoticeGroupMapper.java @@ -19,7 +19,7 @@ public interface SysNoticeGroupMapper { * @param id 通知公告-班组主键 * @return 通知公告-班组 */ - public SysNoticeGroup selectSysNoticeGroupById(Long id); + public List selectByNoticeId(String id); /** * 查询通知公告-班组列表 @@ -62,4 +62,8 @@ public interface SysNoticeGroupMapper { public int deleteSysNoticeGroupByIds(Long[] ids); public int getSerialNumber(); + + public List validData(SysNoticeGroup sysNoticeGroup); + + public int deleteByNotice(SysNoticeGroup sysNoticeGroup); } diff --git a/op-modules/op-system/src/main/java/com/op/system/service/ISysNoticeGroupService.java b/op-modules/op-system/src/main/java/com/op/system/service/ISysNoticeGroupService.java index 813ed1e6..e0cc7ebd 100644 --- a/op-modules/op-system/src/main/java/com/op/system/service/ISysNoticeGroupService.java +++ b/op-modules/op-system/src/main/java/com/op/system/service/ISysNoticeGroupService.java @@ -17,7 +17,7 @@ public interface ISysNoticeGroupService { * @param id 通知公告-班组主键 * @return 通知公告-班组 */ - public SysNoticeGroup selectSysNoticeGroupById(Long id); + public List selectByNoticeId(String id); /** * 查询通知公告-班组列表 @@ -59,4 +59,7 @@ public interface ISysNoticeGroupService { */ public int deleteSysNoticeGroupById(Long id); + public List validData(SysNoticeGroup sysNoticeGroup); + + public int deleteByNoticeId(SysNoticeGroup sysNoticeGroup); } diff --git a/op-modules/op-system/src/main/java/com/op/system/service/impl/SysNoticeGroupServiceImpl.java b/op-modules/op-system/src/main/java/com/op/system/service/impl/SysNoticeGroupServiceImpl.java index 8060ac79..7b6a362d 100644 --- a/op-modules/op-system/src/main/java/com/op/system/service/impl/SysNoticeGroupServiceImpl.java +++ b/op-modules/op-system/src/main/java/com/op/system/service/impl/SysNoticeGroupServiceImpl.java @@ -4,7 +4,6 @@ import java.util.List; import com.baomidou.dynamic.datasource.annotation.DS; import com.op.common.core.utils.DateUtils; -import com.op.common.core.utils.uuid.IdUtils; import com.op.common.security.utils.SecurityUtils; import com.op.system.api.domain.SysNoticeGroup; import org.springframework.beans.factory.annotation.Autowired; @@ -32,8 +31,9 @@ public class SysNoticeGroupServiceImpl implements ISysNoticeGroupService { * @return 通知公告-班组 */ @Override - public SysNoticeGroup selectSysNoticeGroupById(Long id) { - return sysNoticeGroupMapper.selectSysNoticeGroupById(id); + @DS("#header.poolName") + public List selectByNoticeId(String id) { + return sysNoticeGroupMapper.selectByNoticeId(id); } /** @@ -57,17 +57,19 @@ public class SysNoticeGroupServiceImpl implements ISysNoticeGroupService { @DS("#header.poolName") public int insertSysNoticeGroup(SysNoticeGroup sysNoticeGroup) { String[] groupCodes = sysNoticeGroup.getGroupCodes(); - if (groupCodes == null){ + if (groupCodes == null) { return 0; } String[] groupNames = sysNoticeGroup.getGroupNames(); Long noticeId = sysNoticeGroup.getNoticeId(); String username = SecurityUtils.getUsername(); + // 绑定前先清空旧数据 + sysNoticeGroupMapper.deleteByNotice(sysNoticeGroup); Long serialId = getSerialId(); int count = 0; for (int i = 0; i < groupCodes.length; i++) { - sysNoticeGroup.setId(serialId++); + sysNoticeGroup.setId(String.valueOf(serialId++)); sysNoticeGroup.setNoticeId(noticeId); sysNoticeGroup.setGroupCode(groupCodes[i]); sysNoticeGroup.setGroupName(groupNames[i]); @@ -112,6 +114,17 @@ public class SysNoticeGroupServiceImpl implements ISysNoticeGroupService { return sysNoticeGroupMapper.deleteSysNoticeGroupById(id); } + @Override + public List validData(SysNoticeGroup sysNoticeGroup) { + return sysNoticeGroupMapper.validData(sysNoticeGroup); + } + + @Override + @DS("#header.poolName") + public int deleteByNoticeId(SysNoticeGroup sysNoticeGroup) { + return sysNoticeGroupMapper.deleteByNotice(sysNoticeGroup); + } + @DS("#header.poolName") private Long getSerialId() { String dateToStr = DateUtils.parseDateToStr(DateUtils.YYYYMMDD, DateUtils.getNowDate()); diff --git a/op-modules/op-system/src/main/resources/mapper/system/SysNoticeGroupMapper.xml b/op-modules/op-system/src/main/resources/mapper/system/SysNoticeGroupMapper.xml index 3fc67cf3..1e923bf5 100644 --- a/op-modules/op-system/src/main/resources/mapper/system/SysNoticeGroupMapper.xml +++ b/op-modules/op-system/src/main/resources/mapper/system/SysNoticeGroupMapper.xml @@ -36,10 +36,10 @@ - @@ -125,19 +125,31 @@ - delete from sys_notice_group where id = #{id} + update sys_notice_group set del_flag = '1' where id = #{id} - delete from sys_notice_group where id in + update sys_notice_group set del_flag = "1" where id in #{id} + + + + update sys_notice_group set del_flag = '1' where notice_id = #{noticeId} and group_code in + + #{groupCode} + + +