From ac2ee2bbf5993c2e5aa009049c9444c226960caa Mon Sep 17 00:00:00 2001
From: XiaoRuby <3114200645@qq.com>
Date: 星期六, 19 八月 2023 15:16:18 +0800
Subject: [PATCH] LIMS管理系统框架-开发8-19
---
laboratory-server/src/main/java/com/yuanchu/limslaboratory/service/impl/InstrumentServiceImpl.java | 71 +++++++++++++++++++++++++++++++++++
1 files changed, 70 insertions(+), 1 deletions(-)
diff --git a/laboratory-server/src/main/java/com/yuanchu/limslaboratory/service/impl/InstrumentServiceImpl.java b/laboratory-server/src/main/java/com/yuanchu/limslaboratory/service/impl/InstrumentServiceImpl.java
index 367bd37..5e91307 100644
--- a/laboratory-server/src/main/java/com/yuanchu/limslaboratory/service/impl/InstrumentServiceImpl.java
+++ b/laboratory-server/src/main/java/com/yuanchu/limslaboratory/service/impl/InstrumentServiceImpl.java
@@ -1,10 +1,21 @@
package com.yuanchu.limslaboratory.service.impl;
-import com.yuanchu.limslaboratory.entity.Instrument;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.yuanchu.limslaboratory.pojo.Instrument;
import com.yuanchu.limslaboratory.mapper.InstrumentMapper;
import com.yuanchu.limslaboratory.service.InstrumentService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.yuanchu.limslaboratory.utils.MyUtil;
import org.springframework.stereotype.Service;
+import org.springframework.util.ObjectUtils;
+
+import javax.annotation.Resource;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
/**
* <p>
@@ -17,4 +28,62 @@
@Service
public class InstrumentServiceImpl extends ServiceImpl<InstrumentMapper, Instrument> implements InstrumentService {
+ @Resource
+ private InstrumentMapper instrumentMapper;
+
+ @Override
+ public Integer addInstrumentInformation(Instrument instrument) {
+ LambdaQueryWrapper<Instrument> wrapper = new LambdaQueryWrapper<>();
+ wrapper.eq(Instrument::getEquipmentCode, instrument.getEquipmentCode());
+ wrapper.eq(Instrument::getState, 1);
+ wrapper.select(Instrument::getEquipmentCode);
+ Instrument instrument1 = instrumentMapper.selectOne(wrapper);
+ if (ObjectUtils.isEmpty(instrument1)){
+ return instrumentMapper.insert(instrument);
+ }
+ return 0;
+ }
+
+ @Override
+ public Boolean deleteInstrumentInformation(String instrumentId) {
+ LambdaUpdateWrapper<Instrument> updateWrapper = new LambdaUpdateWrapper<>();
+ updateWrapper.eq(Instrument::getId, instrumentId);
+ updateWrapper.set(Instrument::getState, 0);
+ int isUpdateSuccess = instrumentMapper.update(new Instrument(), updateWrapper);
+ return isUpdateSuccess > 0;
+ }
+
+ @Override
+ public IPage<Map<String, Object>> getListInstrumentInformation(Integer conditions, Boolean whetherWhether, String numberOrNameOrSpecifications,
+ Integer classifyId, Page<Objects> page) {
+ return instrumentMapper.getListInstrumentInformation(conditions, whetherWhether, numberOrNameOrSpecifications, classifyId, page);
+ }
+
+ @Override
+ public Instrument getIdInstrumentInformation(Integer instrumentId) {
+ LambdaQueryWrapper<Instrument> wrapper = new LambdaQueryWrapper<>();
+ wrapper.eq(Instrument::getId, instrumentId);
+ return instrumentMapper.selectOne(wrapper);
+ }
+
+ @Override
+ public Integer updateEquipmentPointInformation(Instrument instrument) {
+ LambdaQueryWrapper<Instrument> wrapper = new LambdaQueryWrapper<>();
+ wrapper.eq(Instrument::getEquipmentCode, instrument.getEquipmentCode());
+ wrapper.eq(Instrument::getState, 1);
+ wrapper.select(Instrument::getEquipmentCode, Instrument::getId);
+ Instrument instrument1 = instrumentMapper.selectOne(wrapper);
+ if (ObjectUtils.isEmpty(instrument1)){
+ return instrumentMapper.updateById(instrument);
+ } else if (instrument.getId().equals(instrument1.getId())){
+ return instrumentMapper.updateById(instrument);
+ }
+ return 0;
+ }
+
+ //鏌ヨ鎵�鏈夎澶囦俊鎭�
+ @Override
+ public List<Map> selectInstrument() {
+ return instrumentMapper.selectInstrument();
+ }
}
--
Gitblit v1.9.3