From fd6dcba206166c1b9469707b130e077f8e39e153 Mon Sep 17 00:00:00 2001 From: zhengyf <zyf654042662@163.com> Date: Fri, 30 May 2025 15:01:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B9=BF=E8=84=89=EF=BC=9A1=E3=80=81=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E6=98=AF=E8=BF=87=E6=BB=A4id=E3=80=822=E3=80=81?= =?UTF-8?q?=E5=BD=B1=E5=93=8D=E5=9B=A0=E7=B4=A0=E5=88=A0=E9=99=A4=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E9=9C=80=E8=A6=81=E8=80=83=E8=99=91=E5=BD=B1=E5=93=8D?= =?UTF-8?q?=E5=9B=A0=E7=B4=A0=E5=85=B3=E8=81=94=E6=98=AF=E5=90=A6=E6=9C=89?= =?UTF-8?q?=E5=BC=95=E7=94=A8=EF=BC=8C=E5=BC=95=E7=94=A8=E5=88=99=E4=B8=8D?= =?UTF-8?q?=E5=8F=AF=E5=88=A0=E9=99=A4=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AeConfInfluenceFactorCorrelationEntity.xml | 2 -- .../factor/entity/AeConfInfluenceFactorEntity.xml | 2 -- .../impl/AeConfInfluenceFactorServiceImpl.java | 13 +++++++++++++ .../module/entity/AeConfBusinessModuleEntity.xml | 2 -- .../module/entity/AeConfBusinessModuleMdmEntity.xml | 2 -- 5 files changed, 13 insertions(+), 8 deletions(-) diff --git a/base-buildpackage/src/main/java/com/hzya/frame/voucher/ae/comf/factor/entity/AeConfInfluenceFactorCorrelationEntity.xml b/base-buildpackage/src/main/java/com/hzya/frame/voucher/ae/comf/factor/entity/AeConfInfluenceFactorCorrelationEntity.xml index 44e12246..bf6ae096 100644 --- a/base-buildpackage/src/main/java/com/hzya/frame/voucher/ae/comf/factor/entity/AeConfInfluenceFactorCorrelationEntity.xml +++ b/base-buildpackage/src/main/java/com/hzya/frame/voucher/ae/comf/factor/entity/AeConfInfluenceFactorCorrelationEntity.xml @@ -223,7 +223,6 @@ keyProperty="id" useGeneratedKeys="true"> insert into ae_conf_influence_factor_correlation( <trim suffix="" suffixOverrides=","> - <if test="id != null">id ,</if> <if test="factorId != null">factor_id ,</if> <if test="factorName != null and factorName != ''">factor_name ,</if> <if test="mdmId != null and mdmId != ''">mdm_id ,</if> @@ -254,7 +253,6 @@ </trim> )values( <trim suffix="" suffixOverrides=","> - <if test="id != null">#{id} ,</if> <if test="factorId != null">#{factorId} ,</if> <if test="factorName != null and factorName != ''">#{factorName} ,</if> <if test="mdmId != null and mdmId != ''">#{mdmId} ,</if> diff --git a/base-buildpackage/src/main/java/com/hzya/frame/voucher/ae/comf/factor/entity/AeConfInfluenceFactorEntity.xml b/base-buildpackage/src/main/java/com/hzya/frame/voucher/ae/comf/factor/entity/AeConfInfluenceFactorEntity.xml index e06e869d..756d0847 100644 --- a/base-buildpackage/src/main/java/com/hzya/frame/voucher/ae/comf/factor/entity/AeConfInfluenceFactorEntity.xml +++ b/base-buildpackage/src/main/java/com/hzya/frame/voucher/ae/comf/factor/entity/AeConfInfluenceFactorEntity.xml @@ -205,7 +205,6 @@ keyProperty="id" useGeneratedKeys="true"> insert into ae_conf_influence_factor( <trim suffix="" suffixOverrides=","> - <if test="id != null">id ,</if> <if test="aeConfModuleId != null">ae_conf_module_id ,</if> <if test="aeConfModuleName != null and aeConfModuleName != ''">ae_conf_module_name ,</if> <if test="factorName != null and factorName != ''">factor_name ,</if> @@ -232,7 +231,6 @@ </trim> )values( <trim suffix="" suffixOverrides=","> - <if test="id != null">#{id} ,</if> <if test="aeConfModuleId != null">#{aeConfModuleId} ,</if> <if test="aeConfModuleName != null and aeConfModuleName != ''">#{aeConfModuleName} ,</if> <if test="factorName != null and factorName != ''">#{factorName} ,</if> diff --git a/base-buildpackage/src/main/java/com/hzya/frame/voucher/ae/comf/factor/service/impl/AeConfInfluenceFactorServiceImpl.java b/base-buildpackage/src/main/java/com/hzya/frame/voucher/ae/comf/factor/service/impl/AeConfInfluenceFactorServiceImpl.java index 4e381114..34c887e3 100644 --- a/base-buildpackage/src/main/java/com/hzya/frame/voucher/ae/comf/factor/service/impl/AeConfInfluenceFactorServiceImpl.java +++ b/base-buildpackage/src/main/java/com/hzya/frame/voucher/ae/comf/factor/service/impl/AeConfInfluenceFactorServiceImpl.java @@ -3,6 +3,8 @@ package com.hzya.frame.voucher.ae.comf.factor.service.impl; import cn.hutool.core.lang.Assert; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; +import com.hzya.frame.voucher.ae.comf.factor.dao.IAeConfInfluenceFactorCorrelationDao; +import com.hzya.frame.voucher.ae.comf.factor.entity.AeConfInfluenceFactorCorrelationEntity; import com.hzya.frame.voucher.ae.comf.factor.entity.AeConfInfluenceFactorEntity; import com.hzya.frame.voucher.ae.comf.factor.dao.IAeConfInfluenceFactorDao; import com.hzya.frame.voucher.ae.comf.factor.service.IAeConfInfluenceFactorService; @@ -32,6 +34,8 @@ public class AeConfInfluenceFactorServiceImpl extends BaseService<AeConfInfluenc this.dao = dao; } + @Autowired + private IAeConfInfluenceFactorCorrelationDao aeConfInfluenceFactorCorrelationDao; @Autowired private IAeConfBusinessModuleDao aeConfBusinessModuleDao; @Autowired @@ -87,9 +91,18 @@ public class AeConfInfluenceFactorServiceImpl extends BaseService<AeConfInfluenc } + /** + * 删除时,需要考虑影响因素关联是否有引用,引用则不可删除 + */ @Override public int logicRemove(AeConfInfluenceFactorEntity entity) throws Exception { Assert.notNull(entity.getId(), "删除影响因素设置时,影响因素id不能为空"); + AeConfInfluenceFactorCorrelationEntity factorCorrelation = new AeConfInfluenceFactorCorrelationEntity(); + factorCorrelation.setFactorId(Long.valueOf(entity.getId())); + List<AeConfInfluenceFactorCorrelationEntity> correlationList = aeConfInfluenceFactorCorrelationDao.query(factorCorrelation); + if(correlationList.size()!=0){ + Assert.state(false,"删除失败。该影响因素已被关联,请检查影响因素关联配置。"); + } return aeConfInfluenceFactorDao.logicRemove(entity); } diff --git a/base-buildpackage/src/main/java/com/hzya/frame/voucher/ae/comf/module/entity/AeConfBusinessModuleEntity.xml b/base-buildpackage/src/main/java/com/hzya/frame/voucher/ae/comf/module/entity/AeConfBusinessModuleEntity.xml index 0fc15a61..c234b387 100644 --- a/base-buildpackage/src/main/java/com/hzya/frame/voucher/ae/comf/module/entity/AeConfBusinessModuleEntity.xml +++ b/base-buildpackage/src/main/java/com/hzya/frame/voucher/ae/comf/module/entity/AeConfBusinessModuleEntity.xml @@ -157,7 +157,6 @@ keyProperty="id" useGeneratedKeys="true"> insert into ae_conf_business_module( <trim suffix="" suffixOverrides=","> - <if test="id != null">id ,</if> <if test="moduleName != null and moduleName != ''">module_name ,</if> <if test="def1 != null and def1 != ''">def1 ,</if> <if test="def2 != null and def2 != ''">def2 ,</if> @@ -180,7 +179,6 @@ </trim> )values( <trim suffix="" suffixOverrides=","> - <if test="id != null">#{id} ,</if> <if test="moduleName != null and moduleName != ''">#{moduleName} ,</if> <if test="def1 != null and def1 != ''">#{def1} ,</if> <if test="def2 != null and def2 != ''">#{def2} ,</if> diff --git a/base-buildpackage/src/main/java/com/hzya/frame/voucher/ae/comf/module/entity/AeConfBusinessModuleMdmEntity.xml b/base-buildpackage/src/main/java/com/hzya/frame/voucher/ae/comf/module/entity/AeConfBusinessModuleMdmEntity.xml index 597b3fd0..9bb10b73 100644 --- a/base-buildpackage/src/main/java/com/hzya/frame/voucher/ae/comf/module/entity/AeConfBusinessModuleMdmEntity.xml +++ b/base-buildpackage/src/main/java/com/hzya/frame/voucher/ae/comf/module/entity/AeConfBusinessModuleMdmEntity.xml @@ -200,7 +200,6 @@ keyProperty="id" useGeneratedKeys="true"> insert into ae_conf_business_module_mdm( <trim suffix="" suffixOverrides=","> - <if test="id != null">id ,</if> <if test="aeConfModuleId != null">ae_conf_module_id ,</if> <if test="aeConfModuleName != null and aeConfModuleName != ''">ae_conf_module_name ,</if> <if test="mdmId != null and mdmId != ''">mdm_id ,</if> @@ -227,7 +226,6 @@ </trim> )values( <trim suffix="" suffixOverrides=","> - <if test="id != null">#{id} ,</if> <if test="aeConfModuleId != null">#{aeConfModuleId} ,</if> <if test="aeConfModuleName != null and aeConfModuleName != ''">#{aeConfModuleName} ,</if> <if test="mdmId != null and mdmId != ''">#{mdmId} ,</if>