XiaoRuby
2023-07-20 5341b151ccf051862c8f2adbeb02e82535a77d5e
LIMS管理系统框架-开发7-20-v1.0.0
已修改17个文件
373 ■■■■ 文件已修改
standard-server/src/main/java/com/yuanchu/limslaboratory/controller/MaterialController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/java/com/yuanchu/limslaboratory/controller/ProductController.java 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/java/com/yuanchu/limslaboratory/controller/SerialNumberController.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/java/com/yuanchu/limslaboratory/controller/SpecificationsController.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/java/com/yuanchu/limslaboratory/controller/StandardsController.java 26 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/java/com/yuanchu/limslaboratory/pojo/SerialNumber.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/java/com/yuanchu/limslaboratory/service/MaterialService.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/java/com/yuanchu/limslaboratory/service/ProductService.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/java/com/yuanchu/limslaboratory/service/SerialNumberService.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/java/com/yuanchu/limslaboratory/service/SpecificationsService.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/java/com/yuanchu/limslaboratory/service/StandardsService.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/java/com/yuanchu/limslaboratory/service/impl/MaterialServiceImpl.java 48 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/java/com/yuanchu/limslaboratory/service/impl/ProductServiceImpl.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/java/com/yuanchu/limslaboratory/service/impl/SerialNumberServiceImpl.java 58 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/java/com/yuanchu/limslaboratory/service/impl/SpecificationsServiceImpl.java 46 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/java/com/yuanchu/limslaboratory/service/impl/StandardsServiceImpl.java 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
sys/src/test/java/com/yuanchu/limslaboratory/SysApplicationTests.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
standard-server/src/main/java/com/yuanchu/limslaboratory/controller/MaterialController.java
@@ -57,7 +57,7 @@
    @ApiImplicitParams(value = {
            @ApiImplicitParam(value = "物料ID", name = "materialId", dataTypeClass = String.class)
    })
    public Result<?> deleteMaterialInformation(Integer materialId) {
    public Result<?> deleteMaterialInformation(String materialId) {
        Integer isDeleteMaterialSuccess = materialService.deleteMaterialInformation(materialId);
        if (isDeleteMaterialSuccess == 1) {
            return Result.success("删除成功!");
standard-server/src/main/java/com/yuanchu/limslaboratory/controller/ProductController.java
@@ -51,13 +51,13 @@
    @ApiImplicitParams(value = {
            @ApiImplicitParam(value = "物料ID", name = "materialId", dataTypeClass = String.class)
    })
    public Result<?> getListProductInformation(Integer materialId) {
    public Result<?> getListProductInformation(String materialId) {
        List<Map<String, Object>> listMaterialInformation = productService.getListProductInformation(materialId);
        return Result.success(listMaterialInformation);
    }
    @ApiOperation("物料库-->根据测试标准ID查询基本信息")
    @GetMapping("/delete")
    @GetMapping("/productId")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(value = "测试标准ID", name = "productId", dataTypeClass = String.class)
    })
@@ -79,13 +79,13 @@
        return Result.fail("删除失败!");
    }
//    @ApiOperation("物料库-->修改物料")
//    @PutMapping("/update")
//    public Result<?> updateMaterialInformation(@RequestBody Material material) {
//        Integer isUpdateMaterialSuccess = materialService.updateMaterialInformation(material);
//        if (isUpdateMaterialSuccess == 1) {
//            return Result.success("修改物料【"+ material.getName() +"】成功!");
//        }
//        return Result.fail("修改物料【"+ material.getName() +"】失败!");
//    }
    @ApiOperation("物料库-->根据测试标准Id修改数据")
    @PutMapping("/update")
    public Result<?> updateMaterialInformation(@RequestBody Product product) {
        Integer isUpdateMaterialSuccess = productService.updateMaterialInformation(product);
        if (isUpdateMaterialSuccess == 1) {
            return Result.success("修改【"+ product.getName() +"】成功!");
        }
        return Result.fail("修改【"+ product.getName() +"】失败!");
    }
}
standard-server/src/main/java/com/yuanchu/limslaboratory/controller/SerialNumberController.java
@@ -64,4 +64,27 @@
        map.put("total", selectStandards.getTotal());
        return Result.success(map);
    }
    @ApiOperation("标准库-->根据Id修改型号参数")
    @PutMapping("/update")
    public Result<?> updateSerialNumberInformation(@RequestHeader("X-Token") String token, @RequestBody SerialNumber serialNumber) throws Exception {
        Object object = RedisUtil.get(token);
        Map<String, Object> unmarshal = JackSonUtil.unmarshal(JackSonUtil.marshal(object), Map.class);
        serialNumber.setUserId((Integer) unmarshal.get("id"));
        Integer isUpdateSerialNumberSuccess = serialNumberService.updateSerialNumberInformation(serialNumber);
        if (isUpdateSerialNumberSuccess == 1){
            return Result.success("更新成功!");
        }
        return Result.fail("更新失败!");
    }
    @ApiOperation("标准库-->根据Id删除型号")
    @DeleteMapping("/delete")
    public Result<?> deleteSerialNumberInformation(String serialNumberId) {
        Integer isDeleteSerialNumberSuccess = serialNumberService.deleteSerialNumberInformation(serialNumberId);
        if (isDeleteSerialNumberSuccess == 1){
            return Result.success("删除成功!");
        }
        return Result.fail("删除失败!");
    }
}
standard-server/src/main/java/com/yuanchu/limslaboratory/controller/SpecificationsController.java
@@ -88,10 +88,10 @@
    @ApiOperation("标准库-->产品规格-->删除")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "specificationsId", value = "规格Id", dataTypeClass = String.class, required = true)
            @ApiImplicitParam(name = "specificationsId", value = "规格Id", dataTypeClass = Integer.class, required = true)
    })
    @DeleteMapping("/delete")
    public Result<?> deleteSpecificationsInformation(String specificationsId) {
    public Result<?> deleteSpecificationsInformation(Integer specificationsId) {
        Integer isStandardsSuccess = specificationsService.deleteSpecifications(specificationsId);
        if (isStandardsSuccess == 1) {
            return Result.success("删除成功!");
standard-server/src/main/java/com/yuanchu/limslaboratory/controller/StandardsController.java
@@ -43,9 +43,6 @@
    @PostMapping("/add")
    public Result<?> addStandardsInformation(@RequestHeader("X-Token") String token, @RequestBody Standards standards) throws Exception {
        Object object = RedisUtil.get(token);
        if (ObjectUtils.isEmpty(object)){
            return Result.fail("对不起添加失败,请添加Token!");
        }
        Map<String, Object> unmarshal = JackSonUtil.unmarshal(JackSonUtil.marshal(object), Map.class);
        standards.setUserId((Integer) unmarshal.get("id"));
        Integer isStandardsSuccess = standardsService.addStandardsInformation(standards);
@@ -76,4 +73,27 @@
        map.put("total", listPage.getTotal());
        return Result.success(map);
    }
    @ApiOperation("标准库-->根据Id修改参数")
    @PutMapping("/update")
    public Result<?> updateStandardsInformation(@RequestHeader("X-Token") String token, @RequestBody Standards standards) throws Exception {
        Object object = RedisUtil.get(token);
        Map<String, Object> unmarshal = JackSonUtil.unmarshal(JackSonUtil.marshal(object), Map.class);
        standards.setUserId((Integer) unmarshal.get("id"));
        Integer isUpdateSuccess = standardsService.updateStandardsInformation(standards);
        if (isUpdateSuccess == 1){
            return Result.success("更新成功!");
        }
        return Result.fail("更新失败!");
    }
    @ApiOperation("标准库-->根据ID删除数据")
    @DeleteMapping("/delete")
    public Result<?> deleteStandardsInformation(String standardsId) {
        Integer isDeleteSuccess = standardsService.deleteStandardsInformation(standardsId);
        if (isDeleteSuccess == 1){
            return Result.success("删除成功!");
        }
        return Result.fail("删除失败!");
    }
}
standard-server/src/main/java/com/yuanchu/limslaboratory/pojo/SerialNumber.java
@@ -1,6 +1,5 @@
package com.yuanchu.limslaboratory.pojo;
import java.time.LocalDateTime;
import java.io.Serializable;
import java.util.Date;
standard-server/src/main/java/com/yuanchu/limslaboratory/service/MaterialService.java
@@ -30,7 +30,7 @@
     * @param materialId
     * @return
     */
    Integer deleteMaterialInformation(Integer materialId);
    Integer deleteMaterialInformation(String materialId);
    /**
     * 更新Material的数据
@@ -40,9 +40,9 @@
    Integer updateMaterialInformation(Material material);
    /**
     * 删除等于SpecificationId的数据
     * @param specificationsId
     * 删除等于SpecificationsId的物料数据
     * @param deleteSpecificationsId
     * @return
     */
    List<String> deleteMaterialEqSpecification(String specificationsId);
    List<String> specificationsIdDeleteMaterial(List<Integer> deleteSpecificationsId);
}
standard-server/src/main/java/com/yuanchu/limslaboratory/service/ProductService.java
@@ -22,11 +22,13 @@
    Integer addProductInformation(Product product);
    List<Map<String, Object>> getListProductInformation(Integer materialId);
    List<Map<String, Object>> getListProductInformation(String materialId);
    Map<String, Object> getProductInformation(Integer productId);
    Integer deleteProductInformation(Integer productId);
    void deleteProductEqMaterialId(List<String> materialListId);
    void MaterialIdDeleteProduct(List<String> deleteMaterialId);
    Integer updateMaterialInformation(Product product);
}
standard-server/src/main/java/com/yuanchu/limslaboratory/service/SerialNumberService.java
@@ -4,6 +4,7 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yuanchu.limslaboratory.pojo.SerialNumber;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
@@ -25,6 +26,13 @@
     */
    Integer addSerialNumberInformation(SerialNumber serialNumber);
    /**
     * 分页查询
     * @param idOrNameOfSerialNumber
     * @param standardsId
     * @param page
     * @return
     */
    IPage<Map<String, Object>> listSerialNumberInformation(String idOrNameOfSerialNumber, String standardsId, Page<Object> page);
    /**
@@ -33,4 +41,21 @@
     * @return
     */
    List<Map<String, Object>> selectIdSerialNumberInformation(String id);
    /**
     * 根据Id修改名称
     * @param serialNumber
     * @return
     */
    Integer updateSerialNumberInformation(SerialNumber serialNumber);
    List<String> StandardsIdDeleteSerialNumber(String standardsId);
    /**
     * 根据型号Id删除数据
     * @param serialNumberId
     * @return
     */
    @Transactional(rollbackFor = Exception.class)
    Integer deleteSerialNumberInformation(String serialNumberId);
}
standard-server/src/main/java/com/yuanchu/limslaboratory/service/SpecificationsService.java
@@ -8,6 +8,7 @@
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@@ -35,5 +36,7 @@
     * @return
     */
    @Transactional(rollbackFor = Exception.class)
    Integer deleteSpecifications(String specificationsId);
    Integer deleteSpecifications(Integer specificationsId);
    List<Integer> SerialNumberIdDeleteSpecifications(List<String> deleteSerialNumberId);
}
standard-server/src/main/java/com/yuanchu/limslaboratory/service/StandardsService.java
@@ -4,6 +4,7 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yuanchu.limslaboratory.pojo.Standards;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
@@ -28,4 +29,19 @@
    Boolean standardsIsNull(String Id);
    IPage<Map<String, Object>> listPageStandardsInformation(Page<Object> page, String idOrNameOfStandards);
    /**
     * 根据Id修改字段
     * @param standards
     * @return
     */
    Integer updateStandardsInformation(Standards standards);
    /**
     * 根据标准Id删除数据
     * @param standardsId
     * @return
     */
    @Transactional(rollbackFor = Exception.class)
    Integer deleteStandardsInformation(String standardsId);
}
standard-server/src/main/java/com/yuanchu/limslaboratory/service/impl/MaterialServiceImpl.java
@@ -4,9 +4,12 @@
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.yuanchu.limslaboratory.pojo.Material;
import com.yuanchu.limslaboratory.mapper.MaterialMapper;
import com.yuanchu.limslaboratory.pojo.Specifications;
import com.yuanchu.limslaboratory.service.MaterialService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yuanchu.limslaboratory.service.ProductService;
import com.yuanchu.limslaboratory.utils.MyUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
@@ -29,6 +32,9 @@
    @Resource
    private MaterialMapper materialMapper;
    @Autowired
    private ProductService productService;
    @Override
    public Integer addMaterialInformation(Material material) {
        return materialMapper.insert(material);
@@ -43,10 +49,18 @@
    }
    @Override
    public Integer deleteMaterialInformation(Integer materialId) {
        LambdaQueryWrapper<Material> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(Material::getId, materialId);
        return materialMapper.delete(wrapper);
    public Integer deleteMaterialInformation(String materialId) {
        LambdaUpdateWrapper<Material> updateWrapper = new LambdaUpdateWrapper<>();
        updateWrapper.eq(Material::getId, materialId);
        updateWrapper.set(Material::getState, 0);
        List<String> list = new ArrayList<>();
        list.add(materialId);
        int isDeleteSuccess = materialMapper.update(new Material(), updateWrapper);
        if (isDeleteSuccess == 1){
            productService.MaterialIdDeleteProduct(list);
            return 1;
        }
        return 0;
    }
    @Override
@@ -58,21 +72,21 @@
    }
    @Override
    public List<String> deleteMaterialEqSpecification(String specificationsId) {
        LambdaQueryWrapper<Material> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(Material::getSpecificationsId, specificationsId);
        wrapper.select(Material::getId);
        List<Material> materials = materialMapper.selectList(wrapper);
        if (!ObjectUtils.isEmpty(materials)){
            List<String> list = new ArrayList<>();
            for (Material material:materials){
    public List<String> specificationsIdDeleteMaterial(List<Integer> deleteSpecificationsId) {
        List<String> list = new ArrayList<>();
        for (Integer serialNumberId:deleteSpecificationsId){
            LambdaQueryWrapper<Material> wrapper = new LambdaQueryWrapper<>();
            wrapper.eq(Material::getSpecificationsId, serialNumberId);
            wrapper.select(Material::getId);
            List<Material> maps1 = materialMapper.selectList(wrapper);
            for (Material material:maps1){
                LambdaUpdateWrapper<Material> updateWrapper = new LambdaUpdateWrapper<>();
                updateWrapper.eq(Material::getId, material.getId());
                updateWrapper.set(Material::getState, 0);
                materialMapper.update(new Material(), updateWrapper);
                list.add(material.getId());
            }
            int isDeleteList = materialMapper.deleteBatchIds(list);
            if (isDeleteList != 0) {
                return list;
            }
        }
        return null;
        return list;
    }
}
standard-server/src/main/java/com/yuanchu/limslaboratory/service/impl/ProductServiceImpl.java
@@ -1,6 +1,7 @@
package com.yuanchu.limslaboratory.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.yuanchu.limslaboratory.pojo.Product;
import com.yuanchu.limslaboratory.mapper.ProductMapper;
import com.yuanchu.limslaboratory.service.ProductService;
@@ -43,7 +44,7 @@
    }
    @Override
    public List<Map<String, Object>> getListProductInformation(Integer materialId) {
    public List<Map<String, Object>> getListProductInformation(String materialId) {
        LambdaQueryWrapper<Product> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(Product::getMaterialId, materialId);
        wrapper.select(Product::getId, Product::getName, Product::getFather);
@@ -77,23 +78,26 @@
    @Override
    public Integer deleteProductInformation(Integer productId) {
        LambdaQueryWrapper<Product> wrapper = new LambdaQueryWrapper<>();
        LambdaUpdateWrapper<Product> wrapper = new LambdaUpdateWrapper<>();
        wrapper.eq(Product::getId, productId);
        return productMapper.delete(wrapper);
        wrapper.set(Product::getState, 0);
        return productMapper.update(new Product(), wrapper);
    }
    @Override
    public void deleteProductEqMaterialId(List<String> materialListId) {
        for (String materialId : materialListId){
            LambdaQueryWrapper<Product> wrapper = new LambdaQueryWrapper<>();
    public void MaterialIdDeleteProduct(List<String> deleteMaterialId) {
        for (String materialId : deleteMaterialId){
            LambdaUpdateWrapper<Product> wrapper = new LambdaUpdateWrapper<>();
            wrapper.eq(Product::getMaterialId, materialId);
            wrapper.select(Product::getId);
            List<Product> products = productMapper.selectList(wrapper);
            List<Integer> productDeleteId = new ArrayList<>();
            for (Product product : products){
                productDeleteId.add(product.getId());
            }
            productMapper.deleteBatchIds(productDeleteId);
            wrapper.set(Product::getState, 0);
            productMapper.update(new Product(), wrapper);
        }
    }
    @Override
    public Integer updateMaterialInformation(Product product) {
        LambdaUpdateWrapper<Product> updateWrapper = new LambdaUpdateWrapper<>();
        updateWrapper.eq(Product::getId, product.getId());
        return productMapper.update(product, updateWrapper);
    }
}
standard-server/src/main/java/com/yuanchu/limslaboratory/service/impl/SerialNumberServiceImpl.java
@@ -1,14 +1,14 @@
package com.yuanchu.limslaboratory.service.impl;
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.SerialNumber;
import com.yuanchu.limslaboratory.mapper.SerialNumberMapper;
import com.yuanchu.limslaboratory.service.SerialNumberService;
import com.yuanchu.limslaboratory.pojo.Standards;
import com.yuanchu.limslaboratory.service.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yuanchu.limslaboratory.service.StandardsService;
import com.yuanchu.limslaboratory.service.UserService;
import com.yuanchu.limslaboratory.utils.MyUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -39,6 +39,15 @@
    @Autowired
    private StandardsService standardsService;
    @Autowired
    private SpecificationsService specificationsService;
    @Autowired
    private MaterialService materialService;
    @Autowired
    private ProductService productService;
    @Override
    public Integer addSerialNumberInformation(SerialNumber serialNumber) {
        Boolean userIsNull = userService.userIsNull(serialNumber.getUserId());
@@ -64,4 +73,47 @@
        wrapper.select(SerialNumber::getId,SerialNumber::getName);
        return serialNumberMapper.selectMaps(wrapper);
    }
    @Override
    public Integer updateSerialNumberInformation(SerialNumber serialNumber) {
        return serialNumberMapper.updateById(serialNumber);
    }
    @Override
    public List<String> StandardsIdDeleteSerialNumber(String standardsId) {
        LambdaQueryWrapper<SerialNumber> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(SerialNumber::getStandardsId, standardsId);
        wrapper.select(SerialNumber::getId);
        List<String> serialNumberId = new ArrayList<>();
        List<SerialNumber> maps = serialNumberMapper.selectList(wrapper);
        for (SerialNumber map:maps){
            LambdaUpdateWrapper<SerialNumber> updateWrapper = new LambdaUpdateWrapper<>();
            updateWrapper.eq(SerialNumber::getStandardsId, standardsId);
            updateWrapper.set(SerialNumber::getState, 0);
            serialNumberMapper.update(new SerialNumber(), updateWrapper);
            serialNumberId.add(map.getId());
        }
        return serialNumberId;
    }
    @Override
    public Integer deleteSerialNumberInformation(String serialNumberId) {
        LambdaUpdateWrapper<SerialNumber> updateWrapper = new LambdaUpdateWrapper<>();
        updateWrapper.eq(SerialNumber::getId, serialNumberId);
        updateWrapper.set(SerialNumber::getState, 0);
        List<String> list = new ArrayList<>();
        list.add(serialNumberId);
        int isDeleteSuccess = serialNumberMapper.update(new SerialNumber(), updateWrapper);
        if (isDeleteSuccess == 1){
            List<Integer> deleteSpecificationsId = specificationsService.SerialNumberIdDeleteSpecifications(list);
            if (!ObjectUtils.isEmpty(deleteSpecificationsId)){
                List<String> deleteMaterialId = materialService.specificationsIdDeleteMaterial(deleteSpecificationsId);
                if (!ObjectUtils.isEmpty(deleteMaterialId)){
                    productService.MaterialIdDeleteProduct(deleteMaterialId);
                }
            }
            return 1;
        }
        return 0;
    }
}
standard-server/src/main/java/com/yuanchu/limslaboratory/service/impl/SpecificationsServiceImpl.java
@@ -1,18 +1,21 @@
package com.yuanchu.limslaboratory.service.impl;
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.SerialNumber;
import com.yuanchu.limslaboratory.pojo.Specifications;
import com.yuanchu.limslaboratory.mapper.SpecificationsMapper;
import com.yuanchu.limslaboratory.service.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yuanchu.limslaboratory.utils.MyUtil;
import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@@ -78,20 +81,39 @@
    }
    @Override
    public Integer deleteSpecifications(String specificationsId) {
        LambdaQueryWrapper<Specifications> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(Specifications::getId, specificationsId);
        // 删除Specifications中的数据
        int delete = specificationsMapper.delete(wrapper);
        if (delete == 1){
            // 删除等于SpecificationsId的Material表格中的数据,并且获取该数据的Id,用于删除Product表格中的数据
            List<String> materialListId = materialService.deleteMaterialEqSpecification(specificationsId);
            if (!ObjectUtils.isEmpty(materialListId)){
                // 根据Material表返回的列表Id,删除Product表中所有MaterialId等于该列表中的所有数据,无返回值
                productService.deleteProductEqMaterialId(materialListId);
    public Integer deleteSpecifications(Integer specificationsId) {
        LambdaUpdateWrapper<Specifications> updateWrapper = new LambdaUpdateWrapper<>();
        updateWrapper.eq(Specifications::getId, specificationsId);
        updateWrapper.set(Specifications::getState, 0);
        List<Integer> list = new ArrayList<>();
        list.add(specificationsId);
        int isDeleteSuccess = specificationsMapper.update(new Specifications(), updateWrapper);
        if (isDeleteSuccess == 1){
            List<String> deleteMaterialId = materialService.specificationsIdDeleteMaterial(list);
            if (!ObjectUtils.isEmpty(deleteMaterialId)){
                productService.MaterialIdDeleteProduct(deleteMaterialId);
            }
            return 1;
        }
        return 0;
    }
    @Override
    public List<Integer> SerialNumberIdDeleteSpecifications(List<String> deleteSerialNumberId) {
        List<Integer> list = new ArrayList<>();
        for (String serialNumberId:deleteSerialNumberId){
            LambdaQueryWrapper<Specifications> wrapper = new LambdaQueryWrapper<>();
            wrapper.eq(Specifications::getSerialId, serialNumberId);
            wrapper.select(Specifications::getId);
            List<Specifications> maps1 = specificationsMapper.selectList(wrapper);
            for (Specifications specifications:maps1){
                LambdaUpdateWrapper<Specifications> updateWrapper = new LambdaUpdateWrapper<>();
                updateWrapper.eq(Specifications::getId, specifications.getId());
                updateWrapper.set(Specifications::getState, 0);
                specificationsMapper.update(new Specifications(), updateWrapper);
                list.add(specifications.getId());
            }
        }
        return list;
    }
}
standard-server/src/main/java/com/yuanchu/limslaboratory/service/impl/StandardsServiceImpl.java
@@ -1,15 +1,14 @@
package com.yuanchu.limslaboratory.service.impl;
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.Standards;
import com.yuanchu.limslaboratory.mapper.StandardsMapper;
import com.yuanchu.limslaboratory.pojo.User;
import com.yuanchu.limslaboratory.service.SerialNumberService;
import com.yuanchu.limslaboratory.service.StandardsService;
import com.yuanchu.limslaboratory.service.*;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yuanchu.limslaboratory.service.UserService;
import com.yuanchu.limslaboratory.utils.MyUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
@@ -40,6 +39,16 @@
    @Lazy
    @Autowired
    private SerialNumberService serialNumberService;
    @Lazy
    @Autowired
    private SpecificationsService specificationsService;
    @Autowired
    private MaterialService materialService;
    @Autowired
    private ProductService productService;
    @Override
    public Integer addStandardsInformation(Standards standards) {
@@ -79,4 +88,31 @@
    public IPage<Map<String, Object>> listPageStandardsInformation(Page<Object> page, String idOrNameOfStandards) {
        return standardsMapper.listPageStandardsInformation(page, idOrNameOfStandards);
    }
    @Override
    public Integer updateStandardsInformation(Standards standards) {
        return standardsMapper.updateById(standards);
    }
    @Override
    public Integer deleteStandardsInformation(String standardsId) {
        LambdaUpdateWrapper<Standards> updateWrapper = new LambdaUpdateWrapper<>();
        updateWrapper.eq(Standards::getId, standardsId);
        updateWrapper.set(Standards::getState, 0);
        int isDeleteSuccess = standardsMapper.update(new Standards(), updateWrapper);
        if (isDeleteSuccess == 1){
            List<String> deleteSerialNumberId = serialNumberService.StandardsIdDeleteSerialNumber(standardsId);
            if (!ObjectUtils.isEmpty(deleteSerialNumberId)){
                List<Integer> deleteSpecificationsId = specificationsService.SerialNumberIdDeleteSpecifications(deleteSerialNumberId);
                if (!ObjectUtils.isEmpty(deleteSpecificationsId)){
                    List<String> deleteMaterialId = materialService.specificationsIdDeleteMaterial(deleteSpecificationsId);
                    if (!ObjectUtils.isEmpty(deleteMaterialId)){
                        productService.MaterialIdDeleteProduct(deleteMaterialId);
                    }
                }
            }
            return 1;
        }
        return 0;
    }
}
sys/src/test/java/com/yuanchu/limslaboratory/SysApplicationTests.java
@@ -1,21 +1,10 @@
package com.yuanchu.limslaboratory;
import com.yuanchu.limslaboratory.service.SerialNumberService;
import com.yuanchu.limslaboratory.utils.MyUtil;
import com.yuanchu.limslaboratory.utils.RedisUtil;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import java.text.NumberFormat;
import java.util.List;
import java.util.Map;
@SpringBootTest
class SysApplicationTests {
    @Autowired
    private SerialNumberService serialNumberService;
    @Test
    void contextLoads() {