From 570b0ce316ea157a7ecc1335bf94fbfb55cb6405 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B1=88=E5=B1=95=E8=88=AA?= <2426745133@qq.com> Date: Sat, 25 Oct 2025 20:11:14 +0800 Subject: [PATCH] =?UTF-8?q?10-25-=E4=BE=9B=E5=BA=94=E5=95=86=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E3=80=81=E5=88=A0=E9=99=A4=E6=B7=BB=E5=8A=A0=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xzd/domain/XzdCustomerSupplier.java | 9 +++---- .../impl/XzdSupplierInfoServiceImpl.java | 24 ++++++++++++++++++- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/xzd/domain/XzdCustomerSupplier.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/xzd/domain/XzdCustomerSupplier.java index fc14f323..57a6d19e 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/xzd/domain/XzdCustomerSupplier.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/xzd/domain/XzdCustomerSupplier.java @@ -1,9 +1,10 @@ package org.dromara.xzd.domain; -import org.dromara.common.mybatis.core.domain.BaseEntity; -import com.baomidou.mybatisplus.annotation.*; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import lombok.EqualsAndHashCode; +import org.dromara.common.mybatis.core.domain.BaseEntity; import java.io.Serial; @@ -22,13 +23,13 @@ public class XzdCustomerSupplier extends BaseEntity { private static final long serialVersionUID = 1L; /** - * + * */ @TableId(value = "id") private Long id; /** - * 类型(1、供应商,2、客户) + * 类型(2、客户 1、供应商) */ private String type; diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/xzd/service/impl/XzdSupplierInfoServiceImpl.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/xzd/service/impl/XzdSupplierInfoServiceImpl.java index bb447913..20690004 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/xzd/service/impl/XzdSupplierInfoServiceImpl.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/xzd/service/impl/XzdSupplierInfoServiceImpl.java @@ -18,10 +18,11 @@ import org.dromara.system.service.impl.SysOssServiceImpl; import org.dromara.system.service.impl.SysUserServiceImpl; import org.dromara.xzd.domain.*; import org.dromara.xzd.domain.bo.XzdSupplierInfoBo; -import org.dromara.xzd.domain.vo.XzdCustomerinformationVo; import org.dromara.xzd.domain.vo.XzdCustomertypeVo; import org.dromara.xzd.domain.vo.XzdSupplierInfoVo; import org.dromara.xzd.mapper.XzdSupplierInfoMapper; +import org.dromara.xzd.service.IXzdCustomerSupplierService; +import org.dromara.xzd.service.IXzdCustomerSupplierYybService; import org.dromara.xzd.service.IXzdSupplierInfoService; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -77,6 +78,8 @@ public class XzdSupplierInfoServiceImpl extends ServiceImpl wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(XzdCustomerSupplierYyb::getCSId, id); + List yybList = iXzdCustomerSupplierYybService.list(wrapper); + if (yybList != null && !yybList.isEmpty()){ + throw new RuntimeException("供应商id:{"+id+"}已被其他业务使用,删除失败"); + } + //如果没有被引用 则进行删除中间表数据 + LambdaQueryWrapper wrapper2 = new LambdaQueryWrapper<>(); + wrapper2.eq(XzdCustomerSupplier::getCSId, id); + wrapper2.eq(XzdCustomerSupplier::getType,"2"); + iXzdCustomerSupplierService.remove(wrapper2); + //删除资质新信息 LambdaQueryWrapper qualificationLambdaQueryWrapper = new LambdaQueryWrapper<>(); qualificationLambdaQueryWrapper.eq(XzdSupplierQualification::getSupplierId, id);