From 3471290659516cf21db3211a9053daff5f283e03 Mon Sep 17 00:00:00 2001
From: zhuguifei <312353457@qq.com>
Date: 星期五, 20 三月 2026 15:50:18 +0800
Subject: [PATCH] feat: 基础数据仪器管理、判定依据、判定依据明细

---
 RuoYi-Vue-Plus/ruoyi-modules/ruoyi-qa/src/main/java/org/dromara/qa/md/service/impl/MdInstrumentServiceImpl.java |  133 ++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 133 insertions(+), 0 deletions(-)

diff --git a/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-qa/src/main/java/org/dromara/qa/md/service/impl/MdInstrumentServiceImpl.java b/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-qa/src/main/java/org/dromara/qa/md/service/impl/MdInstrumentServiceImpl.java
new file mode 100644
index 0000000..03c917e
--- /dev/null
+++ b/RuoYi-Vue-Plus/ruoyi-modules/ruoyi-qa/src/main/java/org/dromara/qa/md/service/impl/MdInstrumentServiceImpl.java
@@ -0,0 +1,133 @@
+package org.dromara.qa.md.service.impl;
+
+import org.dromara.common.core.utils.MapstructUtils;
+import org.dromara.common.core.utils.StringUtils;
+import org.dromara.common.mybatis.core.page.TableDataInfo;
+import org.dromara.common.mybatis.core.page.PageQuery;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+import org.dromara.qa.md.domain.bo.MdInstrumentBo;
+import org.dromara.qa.md.domain.vo.MdInstrumentVo;
+import org.dromara.qa.md.domain.MdInstrument;
+import org.dromara.qa.md.mapper.MdInstrumentMapper;
+import org.dromara.qa.md.service.IMdInstrumentService;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Collection;
+
+/**
+ * 娴嬮噺浠櫒Service涓氬姟灞傚鐞�
+ *
+ * @author zhuguifei
+ * @date 2026-03-18
+ */
+@Slf4j
+@RequiredArgsConstructor
+@Service
+public class MdInstrumentServiceImpl implements IMdInstrumentService {
+
+    private final MdInstrumentMapper baseMapper;
+
+    /**
+     * 鏌ヨ娴嬮噺浠櫒
+     *
+     * @param id 涓婚敭
+     * @return 娴嬮噺浠櫒
+     */
+    @Override
+    public MdInstrumentVo queryById(String id){
+        return baseMapper.selectVoById(id);
+    }
+
+    /**
+     * 鍒嗛〉鏌ヨ娴嬮噺浠櫒鍒楄〃
+     *
+     * @param bo        鏌ヨ鏉′欢
+     * @param pageQuery 鍒嗛〉鍙傛暟
+     * @return 娴嬮噺浠櫒鍒嗛〉鍒楄〃
+     */
+    @Override
+    public TableDataInfo<MdInstrumentVo> queryPageList(MdInstrumentBo bo, PageQuery pageQuery) {
+        LambdaQueryWrapper<MdInstrument> lqw = buildQueryWrapper(bo);
+        Page<MdInstrumentVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
+        return TableDataInfo.build(result);
+    }
+
+    /**
+     * 鏌ヨ绗﹀悎鏉′欢鐨勬祴閲忎华鍣ㄥ垪琛�
+     *
+     * @param bo 鏌ヨ鏉′欢
+     * @return 娴嬮噺浠櫒鍒楄〃
+     */
+    @Override
+    public List<MdInstrumentVo> queryList(MdInstrumentBo bo) {
+        LambdaQueryWrapper<MdInstrument> lqw = buildQueryWrapper(bo);
+        return baseMapper.selectVoList(lqw);
+    }
+
+    private LambdaQueryWrapper<MdInstrument> buildQueryWrapper(MdInstrumentBo bo) {
+        Map<String, Object> params = bo.getParams();
+        LambdaQueryWrapper<MdInstrument> lqw = Wrappers.lambdaQuery();
+        lqw.like(StringUtils.isNotBlank(bo.getInstrumentCode()), MdInstrument::getInstrumentCode, bo.getInstrumentCode());
+        lqw.like(StringUtils.isNotBlank(bo.getInstrumentName()), MdInstrument::getInstrumentName, bo.getInstrumentName());
+        lqw.eq(bo.getEnable() != null, MdInstrument::getEnable, bo.getEnable());
+        return lqw;
+    }
+
+    /**
+     * 鏂板娴嬮噺浠櫒
+     *
+     * @param bo 娴嬮噺浠櫒
+     * @return 鏄惁鏂板鎴愬姛
+     */
+    @Override
+    public Boolean insertByBo(MdInstrumentBo bo) {
+        MdInstrument add = MapstructUtils.convert(bo, MdInstrument.class);
+        validEntityBeforeSave(add);
+        boolean flag = baseMapper.insert(add) > 0;
+        if (flag) {
+            bo.setId(add.getId());
+        }
+        return flag;
+    }
+
+    /**
+     * 淇敼娴嬮噺浠櫒
+     *
+     * @param bo 娴嬮噺浠櫒
+     * @return 鏄惁淇敼鎴愬姛
+     */
+    @Override
+    public Boolean updateByBo(MdInstrumentBo bo) {
+        MdInstrument update = MapstructUtils.convert(bo, MdInstrument.class);
+        validEntityBeforeSave(update);
+        return baseMapper.updateById(update) > 0;
+    }
+
+    /**
+     * 淇濆瓨鍓嶇殑鏁版嵁鏍¢獙
+     */
+    private void validEntityBeforeSave(MdInstrument entity){
+        //TODO 鍋氫竴浜涙暟鎹牎楠�,濡傚敮涓�绾︽潫
+    }
+
+    /**
+     * 鏍¢獙骞舵壒閲忓垹闄ゆ祴閲忎华鍣ㄤ俊鎭�
+     *
+     * @param ids     寰呭垹闄ょ殑涓婚敭闆嗗悎
+     * @param isValid 鏄惁杩涜鏈夋晥鎬ф牎楠�
+     * @return 鏄惁鍒犻櫎鎴愬姛
+     */
+    @Override
+    public Boolean deleteWithValidByIds(Collection<String> ids, Boolean isValid) {
+        if(isValid){
+            //TODO 鍋氫竴浜涗笟鍔′笂鐨勬牎楠�,鍒ゆ柇鏄惁闇�瑕佹牎楠�
+        }
+        return baseMapper.deleteByIds(ids) > 0;
+    }
+}

--
Gitblit v1.9.3