From 8fd3079588420a84375802d70a4b35c70dee6ed2 Mon Sep 17 00:00:00 2001 From: Mzaxd Date: Fri, 21 Apr 2023 13:47:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84[=E5=88=A0=E9=99=A4=E6=8A=A5?= =?UTF-8?q?=E8=A1=A8]=E6=8E=A5=E5=8F=A3=EF=BC=8C=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E6=8A=A5=E8=A1=A8=E7=9A=84=E5=90=8C=E6=97=B6=E4=BC=9A=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E6=89=80=E6=9C=89=E5=85=B3=E8=81=94=E6=A0=87=E7=AD=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../adc/da/report/service/IReportLabelService.java | 7 +++++++ .../da/report/service/impl/IReportServiceImpl.java | 5 ++++- .../report/service/impl/ReportLabelServiceImpl.java | 13 +++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/adc-da-report/src/main/java/com/adc/da/report/service/IReportLabelService.java b/adc-da-report/src/main/java/com/adc/da/report/service/IReportLabelService.java index fb57539..0192326 100644 --- a/adc-da-report/src/main/java/com/adc/da/report/service/IReportLabelService.java +++ b/adc-da-report/src/main/java/com/adc/da/report/service/IReportLabelService.java @@ -3,6 +3,8 @@ package com.adc.da.report.service; import com.adc.da.report.eo.ReportLabelEntity; import com.baomidou.mybatisplus.extension.service.IService; +import java.util.List; + /** * @author ThinkBook * @description 针对表【ts_report_label】的数据库操作Service @@ -10,4 +12,9 @@ import com.baomidou.mybatisplus.extension.service.IService; */ public interface IReportLabelService extends IService { + /** + * 根据报表Id删除所有报表标签关系 + * @param reportIds 报表id + */ + void deleteReportLabelByReportId(List reportIds); } diff --git a/adc-da-report/src/main/java/com/adc/da/report/service/impl/IReportServiceImpl.java b/adc-da-report/src/main/java/com/adc/da/report/service/impl/IReportServiceImpl.java index 8c47661..8ccadd2 100644 --- a/adc-da-report/src/main/java/com/adc/da/report/service/impl/IReportServiceImpl.java +++ b/adc-da-report/src/main/java/com/adc/da/report/service/impl/IReportServiceImpl.java @@ -151,7 +151,8 @@ public class IReportServiceImpl extends ServiceImpl }); //修改报表标签关系表(先删后增) - reportLabelDao.deleteById(entity.getId()); + iReportLabelService.deleteReportLabelByReportId(Collections.singletonList(entity.getId())); + //插入报表标签关系表 labelList.forEach((label) -> { ReportLabelEntity reportLabelEntity = new ReportLabelEntity(UUID.randomUUID10(), entity.getId(), label); @@ -284,6 +285,8 @@ public class IReportServiceImpl extends ServiceImpl public List delete(String ids) { List nameList = new ArrayList<>(); String[] idList = ids.split(","); + //删除所有报表标签关系记录 + iReportLabelService.deleteReportLabelByReportId(Collections.singletonList(Arrays.toString(idList))); for (String id : idList) { ReportEntity entity = reportDao.selectById(id); entity.setDelFlag("1"); diff --git a/adc-da-report/src/main/java/com/adc/da/report/service/impl/ReportLabelServiceImpl.java b/adc-da-report/src/main/java/com/adc/da/report/service/impl/ReportLabelServiceImpl.java index 05752d9..2e56309 100644 --- a/adc-da-report/src/main/java/com/adc/da/report/service/impl/ReportLabelServiceImpl.java +++ b/adc-da-report/src/main/java/com/adc/da/report/service/impl/ReportLabelServiceImpl.java @@ -1,11 +1,15 @@ package com.adc.da.report.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.adc.da.report.eo.ReportLabelEntity; import com.adc.da.report.service.IReportLabelService; import com.adc.da.report.dao.mysql.ReportLabelDao; import org.springframework.stereotype.Service; +import javax.annotation.Resource; +import java.util.List; + /** * @author ThinkBook * @description 针对表【ts_report_label】的数据库操作Service实现 @@ -15,6 +19,15 @@ import org.springframework.stereotype.Service; public class ReportLabelServiceImpl extends ServiceImpl implements IReportLabelService { + @Resource + private ReportLabelDao reportLabelDao; + + @Override + public void deleteReportLabelByReportId(List reportId) { + LambdaQueryWrapper reportLabelWrapper = new LambdaQueryWrapper<>(); + reportLabelWrapper.in(ReportLabelEntity::getReportId, reportId); + reportLabelDao.delete(reportLabelWrapper); + } }