From b2174bdc2c7906b0f6fa65be7a8564e64107581f Mon Sep 17 00:00:00 2001 From: chenrui <1187576398@qq.com> Date: 星期二, 25 三月 2025 14:18:18 +0800 Subject: [PATCH] Merge branch 'radio_frequency' of http://114.132.189.42:9002/r/lims-ruoyi-after into radio_frequency --- basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardTreeServiceImpl.java | 39 +++++++++++++++++++++++---------------- 1 files changed, 23 insertions(+), 16 deletions(-) diff --git a/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardTreeServiceImpl.java b/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardTreeServiceImpl.java index 4b99a25..2752eb5 100644 --- a/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardTreeServiceImpl.java +++ b/basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardTreeServiceImpl.java @@ -6,7 +6,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; -import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.basic.dto.*; @@ -16,6 +15,7 @@ import com.ruoyi.basic.pojo.*; import com.ruoyi.common.exception.base.BaseException; import com.ruoyi.basic.service.*; +import com.ruoyi.common.utils.StringUtils; import lombok.AllArgsConstructor; import org.apache.commons.lang3.ObjectUtils; import org.springframework.beans.BeanUtils; @@ -208,23 +208,30 @@ @Override @Transactional(rollbackFor = Exception.class) - public int addStandardTree(StandardTree standardTree) { - - LambdaQueryWrapper<StandardTree> wrapper = Wrappers.<StandardTree>lambdaQuery() - .eq(StandardTree::getFactory, standardTree.getFactory()) - .eq(StandardTree::getLaboratory, standardTree.getLaboratory()) - .eq(StandardTree::getSampleType, standardTree.getSampleType()) - .eq(StandardTree::getSample, standardTree.getSample()) - .eq(StandardTree::getModel, standardTree.getModel()); - if (StringUtils.isNotBlank(standardTree.getSample())) { - wrapper.eq(StandardTree::getSample, standardTree.getSample()); + public int addStandardTree(ModelAddDto modelAddDto) { + // 鏍¢獙 + if(StringUtils.isEmpty(modelAddDto.getParentId())){ + throw new RuntimeException("缂哄皯鐖跺眰绾х粦瀹氬叧绯�"); } - - StandardTree tree = standardTreeMapper.selectOne(wrapper); - if (tree != null) { - throw new BaseException("璇ュ瀷鍙峰凡瀛樺湪"); + Model model = new Model(); + String parentLevel = modelAddDto.getParentLevel(); + if(BasicTreeEnums.PRODUCT_TYPE.getCode().equals(parentLevel)){ + model.setProductId(Integer.valueOf(parentLevel)); + }else if(BasicTreeEnums.STRUCTURE_TEST_OBJECT_TYPE.getCode().equals(parentLevel)){ + model.setStructureTestObjectId(Integer.valueOf(parentLevel)); + }else { + throw new RuntimeException("鍨嬪彿鍙兘缁戝畾瀵硅薄鍜屼骇鍝�"); } - return standardTreeMapper.insert(standardTree); + // 鍚嶇О閲嶈鎬ф牎楠� + QueryWrapper<Model> modelQueryWrapper = new QueryWrapper<>(); + modelQueryWrapper.eq("product_id", model.getProductId()); + modelQueryWrapper.eq("structure_test_object_id", model.getStructureTestObjectId()); + modelQueryWrapper.eq("model_name", model.getModelName()); + Model modelResult = modelMapper.selectOne(modelQueryWrapper); + if(ObjectUtils.isNotEmpty(modelResult)){ + throw new RuntimeException("璇峰嬁娣诲姞閲嶅鍨嬪彿"); + } + return modelMapper.insert(model); } @Override -- Gitblit v1.9.3