搬迁基础模块(检验对象+检验项目+原始记录模块+标准库+标准方法+场所与设施+实验室资质)
已修改9个文件
已添加115个文件
9065 ■■■■■ 文件已修改
basic-server/pom.xml 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/controller/CapacityScopeController.java 393 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/controller/CertificationController.java 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/controller/LaboratoryController.java 62 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/controller/ProductPartController.java 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/controller/ProductSupplierDensityController.java 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/controller/StandardMethodController.java 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/controller/StandardTemplateController.java 68 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/controller/StandardTreeController.java 276 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/controller/StructureTestObjectPartController.java 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/dto/CopyStandardProductListDto.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/dto/FactoryDto.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/dto/IfsInventoryQuantityCheckDto.java 182 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/dto/IfsInventoryQuantityDto.java 82 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/dto/IfsInventoryQuantitySupplierDto.java 124 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/dto/InsSampleReceiveDto.java 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/dto/LaboratoryDto.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/dto/ModelDto.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/dto/PageTestObjectDto.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/dto/ProductDTO1.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/dto/ProductDto.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/dto/ResetTreeDragDTO.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/dto/SampleDto.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/dto/SampleTypeDto.java 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/dto/TestItemDto.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/excel/StructureTestObjectData.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/excel/StructureTestObjectListener.java 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/mapper/CertificationMapper.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/mapper/IfsInventoryQuantityMapper.java 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/mapper/LaboratoryMapper.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/mapper/ProductMapper.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/mapper/ProductPartMapper.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/mapper/ProductSupplierDensityMapper.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/mapper/StandardMethodListMapper.java 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/mapper/StandardMethodMapper.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/mapper/StandardProductListMapper.java 69 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/mapper/StandardProductListSupplierAskMapper.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/mapper/StandardTemplateMapper.java 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/mapper/StandardTreeMapper.java 92 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/mapper/StructureItemParameterMapper.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/mapper/StructureTestObjectMapper.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/mapper/StructureTestObjectPartMapper.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/pojo/Certification.java 72 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/pojo/IfsInventoryQuantity.java 210 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/pojo/InsSample1.java 123 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/pojo/Laboratory.java 62 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/pojo/Product.java 57 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/pojo/ProductPart.java 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/pojo/ProductSupplierDensity.java 57 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/pojo/StandardMethod.java 85 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/pojo/StandardMethodList.java 83 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/pojo/StandardProductList.java 221 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/pojo/StandardProductListSupplierAsk.java 58 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/pojo/StandardTemplate.java 76 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/pojo/StandardTree.java 96 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/pojo/StructureItemParameter.java 121 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/pojo/StructureTestObject.java 63 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/pojo/StructureTestObjectPart.java 56 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/service/CapacityScopeService.java 46 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/service/CertificationService.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/service/LaboratoryService.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/service/ProductPartService.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/service/ProductService.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/service/ProductSupplierDensityService.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/service/StandardMethodListService.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/service/StandardMethodService.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/service/StandardProductListService.java 67 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/service/StandardProductListService2.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/service/StandardProductListSupplierAskService.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/service/StandardTemplateService.java 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/service/StandardTreeService.java 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/service/StructureItemParameterService.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/service/StructureTestObjectPartService.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/service/StructureTestObjectService.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/service/impl/CapacityScopeServiceImpl.java 185 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/service/impl/CertificationServiceImpl.java 45 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/service/impl/LaboratoryServiceImpl.java 53 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/service/impl/ProductPartServiceImpl.java 68 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/service/impl/ProductServiceImpl.java 188 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/service/impl/ProductSupplierDensityServiceImpl.java 64 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardMethodListServiceImpl.java 150 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardMethodServiceImpl.java 260 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardProductListService2Impl.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardProductListServiceImpl.java 701 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardProductListSupplierAskServiceImpl.java 79 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardTemplateServiceImpl.java 130 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardTreeServiceImpl.java 535 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/service/impl/StructureItemParameterServiceImpl.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/service/impl/StructureTestObjectPartServiceImpl.java 75 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/java/com/ruoyi/basic/service/impl/StructureTestObjectServiceImpl.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/resources/mapper/CertificationMapper.xml 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/resources/mapper/IfsInventoryQuantityMapper.xml 74 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/resources/mapper/LaboratoryMapper.xml 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/resources/mapper/ProductMapper.xml 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/resources/mapper/ProductPartMapper.xml 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/resources/mapper/ProductSupplierDensityMapper.xml 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/resources/mapper/StandardMethodListMapper.xml 99 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/resources/mapper/StandardMethodMapper.xml 67 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/resources/mapper/StandardProductListMapper.xml 144 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/resources/mapper/StandardProductListSupplierAskMapper.xml 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/resources/mapper/StandardTemplateMapper.xml 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/resources/mapper/StandardTreeMapper.xml 384 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/resources/mapper/StructureItemParameterMapper.xml 121 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/resources/mapper/StructureTestMapper.xml 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/src/main/resources/mapper/StructureTestObjectPartMapper.xml 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/pom.xml 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/java/com/ruoyi/basic/pojo/InsSample.java 123 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pom.xml 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/pom.xml 33 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/pom.xml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/java/com/ruoyi/common/handler/MybatisHandler.java 23 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/java/com/ruoyi/common/numgen/LambdaUtils.java 127 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/java/com/ruoyi/common/numgen/NumberGenerator.java 146 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/java/com/ruoyi/common/numgen/NumberGeneratorModelHelper.java 107 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/java/com/ruoyi/common/numgen/NumberTableInfo.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/java/com/ruoyi/common/numgen/SerializedLambda.java 143 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-framework/src/main/java/com/ruoyi/framework/mybatis_config/MyBaseMapper.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-framework/src/main/java/com/ruoyi/framework/mybatis_config/MyBatisPlusConfig.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-framework/src/main/java/com/ruoyi/framework/mybatis_config/MySqlInjector.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/GlobalExceptionHandler.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictTypeMapper.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDictTypeService.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java 35 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/resources/mapper/system/SysDictTypeMapper.xml 234 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
basic-server/pom.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>ruoyi</artifactId>
        <groupId>com.ruoyi</groupId>
        <version>3.8.9</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <artifactId>basic-server</artifactId>
    <dependencies>
        <dependency>
            <groupId>com.ruoyi</groupId>
            <artifactId>ruoyi-common</artifactId>
        </dependency>
        <dependency>
            <groupId>com.ruoyi</groupId>
            <artifactId>ruoyi-framework</artifactId>
        </dependency>
        <dependency>
            <groupId>com.ruoyi</groupId>
            <artifactId>ruoyi-system</artifactId>
        </dependency>
    </dependencies>
    <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
    </properties>
</project>
basic-server/src/main/java/com/ruoyi/basic/controller/CapacityScopeController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,393 @@
package com.ruoyi.basic.controller;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.poi.excel.ExcelUtil;
import com.alibaba.excel.EasyExcel;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.core.domain.Result;
import com.ruoyi.common.core.domain.entity.SysDictData;
import com.ruoyi.system.service.ISysDictTypeService;
import com.ruoyi.basic.dto.PageTestObjectDto;
import com.ruoyi.basic.dto.ProductDTO1;
import com.ruoyi.basic.excel.StructureTestObjectData;
import com.ruoyi.basic.excel.StructureTestObjectListener;
import com.ruoyi.basic.pojo.Product;
import com.ruoyi.basic.pojo.StandardTemplate;
import com.ruoyi.basic.pojo.StructureItemParameter;
import com.ruoyi.basic.pojo.StructureTestObject;
import com.ruoyi.basic.service.CapacityScopeService;
import com.ruoyi.basic.service.ProductService;
import com.ruoyi.basic.service.StandardTemplateService;
import com.ruoyi.basic.service.StructureItemParameterService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
/**
 * æ£€éªŒé¡¹ç›®å‚æ•°(StructureItemParameter)表控制层
 *
 * @author makejava
 * @since 2024-02-26 16:21:17
 */
@Api(tags = "能力范围")
@AllArgsConstructor
@RestController
@RequestMapping("/capacityScope")
public class CapacityScopeController {
    private CapacityScopeService capacityScopeService;
    private ProductService productService;
    private StructureItemParameterService structureItemParameterService;
    private ISysDictTypeService dictTypeService;
    private StandardTemplateService standardTemplateService;
    @ApiOperation(value = "获取项目检验参数列表")
    @PostMapping("/selectItemParameterList")
    public Result selectItemParameterList(Page page,StructureItemParameter itemParameter) throws Exception {
        return Result.success(capacityScopeService.selectItemParameterList(page, itemParameter));
    }
    @ApiOperation(value = "添加项目检验参数")
    @PostMapping("/addItemParameter")
    public Result addItemParameter(@RequestBody StructureItemParameter itemParameter) {
        return Result.success(capacityScopeService.addItemParameter(itemParameter));
    }
    @ApiOperation(value = "删除项目检验参数")
    @PostMapping("/delItemParameter")
    public Result<?> delItemParameter(Integer id) {
        return Result.success(capacityScopeService.delItemParameter(id));
    }
    @ApiOperation(value = "修改项目检验参数")
    @PostMapping("/upItemParameter")
    public Result<?> upItemParameter(@RequestBody StructureItemParameter itemParameter) {
        return Result.success(capacityScopeService.upItemParameter(itemParameter));
    }
    @ApiOperation(value = "获取检验对象")
    @PostMapping("/selectTestObjectList")
    public Result selectTestObjectList(Page page,PageTestObjectDto pageTestObjectDto) throws Exception {
        return Result.success(capacityScopeService.selectTestObjectList(page, pageTestObjectDto));
    }
    @ApiOperation(value = "添加检验对象")
    @PostMapping("/addTestObject")
    public Result addTestObject(@RequestBody StructureTestObject testObject) {
        return Result.success(capacityScopeService.addTestObject(testObject));
    }
    @ApiOperation(value = "删除检验对象")
    @PostMapping("/delTestObject")
    public Result<?> delTestObject(Integer id) {
        return Result.success(capacityScopeService.delTestObject(id));
    }
    @ApiOperation(value = "修改检验对象")
    @PostMapping("/upTestObject")
    public Result upTestObject(@RequestBody StructureTestObject testObject) {
        return Result.success(capacityScopeService.upTestObject(testObject));
    }
    @ApiOperation(value = "获取检验对象枚举")
    @GetMapping("/selectTestObjectByName")
    public Result selectTestObjectByName() {
        return Result.success(capacityScopeService.selectTestObjectByName());
    }
    @ApiOperation(value = "设备里面选择检验项目(树形结构)")
    @PostMapping("/getInsProduction")
    public Result getInsProduction() {
        return Result.success(capacityScopeService.getInsProduction());
    }
    @ApiOperation(value = "维护检验对象的产品")
    @PostMapping("/selectProductListByObjectId")
    public Result selectProductListByObjectId(Page page,ProductDTO1 productDTO) throws Exception {
        return Result.success(productService.selectProductListByObjectId(page, productDTO));
    }
    @ApiOperation(value = "添加产品")
    @PostMapping("/addProduct")
    public Result addProduct(@RequestBody Product product) {
        return Result.success(productService.addProduct(product));
    }
    @ApiOperation(value = "修改产品")
    @PostMapping("/upProduct")
    public Result upProduct(@RequestBody Product product) {
        return Result.success(productService.upProduct(product));
    }
    @ApiOperation(value = "删除产品")
    @PostMapping("/delProduct")
    public Result delProduct(Integer id) {
        return Result.success(productService.delProduct(id));
    }
    @ApiOperation(value = "获取检验对象树")
    @GetMapping("/getItemTree")
    public Result getItemTree() {
        return Result.success(capacityScopeService.getItemTree());
    }
    @ApiOperation(value = "装备导入检验项目")
    @PostMapping("/importEquipData")
    @Transactional
    public Result importEquipData(@RequestParam("file") MultipartFile file) throws Exception {
        InputStream inputStream = file.getInputStream();
        List<StructureItemParameter> lists = new ArrayList<>();
        AtomicReference<String> sample = new AtomicReference<>();
        ExcelUtil.readBySax(inputStream, -1, (i, l, list1) -> {
            if (l == 1) {
                sample.set(list1.get(1) + "");
            }
            if (l >= 1) {
                StructureItemParameter str = new StructureItemParameter();
                // æµ‹è¯•对象
                if (list1.get(1) == null) {
                    str.setSample(null);
                } else {
                    String brand = (String) list1.get(1);
                    StringBuilder builder = new StringBuilder();
                    builder.append("[");
                    // äº§å“
                    if (ObjectUtil.isNotEmpty(list1.get(2))) {
                        String production = (String) list1.get(2);
                        if (!production.contains(";")) {
                            builder.append(String.format("[\"%s\",\"%s\"]", brand, production));
                        } else {
                            Arrays.stream(production.split(";")).forEach(item -> {
                                builder.append(String.format("[\"%s\",\"%s\"],", brand, item));
                            });
                            builder.deleteCharAt(builder.length() - 1);
                        }
                    } else {
                        builder.append("[");
                        builder.append(String.format("\"%s\"", brand));
                        builder.append("]");
                    }
                    builder.append("]");
                    str.setSample(builder.toString());
                }
                // æ£€éªŒé¡¹
                str.setInspectionItem(list1.get(4).toString().trim());
                // æ£€éªŒé¡¹è‹±æ–‡
                if (list1.get(5) != null) {
                    str.setInspectionItemEn(list1.get(5).toString());
                }
                // æ£€éªŒå­é¡¹
                if (list1.get(6) == null) {
                    str.setInspectionItemSubclass(null);
                } else {
                    str.setInspectionItemSubclass(list1.get(6).toString().trim());
                }
                // æ£€éªŒå­é¡¹è‹±æ–‡
                if (list1.get(7) == null) {
                    str.setInspectionItemSubclassEn(null);
                } else {
                    str.setInspectionItemSubclassEn(String.valueOf(list1.get(7).toString()));
                }
                // æ£€éªŒé¡¹åˆ†ç±»
                if (list1.get(22) != null && list1.get(22) != "") {
                    str.setInspectionItemClass(list1.get(22).toString().trim());
                } else {
                    str.setInspectionItemClass(null);
                }
                // æ£€éªŒé¡¹åˆ†ç±»è‹±æ–‡
                if (list1.get(23) != null && list1.get(23) != "") {
                    str.setInspectionItemClassEn(list1.get(23) + "");
                } else {
                    str.setInspectionItemClassEn(null);
                }
                LambdaQueryWrapper<StructureItemParameter> wrapper = Wrappers.lambdaQuery(StructureItemParameter.class)
                        .eq(StructureItemParameter::getInspectionItem, str.getInspectionItem())
                        .eq(StructureItemParameter::getSample, str.getSample())
                        .last("limit 1");
                // åˆ¤æ–­æ˜¯å¦æœ‰æ£€éªŒé¡¹ç±»åž‹
                if (ObjectUtils.isNotEmpty(str.getInspectionItemClass())) {
                    wrapper.eq(StructureItemParameter::getInspectionItemClass, str.getInspectionItemClass());
                }
                // åˆ¤æ–­æ˜¯å¦æœ‰æ£€éªŒå­é¡¹
                if (ObjectUtils.isNotEmpty(str.getInspectionItemSubclass())) {
                    wrapper.eq(StructureItemParameter::getInspectionItemSubclass, str.getInspectionItemSubclass());
                }
                StructureItemParameter db_str = structureItemParameterService.getOne(wrapper);
                if (ObjectUtils.isNotEmpty(db_str)) {
                    str.setId(db_str.getId());
                }
                // æ–¹æ³•名称
                if (list1.get(8) == null) {
                    str.setMethod(null);
                } else {
                    StringBuffer buffer = new StringBuffer();
                    String input = list1.get(8).toString();
                    buffer.append("[");
                    String[] values = input.split(";");
                    for (String value : values) {
                        buffer.append("\"").append(value.trim()).append("\",");
                    }
                    buffer.deleteCharAt(buffer.length() - 1);
                    buffer.append("]");
                    str.setMethod(buffer.toString());
                }
                // è¯•验室
                if (list1.get(9) == null) {
                    str.setSonLaboratory(null);
                } else {
                    str.setSonLaboratory(list1.get(9).toString());
                }
                // è®¡é‡å•位
                if (list1.get(10) == null) {
                    str.setUnit(null);
                } else {
                    str.setUnit(list1.get(10).toString());
                }
                // è¦æ±‚值
                if (list1.get(11) == null) {
                    str.setAskTell(null);
                } else {
                    str.setAskTell(list1.get(11).toString());
                }
                // è¦æ±‚描述
                if (list1.get(12) == null) {
                    str.setAsk(null);
                } else {
                    str.setAsk(list1.get(12).toString());
                }
                // å•ä»·
                if (list1.get(13) == null) {
                    str.setPrice(null);
                } else {
                    str.setPrice(list1.get(13) + "");
                }
                // å·¥æ—¶ç³»æ•°
                if (list1.get(14) == null) {
                    str.setManHour(null);
                } else {
                    str.setManHour(Double.valueOf(list1.get(14).toString()));
                }
                // å·¥æ—¶åˆ†ç»„
                if (list1.get(15) == null) {
                    str.setManHourGroup(null);
                } else {
                    str.setManHourGroup(list1.get(15).toString());
                }
                // é¢„计完成时间
                if (list1.get(16) == null) {
                    str.setManDay(null);
                } else {
                    str.setManDay(Integer.valueOf(list1.get(16).toString()));
                }
                // æ•°æ®ç±»åž‹
                String jy;
                if (list1.get(17).toString().equals("非采集类型")) {
                    jy = "0";
                } else {
                    jy = "1";
                }
                str.setInspectionItemType(jy);
                // æ£€éªŒé¡¹ç±»åž‹
                String validateValueType = list1.get(18).toString();
                if (ObjectUtils.isNotEmpty(validateValueType)) {
                    List<SysDictData> enums = dictTypeService.selectDictDataByName("检验值类型")
                            .stream().filter(sysDictData -> sysDictData.getDictLabel().equals(validateValueType)).collect(Collectors.toList());
                    str.setInspectionValueType(enums.get(0).getDictValue());
                }
                int bsm;
                //特殊标识
                if (list1.get(19).toString().equals("否")) {
                    bsm = 0;
                } else {
                    bsm = 1;
                }
                str.setBsm(bsm + "");
                // æ•°å­—å­—å…¸
                if (list1.get(20) != null) {
                    str.setDic(list1.get(20) + "");
                } else {
                    str.setDic(null);
                }
                // åŽŸå§‹è®°å½•æ¨¡æ¿
                StandardTemplate standTempIdByName = standardTemplateService.getStandTempIdByName(String.valueOf(list1.get(21)));
                if (standTempIdByName != null) {
                    str.setTemplateId(standTempIdByName.getId());
                } else {
                    str.setTemplateId(null);
                }
                try {
                    if (list1.get(24) != null) {
                        str.setLaboratory(list1.get(24) + "");
                    }
                } catch (Exception e) {
                }
                // æ¡ä»¶
                if (list1.get(25) == null) {
                    str.setRadiusList(null);
                } else {
                    StringBuffer buffer = new StringBuffer();
                    String input = list1.get(25).toString();
                    buffer.append("[");
                    String[] values = input.split(";");
                    for (String value : values) {
                        buffer.append("\"").append(value.trim()).append("\",");
                    }
                    buffer.deleteCharAt(buffer.length() - 1);
                    buffer.append("]");
                    str.setRadiusList(buffer.toString());
                }
                // æ”¶è´¹æ ‡å‡†
                if (list1.get(26) == null) {
                    str.setRates(null);
                } else {
                    str.setRates(list1.get(26) + "");
                }
                lists.add(str);
            }
        });
//        structureItemParameterService.removeNoSample(sample.get());
        // å¦‚果数据库里面的数据存在那么就执行更新拷贝操作
        try {
            structureItemParameterService.saveOrUpdateBatch(lists);
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException("服务端报错");
        }
        return Result.success();
    }
    @ApiOperation(value = "导入检验对象")
    @PostMapping("/importExcel")
    public Result importExcel(@RequestParam("file") MultipartFile file) {
        try {
            EasyExcel.read(file.getInputStream(), StructureTestObjectData.class, new StructureTestObjectListener(productService)).sheet().doRead();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return Result.success();
    }
}
basic-server/src/main/java/com/ruoyi/basic/controller/CertificationController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,41 @@
package com.ruoyi.basic.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.core.domain.Result;
import com.ruoyi.basic.pojo.Certification;
import com.ruoyi.basic.service.CertificationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@Api(tags = "资质说明")
@AllArgsConstructor
@RestController
@RequestMapping("/certification")
public class CertificationController {
    private CertificationService certificationService;
    @ApiOperation(value = "查询资质明细列表")
    @PostMapping("/getCertificationDetail")
    public Result getCertificationDetail(Page page,Certification certification) {
        return Result.success(certificationService.getCertificationDetail(page, certification));
    }
    @ApiOperation(value = "添加资质明细列表")
    @PostMapping("/addCertificationDetail")
    public Result addCertificationDetail(@RequestBody Certification certification) {
        return Result.success(certificationService.addCertificationDetail(certification));
    }
    @ApiOperation(value = "删除资质明细列表")
    @PostMapping("/delCertificationDetail")
    public Result<?> delCertificationDetail( String ids) {
        return Result.success(certificationService.delCertificationDetail(ids));
    }
}
basic-server/src/main/java/com/ruoyi/basic/controller/LaboratoryController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,62 @@
package com.ruoyi.basic.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.core.domain.Result;
import com.ruoyi.basic.pojo.Laboratory;
import com.ruoyi.basic.service.LaboratoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/**
 * å®žéªŒå®¤ç®¡ç†(LaboratoryController)表控制层
 */
@Api(tags = "场所或设施")
@RestController
@RequestMapping("/laboratoryScope")
public class LaboratoryController {
    @Resource
    private LaboratoryService laboratoryService;
    @ApiOperation(value = "查询实验室管理列表")
    @PostMapping("/selectItemParameter")
    public Result selectItemParameter(Page page ,Laboratory itemParameter) {
        return Result.success(laboratoryService.selectItemParameter(page, itemParameter));
    }
    @ApiOperation(value = "添加实验室参数")
    @PostMapping("/addParameter")
    public Result addParameter(@RequestBody Laboratory itemParameter) {
        return Result.success(laboratoryService.addParameter(itemParameter));
    }
    @ApiOperation(value = "删除实验室参数")
    @PostMapping("/delParameter")
    public Result<?> delParameter(Integer id) {
        return Result.success(laboratoryService.delParameter(id));
    }
    @ApiOperation(value = "修改实验室参数")
    @PostMapping("/upParameter")
    public Result<?> upParameter(@RequestBody Laboratory itemParameter) {
        return Result.success(laboratoryService.upParameter(itemParameter));
    }
    @ApiOperation(value = "获取实验室名称")
    @GetMapping("/obtainItemParameterList")
    public Result obtainItemParameterList() {
        return Result.success(laboratoryService.obtainItemParameterList());
    }
}
basic-server/src/main/java/com/ruoyi/basic/controller/ProductPartController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,50 @@
package com.ruoyi.basic.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.core.domain.Result;
import com.ruoyi.basic.pojo.ProductPart;
import com.ruoyi.basic.service.ProductPartService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@AllArgsConstructor
@RequestMapping("/productPart")
@Api(tags = "产品零件绑定")
public class ProductPartController {
    private ProductPartService productPartService;
    @ApiOperation(value = "根据产品id查询零件")
    @PostMapping("/selectByProductId")
    public Result selectByProductId(Page page,ProductPart productPart){
        return Result.success(productPartService.selectByProductId(page,productPart));
    }
    @ApiOperation(value = "新增产品零件")
    @PostMapping("/addProductPart")
    public Result addProductPart(@RequestBody ProductPart productPart) {
        productPartService.addProductPart(productPart);
        return Result.success();
    }
    @ApiOperation(value = "更新产品零件")
    @PostMapping("/updateProductPart")
    public Result updateProductPart(@RequestBody ProductPart productPart) {
        productPartService.updateProductPartById(productPart);
        return Result.success();
    }
    @ApiOperation(value = "删除产品零件")
    @PostMapping("/deleteProductPart")
    public Result deleteProductPart(Integer id) {
        productPartService.removeById(id);
        return Result.success();
    }
}
basic-server/src/main/java/com/ruoyi/basic/controller/ProductSupplierDensityController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,59 @@
package com.ruoyi.basic.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.core.domain.Result;
import com.ruoyi.basic.pojo.ProductSupplierDensity;
import com.ruoyi.basic.service.ProductSupplierDensityService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
 * äº§å“åŽ‚å®¶å¯†åº¦ç»‘å®šè¡¨
 *
 * @author zhuo
 * @since 2024-09-19
 */
@RestController
@RequestMapping("/productSupplierDensity")
@AllArgsConstructor
@Api(tags = "产品厂家密度绑定")
public class ProductSupplierDensityController {
    private ProductSupplierDensityService productSupplierDensityService;
    @ApiOperation(value = "根据产品id查询厂家密度绑定")
    @PostMapping("/selectSupplierDensityByProductId")
    public Result selectSupplierDensityByProductId(Page page,ProductSupplierDensity supplierDensity) {
        return Result.success(productSupplierDensityService.selectByProductId(page, supplierDensity));
    }
    @ApiOperation(value = "新增厂家密度绑定")
    @PostMapping("/addProductSupplierDensity")
    public Result addProductSupplierDensity(@RequestBody ProductSupplierDensity supplierDensity) {
        productSupplierDensityService.addProductSupplierDensity(supplierDensity);
        return Result.success();
    }
    @ApiOperation(value = "更新厂家密度绑定")
    @PostMapping("/updateProductSupplierDensity")
    public Result updateProductSupplierDensity(@RequestBody ProductSupplierDensity supplierDensity) {
        productSupplierDensityService.updateProductSupplierDensity(supplierDensity);
        return Result.success();
    }
    @ApiOperation(value = "删除厂家密度绑定")
    @PostMapping("/deleteProductSupplierDensity")
    public Result deleteProductSupplierDensity(Integer id) {
        productSupplierDensityService.removeById(id);
        return Result.success();
    }
}
basic-server/src/main/java/com/ruoyi/basic/controller/StandardMethodController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,59 @@
package com.ruoyi.basic.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.core.domain.Result;
import com.ruoyi.basic.pojo.StandardMethod;
import com.ruoyi.basic.service.StandardMethodService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
@Api(tags = "标准方法")
@RestController
@RequestMapping("/standardMethod")
@AllArgsConstructor
public class StandardMethodController {
    private StandardMethodService standardMethodService;
    @ApiOperation(value = "获取标准方法列表")
    @PostMapping("/selectStandardMethodList")
    public Result selectStandardMethodList(Page page,StandardMethod standardMethod) throws Exception {
        return Result.success(standardMethodService.selectStandardMethodList(page, standardMethod));
    }
    @ApiOperation(value = "获取标准方法枚举")
    @GetMapping("/selectStandardMethods")
    public Result selectStandardMethods(){
        return Result.success(standardMethodService.selectStandardMethods());
    }
    @ApiOperation(value = "添加标准方法")
    @PostMapping("/addStandardMethod")
    public Result addStandardMethod(@RequestBody StandardMethod standardMethod) {
        return Result.success(standardMethodService.addStandardMethod(standardMethod));
    }
    @ApiOperation(value = "删除标准方法")
    @PostMapping("/delStandardMethod")
    public Result<?> delStandardMethod(Integer id) {
        return Result.success(standardMethodService.delStandardMethod(id));
    }
    @ApiOperation(value = "修改标准方法")
    @PostMapping("/upStandardMethod")
    public Result<?> upStandardMethod(@RequestBody StandardMethod standardMethod) {
        return Result.success(standardMethodService.upStandardMethod(standardMethod));
    }
    @ApiOperation(value = "导入标准明细")
    @PostMapping("/importStandardDetails")
    public Result<?> importStandardDetails(@RequestPart("file") MultipartFile file) throws IOException {
        standardMethodService.inputExcel(file);
        return Result.success();
    }
}
basic-server/src/main/java/com/ruoyi/basic/controller/StandardTemplateController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,68 @@
package com.ruoyi.basic.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.core.domain.Result;
import com.ruoyi.basic.pojo.StandardTemplate;
import com.ruoyi.basic.service.StandardTemplateService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;
@RequestMapping("/StandardTemplate")
@RestController
@AllArgsConstructor
@Api(tags = "原始记录模板")
public class StandardTemplateController {
    private StandardTemplateService standardTemplateService;
    @ApiOperation(value = "获取原始记录模板列表")
    @PostMapping("/selectStandardTemplatePageList")
    public Result selectStandardTemplatePageList(Page page,StandardTemplate standardTemplate) throws Exception {
        return Result.success(standardTemplateService.selectStandardTemplatePageList(page, standardTemplate));
    }
    @ApiOperation(value = "添加原始记录模板")
    @PostMapping("/addStandardTemplate")
    public Result addStandardTemplate(@RequestBody StandardTemplate standardTemplate) {
        return Result.success(standardTemplateService.addStandardTemplate(standardTemplate));
    }
    @ApiOperation(value = "修改原始记录模板")
    @PostMapping("/upStandardTemplate")
    public Result<?> upStandardTemplate(@RequestBody StandardTemplate standardTemplate) {
        return Result.success(standardTemplateService.upStandardTemplate(standardTemplate));
    }
    @ApiOperation(value = "删除原始记录模板")
    @PostMapping("/delStandardTemplate")
    public Result<?> delStandardTemplate(Integer id) {
        return Result.success(standardTemplateService.delStandardTemplate(id));
    }
    @ApiOperation(value = "查询原始记录模板枚举")
    @GetMapping("/getStandardTemplate")
    public Result<?> getStandardTemplate() {
        return Result.success(standardTemplateService.getStandardTemplate());
    }
    @ApiOperation(value = "通过模板id获取检验项模板内容")
    @PostMapping("/getStandTempThingById")
    public Result<?> getStandTempThingById(Integer id) {
        return Result.success(standardTemplateService.getStandTempThingById(id));
    }
    @ApiOperation(value = "编辑模板编制")
    @GetMapping("/getEditTemplatePreparation")
    public Result<?> getEditTemplatePreparation(@RequestParam("id") Integer id) {
        StandardTemplate byId = standardTemplateService.getById(id);
        return Result.success("OK", byId.getThing());
    }
    @ApiOperation(value = "复制原始记录模板")
    @PostMapping("/copyStandardTemplate")
    public Result copyStandardTemplate(@RequestBody StandardTemplate newTemplate) {
        return Result.success(standardTemplateService.copyStandardTemplate(newTemplate));
    }
}
basic-server/src/main/java/com/ruoyi/basic/controller/StandardTreeController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,276 @@
package com.ruoyi.basic.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.ruoyi.common.core.domain.Result;
import com.ruoyi.basic.dto.CopyStandardProductListDto;
import com.ruoyi.basic.dto.FactoryDto;
import com.ruoyi.basic.dto.InsSampleReceiveDto;
import com.ruoyi.basic.dto.ResetTreeDragDTO;
import com.ruoyi.basic.pojo.StandardProductList;
import com.ruoyi.basic.pojo.StandardProductListSupplierAsk;
import com.ruoyi.basic.pojo.StandardTree;
import com.ruoyi.basic.service.StandardMethodListService;
import com.ruoyi.basic.service.StandardProductListService;
import com.ruoyi.basic.service.StandardProductListSupplierAskService;
import com.ruoyi.basic.service.StandardTreeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
import java.util.Map;
@RestController
@AllArgsConstructor
@RequestMapping("/standardTree")
@Api(tags = "标准库")
public class StandardTreeController {
    private StandardTreeService standardTreeService;
    private StandardMethodListService standardMethodListService;
    private StandardProductListService standardProductListService;
    private StandardProductListSupplierAskService standardProductListSupplierAskService;
    @ApiOperation(value = "获取标准树")
    @GetMapping("/selectStandardTreeList")
    public Result selectStandardTreeList() {
        return Result.success(standardTreeService.selectStandardTreeList());
    }
    @ApiOperation(value = "获取标准树(检验下单)")
    @GetMapping("/selectStandardTreeList2")
    public Result selectStandardTreeList2() {
        return Result.success(standardTreeService.selectStandardTreeList());
    }
    @ApiOperation(value = "添加标准树")
    @PostMapping("/addStandardTree")
    public Result addStandardTree(@RequestBody StandardTree standardTree) {
        return Result.success(standardTreeService.addStandardTree(standardTree));
    }
    @ApiOperation(value = "给标准树添加检验标准")
    @PostMapping("/addStandardMethodList")
    public Result addStandardMethodList(String tree, Integer standardId) {
        return Result.success(standardMethodListService.addStandardMethodList(standardId, tree));
    }
    @ApiOperation(value = "根据标准树进行标准查询")
    @PostMapping("/selectsStandardMethodByFLSSM")
    public Result selectsStandardMethodByFLSSM(String tree) {
        return Result.success(standardMethodListService.selectsStandardMethodByFLSSM(tree));
    }
    @ApiOperation(value = "修改标准库中的内容")
    @PostMapping("/upStandardProductList")
    public Result upStandardProductList(String str) {
        StandardProductList list = JSON.parseObject(str, StandardProductList.class);
        return Result.success(standardProductListService.upStandardProductList(list));
    }
    @ApiOperation(value = "修改标准库区间")
    @PostMapping("/updateSection")
    public Result updateSection(String str) {
        StandardProductList list = JSON.parseObject(str, StandardProductList.class);
        return Result.success(standardProductListService.updateSection(list));
    }
    @ApiOperation(value = "删除标准树下的检验标准")
    @PostMapping("/delStandardMethodByFLSSM")
    public Result delStandardMethodByFLSSM(Integer id) {
        return Result.success(standardMethodListService.delStandardMethodByFLSSM(id));
    }
    @ApiOperation(value = "删除标准树下的检验项目")
    @PostMapping("/delStandardProductByIds")
    public Result delStandardProductByIds(String ids) {
        JSONArray lists = JSON.parseArray(ids);
        return Result.success(standardProductListService.delStandardProduct(lists));
    }
    @ApiOperation(value = "新增标准树下的检验项目")
    @PostMapping("/addStandardProduct")
    public Result addStandardProduct(String ids, String tree) {
        return Result.success(standardTreeService.addStandardProduct(ids, tree));
    }
    @ApiOperation(value = "删除标准树的层级")
    @PostMapping("/delStandardTree")
    public Result delStandardTree(String tree) {
        return Result.success(standardTreeService.delStandardTree(tree));
    }
    @ApiOperation(value = "通过标准树查询对应的检验项目")
    @PostMapping("/selectStandardProductList")
    public Result selectStandardProductList(@RequestBody InsSampleReceiveDto insSample) {
        return Result.success(standardProductListService.selectStandardProductList(insSample));
    }
    @ApiOperation(value = "通过检验标准查询检验项目")
    @PostMapping("/selectStandardProductListByMethodId")
    public Result selectStandardProductListByMethodId(Integer id, String tree, Integer page) {
        return Result.success(standardProductListService.selectStandardProductListByMethodId(id, tree, page));
    }
    @ApiOperation(value = "批量编辑查询检验项目")
    @PostMapping("/selectStandardProductByMethodId")
    public Result selectStandardProductByMethodId(Integer id, String tree, Integer page, String laboratory, String item, String items) {
        return Result.success(standardProductListService.selectStandardProductByMethodId(id, tree, page, laboratory, item, items));
    }
    @ApiOperation(value = "批量编辑查询所有检验项目和检验子项枚举")
    @PostMapping("/selectStandardProductEnumByMethodId")
    public Result selectStandardProductEnumByMethodId(Integer id, String tree, String item) {
        return Result.success(standardProductListService.selectStandardProductEnumByMethodId(id, tree, item));
    }
    @ApiOperation(value = "获取标准树下标准方法枚举")
    @GetMapping("/selectStandardMethodEnum")
    public Result selectStandardMethodEnum() {
        return Result.success(standardMethodListService.selectStandardMethodEnum());
    }
    @ApiOperation(value = "获取产品架构")
    @GetMapping("/getStandardTree2")
    public Result getStandardTree2() {
        return Result.success(standardTreeService.getStandardTree2());
    }
    @ApiOperation(value = "批量修改项目内容")
    @PostMapping("/upStandardProducts")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "standardProductList", dataTypeClass = StandardProductList.class),
            @ApiImplicitParam(name = "ids", dataTypeClass = Integer.class)
    })
    public Result upStandardProducts(@RequestBody Map<String, Object> product) {
        return Result.success(standardTreeService.upStandardProducts(product));
    }
    @PostMapping("/getStandTreeBySampleType")
    @ApiOperation("仅获取光纤的型号")
    public Result<?> getStandTreeBySampleType(String laboratory, String sampleType) {
        return Result.success(standardTreeService.getStandTreeBySampleType(laboratory, sampleType));
    }
    @ApiOperation("导入标准库")
    @PostMapping("/inExcelOfTree/{isEquipment}")
    public Result inExcelOfTree(@RequestParam("file") MultipartFile file, @PathVariable("isEquipment") Boolean isEquipment) {
        if (!isEquipment) {
            standardTreeService.inExcelOfTree(file);
        } else {
            standardTreeService.importWorkstationExcel(file);
        }
        return Result.success();
    }
    @ApiOperation("重置标准库单价")
    @PostMapping("/resetTreeOfPrice")
    public Result resetTreeOfPrice(String tree, Integer standardId) {
        standardTreeService.resetTreeOfPrice(tree, standardId);
        return Result.success();
    }
    @ApiOperation("重置标准库工时系数")
    @PostMapping("/resetTreeOfHour")
    public Result resetTreeOfHour(String tree, Integer standardId) {
        standardTreeService.resetTreeOfHour(tree, standardId);
        return Result.success();
    }
    @ApiOperation("重置标准库要求描述和要求值")
    @PostMapping("/resetTreeOfAsk")
    public Result resetTreeOfAsk(String tree, Integer standardId) {
        standardTreeService.resetTreeOfAsk(tree, standardId);
        return Result.success();
    }
    @ApiOperation("标准库拖拽")
    @PostMapping("/resetTreeDrag")
    public Result resetTreeDrag(@RequestBody ResetTreeDragDTO resetTreeDragDTO) {
        standardProductListService.resetTreeDrag(resetTreeDragDTO);
        return Result.success();
    }
    @ApiOperation("标准库拖拽全部")
    @PostMapping("/resetTreeDragBatch")
    public Result resetTreeDragBatch(@RequestBody Map<String, Object> params) {
        List<StandardProductList> standardProductLists = (List<StandardProductList>) params.get("params");
        standardProductListService.resetTreeDragBatch(standardProductLists);
        return Result.success();
    }
    @ApiOperation(value = "标准树排序")
    @PostMapping("/updateTreeSort")
    public Result updateTreeSort(@RequestBody List<FactoryDto> list) {
        return Result.success(standardTreeService.updateTreeSort(list));
    }
    /*************************************************** åŽ‚å®¶ç‰¹æ®Šè¦æ±‚å€¼å¤„ç† ************************************************************/
    @ApiOperation(value = "根据产品id查询厂家要求值绑定")
    @PostMapping("/selectSupplierAsk")
    public Result selectSupplierAsk(StandardProductListSupplierAsk supplierAsk) throws Exception {
        return Result.success(standardProductListSupplierAskService.selectByProductId(supplierAsk));
    }
    @ApiOperation(value = "新增厂家要求值绑定")
    @PostMapping("/addProductSupplierAsk")
    public Result addProductSupplierAsk(String str) {
        StandardProductListSupplierAsk supplierAsk = JSON.parseObject(str, StandardProductListSupplierAsk.class);
        return Result.success(standardProductListSupplierAskService.addProductSupplierAsk(supplierAsk));
    }
    @ApiOperation(value = "更新厂家要求值绑定")
    @PostMapping("/updateProductSupplierAsk")
    public Result updateProductSupplierAsk(String str) {
        StandardProductListSupplierAsk supplierAsk = JSON.parseObject(str, StandardProductListSupplierAsk.class);
        standardProductListSupplierAskService.updateProductSupplierAsk(supplierAsk);
        return Result.success();
    }
    @ApiOperation(value = "删除厂家要求值绑定")
    @PostMapping("/deleteProductSupplierAsk")
    public Result deleteProductSupplierAsk(Integer supplierAskId) {
        standardProductListSupplierAskService.removeById(supplierAskId);
        return Result.success();
    }
    @ApiOperation(value = "修改标准树")
    @PostMapping("/updateStandardTree")
    public Result updateStandardTree(@RequestBody StandardTree standardTree) {
        return Result.success(standardTreeService.updateStandardTree(standardTree));
    }
    @ApiOperation(value = "检验项要求值复制对比")
    @PostMapping("/copyStandardProductList")
    public Result copyStandardProductList(@RequestBody CopyStandardProductListDto copyStandardProductListDto) {
        return Result.success(standardProductListService.copyStandardProductList(copyStandardProductListDto));
    }
    @ApiOperation(value = "检验项要求值单独对比")
    @PostMapping("/copyStandardProductOne")
    public Result copyStandardProductOne(@RequestBody CopyStandardProductListDto copyStandardProductListDto) {
        return Result.success(standardProductListService.copyStandardProductOne(copyStandardProductListDto));
    }
    @ApiOperation(value = "检验项批量修改要求值要求描述")
    @PostMapping("/updateStandardProductListBatch")
    public Result updateStandardProductListBatch(@RequestBody Map<String, Object> param) {
        List<StandardProductList> standardProductList = (List<StandardProductList>) param.get("standardProductList");
        return Result.success(standardProductListService.updateBatchById(standardProductList));
    }
    @ApiOperation(value = "检验项复制排序")
    @PostMapping("/copyStandardProductSort")
    public Result copyStandardProductSort(@RequestBody CopyStandardProductListDto copyStandardProductListDto) {
        return Result.success(standardProductListService.copyStandardProductSort(copyStandardProductListDto));
    }
}
basic-server/src/main/java/com/ruoyi/basic/controller/StructureTestObjectPartController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,59 @@
package com.ruoyi.basic.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.common.core.domain.Result;
import com.ruoyi.basic.pojo.StructureTestObjectPart;
import com.ruoyi.basic.service.StructureTestObjectPartService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
 * æ£€éªŒå¯¹è±¡é›¶ä»¶è¡¨
 *
 * @author zhuo
 * @since 2024-08-07
 */
@RestController
@RequestMapping("/structureTestObjectPart")
@AllArgsConstructor
@Api(tags = "检验对象零件表")
public class StructureTestObjectPartController {
    private StructureTestObjectPartService structureTestObjectPartService;
    @ApiOperation(value = "根据检验对象id查询零件")
    @PostMapping("/selectByTestObjectId")
    public Result selectByTestObjectId(Page page,StructureTestObjectPart structureTestObjectPart){
        return Result.success(structureTestObjectPartService.selectByTestObjectId(page,structureTestObjectPart));
    }
    @ApiOperation(value = "新增检验对象零件")
    @PostMapping("/addTestObjectPart")
    public Result addTestObjectPart(@RequestBody StructureTestObjectPart structureTestObjectPart) {
        structureTestObjectPartService.addTestObjectPart(structureTestObjectPart);
        return Result.success();
    }
    @ApiOperation(value = "更新检验对象零件")
    @PostMapping("/updateTestObjectPart")
    public Result updateTestObjectPart(@RequestBody StructureTestObjectPart structureTestObjectPart) {
        structureTestObjectPartService.updateTestObjectPart(structureTestObjectPart);
        return Result.success();
    }
    @ApiOperation(value = "删除检验对象零件")
    @PostMapping("/deleteTestObjectPart")
    public Result deleteTestObjectPart(Integer id) {
        structureTestObjectPartService.removeById(id);
        return Result.success();
    }
}
basic-server/src/main/java/com/ruoyi/basic/dto/CopyStandardProductListDto.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,23 @@
package com.ruoyi.basic.dto;
import com.ruoyi.basic.pojo.StandardProductList;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
 * æ ‡å‡†æ£€éªŒé¡¹å¤åˆ¶
 *
 * @Author zhuo
 * @Date 2024/10/31
 */
@Data
public class CopyStandardProductListDto {
    @ApiModelProperty("原本检验项信息")
    private List<StandardProductList> oldStandardProductList;
    @ApiModelProperty("需要对比的检验项信息")
    private List<StandardProductList> newStandardProductList;
}
basic-server/src/main/java/com/ruoyi/basic/dto/FactoryDto.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,18 @@
package com.ruoyi.basic.dto;
import lombok.Data;
import java.util.List;
@Data
public class FactoryDto {
    private String code = "[1]";
    private String label;
    private String value;
    private List<LaboratoryDto> children;
}
basic-server/src/main/java/com/ruoyi/basic/dto/IfsInventoryQuantityCheckDto.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,182 @@
package com.ruoyi.basic.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
 * åŽŸææ–™æŸ¥è¯¢, æŽ’除了供应商
 * @Author zhuo
 * @Date 2024/8/28
 */
@Data
public class IfsInventoryQuantityCheckDto  implements Serializable {
    private Integer id;
    @ApiModelProperty("域")
    private String contract;
    @ApiModelProperty("订单号")
    private String orderNo;
    @ApiModelProperty("行号")
    private String lineNo;
    @ApiModelProperty("下达号")
    private String releaseNo;
    @ApiModelProperty("接收号")
    private Integer receiptNo;
    @ApiModelProperty("零件号")
    private String partNo;
    @ApiModelProperty("零件描述")
    private String partDesc;
    @ApiModelProperty("状态描述")
    private String status;
    @ApiModelProperty("状态")
    private String statusDb;
    @ApiModelProperty("抵达的采购数量")
    private BigDecimal qtyArrived;
    @ApiModelProperty("已检验的购买数量")
    private BigDecimal qtyInspected;
    @ApiModelProperty("要检验的采购数量")
    private BigDecimal qtyToInspect;
    @ApiModelProperty("抵达的库存数量")
    private BigDecimal invQtyInStore;
    @ApiModelProperty("抵达的采购数量")
    private BigDecimal purQtyInStore;
    @ApiModelProperty("配置标识")
    private String configurationId;
    @ApiModelProperty("批号")
    private String lotBatchNo;
    @ApiModelProperty("wdr号")
    private String waivDevRejNo;
    @ApiModelProperty("活动序列")
    private Integer activitySeq;
    @ApiModelProperty("序列号")
    private String serialNo;
    @ApiModelProperty("库位号")
    private String locationNo;
    @ApiModelProperty("版本号")
    private String engChgLevel;
    @ApiModelProperty("接收人")
    private String receiver;
    @ApiModelProperty("接收人姓名")
    private String receiverName;
    @ApiModelProperty("采购员")
    private String buyerCode;
    @ApiModelProperty("采购员姓名")
    private String buyerName;
    @ApiModelProperty("实际到货日期")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private LocalDateTime arriveDate;
    @ApiModelProperty("实际交货日期")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private LocalDateTime deliveryDate;
    @ApiModelProperty("生产日期")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private LocalDateTime productDate;
    @ApiModelProperty("失效日期")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private LocalDateTime invalidDate;
    @ApiModelProperty("审批日期")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private LocalDateTime approvedDate;
    @ApiModelProperty("采购申请创建人")
    private String reqCeater;
    @ApiModelProperty("采购申请创建人姓名")
    private String reqCeaterName;
    @ApiModelProperty("采购订单行备注")
    private String lineRemarks;
    @ApiModelProperty("单位")
    private String buyUnitMeas;
    private Integer isSource;
    private Integer number;
    private Integer state;
    @ApiModelProperty("接收时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private LocalDateTime receiverDate;
    @ApiModelProperty("是否为首次出现 0 å¦ 1 æ˜¯")
    private Integer isFirst;
    @ApiModelProperty("目标库位号")
    private String toLocation;
    @ApiModelProperty("是否是报检 0 å¦ 1 æ˜¯")
    private Integer isInspect;
    @ApiModelProperty("报检人")
    private String declareUser;
    @ApiModelProperty("报检人id")
    private Integer declareUserId;
    @ApiModelProperty("单位")
    private String partUnit;
    @ApiModelProperty("产业链检测数据")
    private String industryChain;
    @ApiModelProperty("报检时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private LocalDateTime declareDate;
    @ApiModelProperty("是否卡可以季度检验 0 å¦ 1 æ˜¯")
    private Integer isQuarter;
    // ä¿®æ”¹åŽçš„
    @ApiModelProperty("批号")
    private String updateBatchNo;
    @ApiModelProperty("是否是铜单丝, 0否, 1是")
    private Integer isCopper;
    @ApiModelProperty("物料类型")
    private Integer isExpire;
}
basic-server/src/main/java/com/ruoyi/basic/dto/IfsInventoryQuantityDto.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,82 @@
package com.ruoyi.basic.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDateTime;
@Data
public class IfsInventoryQuantityDto extends IfsInventoryQuantityCheckDto {
    /**
     * å§”托编号
     */
    @ApiModelProperty("委托编号")
    private String entrustCode;
    @ApiModelProperty("检验对象")
    private String sampleType;
    @ApiModelProperty("样品名称")
    private String sampleName;
    @ApiModelProperty("样品型号")
    private String sampleModel;
    @ApiModelProperty("样品编号")
    private String sampleCode;
    // è¿›åŽ‚
    @ApiModelProperty("订单id")
    private Integer enterOrderId;
    @ApiModelProperty("报告id")
    private String enterReportId;
    @ApiModelProperty("系统生成报告地址")
    private String enterUrl;
    @ApiModelProperty("手动上传报告地址")
    private String enterUrlS;
    // å­£åº¦
    @ApiModelProperty("订单id")
    private Integer quarterOrderId;
    @ApiModelProperty("报告id")
    private String quarterReportId;
    @ApiModelProperty("系统生成报告地址")
    private String quarterUrl;
    @ApiModelProperty("手动上传报告地址")
    private String quarterUrlS;
    private Integer orderState;
    @ApiModelProperty("下发时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime sendTime;
    @ApiModelProperty("材料厂家")
    private String supplierName;
    @ApiModelProperty("委托人")
    private String prepareUser;
    @ApiModelProperty("颜色")
    private String color;
    @ApiModelProperty("标签状态")
    private String labelStatus;
    @ApiModelProperty("标签条形码")
    private String labelBarCode;
    @ApiModelProperty("创建人")
    private Integer createUser;
    @ApiModelProperty("检验人")
    private String userName;
}
basic-server/src/main/java/com/ruoyi/basic/dto/IfsInventoryQuantitySupplierDto.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,124 @@
package com.ruoyi.basic.dto;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.basic.pojo.IfsInventoryQuantity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDateTime;
/**
 * èƒ½æŸ¥è¯¢åˆ°ä¾›åº”商
 */
@Data
@ExcelIgnoreUnannotated
public class IfsInventoryQuantitySupplierDto extends IfsInventoryQuantity {
    /**
     * å§”托编号
     */
    @ExcelProperty(index = 2, value = "委托编号")
    @ApiModelProperty("委托编号")
    private String entrustCode;
    @ApiModelProperty("样品id")
    private Integer sampleId;
    @ApiModelProperty("检验对象")
    private String sampleType;
    @ExcelProperty(index = 7, value = "样品名称")
    @ApiModelProperty("样品名称")
    private String sampleName;
    @ExcelProperty(index = 8, value = "样品型号")
    @ApiModelProperty("样品型号")
    private String sampleModel;
    @ApiModelProperty("样品编号")
    private String sampleCode;
    // è¿›åŽ‚
    @ApiModelProperty("进厂订单id")
    private Integer enterOrderId;
    @ApiModelProperty("报告id")
    private String enterReportId;
    @ApiModelProperty("系统生成报告地址")
    private String enterUrl;
    @ApiModelProperty("手动上传报告地址")
    private String enterUrlS;
    // å­£åº¦
    @ApiModelProperty("季度订单id")
    private Integer quarterOrderId;
    @ApiModelProperty("报告id")
    private String quarterReportId;
    @ApiModelProperty("系统生成报告地址")
    private String quarterUrl;
    @ApiModelProperty("手动上传报告地址")
    private String quarterUrlS;
    private Integer orderState;
    @ApiModelProperty("下发时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime sendTime;
    @ApiModelProperty("委托人")
    private String prepareUser;
    @ApiModelProperty("颜色")
    private String color;
    @ApiModelProperty("标签状态")
    private String labelStatus;
    @ApiModelProperty("标签条形码")
    private String labelBarCode;
    @ApiModelProperty("创建人")
    private Integer createUser;
    @ExcelProperty(index = 9, value = "检验人")
    @ApiModelProperty("检验人")
    private String userName;
    @ExcelProperty(index = 10, value = "下发时间")
    private String sendTimeString;
    @ExcelProperty(index = 14, value = "接收时间")
    private String receiverDateString;
    @ExcelProperty(index = 15, value = "报检时间")
    private String declareDateString;
    // åˆæ ¼çŠ¶æ€,: 0 æ£€éªŒä¸­, 1合格, 2不合格, 3未下单,4让步放行
    @ExcelProperty(index = 6, value = "检验状态")
    private String inspectStatusString;
    @ApiModelProperty("报检开始时间")
    private String beginDeclareDate;
    @ApiModelProperty("报检结束时间")
    private String endDeclareDate;
    @ApiModelProperty("不合格描述")
    @ExcelProperty(index = 16, value = "不合格描述")
    private String unqualifiedDesc;
    @ApiModelProperty("不合格项")
    @ExcelProperty(index = 17, value = "不合格项")
    private String unqualifiedItem;
    @ApiModelProperty("免检")
    private Integer isExemption;
}
basic-server/src/main/java/com/ruoyi/basic/dto/InsSampleReceiveDto.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,35 @@
package com.ruoyi.basic.dto;
import com.ruoyi.basic.pojo.InsSample1;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
 * @Author zhuo
 * @Date 2024/10/29
 */
@Data
public class InsSampleReceiveDto extends InsSample1 {
    @ApiModelProperty("零件号")
    private String partNo;
    @ApiModelProperty("原材料id")
    private Integer ifsInventoryId;
    @ApiModelProperty("芯数")
    private String cores;
    @ApiModelProperty("型号参数")
    private String modelNum;
    @ApiModelProperty("导体材质")
    private String conductorMaterial;
    @ApiModelProperty("导体类型")
    private String conductorType;
    @ApiModelProperty("是否是电缆配置")
    private String isCableTag;
}
basic-server/src/main/java/com/ruoyi/basic/dto/LaboratoryDto.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,18 @@
package com.ruoyi.basic.dto;
import lombok.Data;
import java.util.List;
@Data
public class LaboratoryDto {
    private String code = "[2]";
    private String label;
    private String value;
    private List<SampleTypeDto> children;
}
basic-server/src/main/java/com/ruoyi/basic/dto/ModelDto.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,15 @@
package com.ruoyi.basic.dto;
import lombok.Data;
@Data
public class ModelDto {
    private String code = "[5]";
    private String label;
    private String value;
}
basic-server/src/main/java/com/ruoyi/basic/dto/PageTestObjectDto.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,25 @@
package com.ruoyi.basic.dto;
import com.ruoyi.basic.pojo.StructureTestObject;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
 * @Author æˆ´å“
 * @Date 2024/2/26
 */
@Data
public class PageTestObjectDto extends StructureTestObject {
    @ApiModelProperty(value = "产品")
    private String product;
    @ApiModelProperty(value = "创建人")
    private String createUserName;
    @ApiModelProperty(value = "更新人")
    private String updateUserName;
    @ApiModelProperty(value = "零件号")
    private String partNo;
}
basic-server/src/main/java/com/ruoyi/basic/dto/ProductDTO1.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,16 @@
package com.ruoyi.basic.dto;
import com.ruoyi.basic.pojo.Product;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
 * @Author zhuo
 * @Date 2024/8/5
 */
@Data
public class ProductDTO1 extends Product {
    @ApiModelProperty(value = "零件号")
    private String partNo;
}
basic-server/src/main/java/com/ruoyi/basic/dto/ProductDto.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,11 @@
package com.ruoyi.basic.dto;
import lombok.Data;
@Data
public class ProductDto {
    private Integer id;
    private String name;
}
basic-server/src/main/java/com/ruoyi/basic/dto/ResetTreeDragDTO.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,26 @@
package com.ruoyi.basic.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
 * @Author zhuo
 * @Date 2024/8/22
 */
@Data
public class ResetTreeDragDTO {
    @ApiModelProperty(value = "开始索引")
    private String beginIndex;
    @ApiModelProperty(value = "结束索引")
    private String endIndex;
    @ApiModelProperty(value = "标准编号id")
    private String methodId;
    @ApiModelProperty(value = "数")
    private String tree;
    @ApiModelProperty(value = "检验项行id")
    private String productionId;
}
basic-server/src/main/java/com/ruoyi/basic/dto/SampleDto.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,23 @@
package com.ruoyi.basic.dto;
import lombok.Data;
import java.util.List;
@Data
public class SampleDto {
    private String code = "[4]";
    private String label;
    private String value;
    private String partNo;
    // æ ·å“è‹±æ–‡
    private String sampleEn;
    private List<ModelDto> children;
}
basic-server/src/main/java/com/ruoyi/basic/dto/SampleTypeDto.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,29 @@
package com.ruoyi.basic.dto;
import lombok.Data;
import java.util.List;
@Data
public class SampleTypeDto {
    private String code = "[3]";
    // æ£€æµ‹å¯¹è±¡id
    private Integer sampleTypeId;
    // æ£€æµ‹å¯¹è±¡æŽ’序
    private Integer sort;
    private String label;
    private String value;
    private String partNo;
    // å¯¹è±¡è‹±æ–‡
    private String sampleTypeEn;
    private List<SampleDto> children;
}
basic-server/src/main/java/com/ruoyi/basic/dto/TestItemDto.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,16 @@
package com.ruoyi.basic.dto;
import lombok.Data;
import java.util.List;
@Data
public class TestItemDto {
    private Integer id;
    private String name;
    private List<ProductDto> children;
}
basic-server/src/main/java/com/ruoyi/basic/excel/StructureTestObjectData.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,25 @@
package com.ruoyi.basic.excel;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
@Data
public class StructureTestObjectData {
    @ExcelProperty(value = "场所")
    private String laboratory;
    @ExcelProperty(value = "检测对象")
    private String specimenName;
    @ExcelProperty(value = "检测对象(EN)")
    private String specimenNameEn;
    @ExcelProperty(value = "对象代号")
    private String code;
    @ExcelProperty(value = "产品名称")
    private String name;
    @ExcelProperty(value = "产品名称(EN)")
    private String nameEn;
}
basic-server/src/main/java/com/ruoyi/basic/excel/StructureTestObjectListener.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,38 @@
package com.ruoyi.basic.excel;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.ruoyi.basic.service.ProductService;
import java.util.ArrayList;
import java.util.List;
public class StructureTestObjectListener extends AnalysisEventListener<StructureTestObjectData> {
    private static final int BATCH_COUNT = 1000;
    List<StructureTestObjectData> list = new ArrayList<>();
    private ProductService productService;
    public StructureTestObjectListener(ProductService productService) {
        this.productService = productService;
    }
    @Override
    public void invoke(StructureTestObjectData data, AnalysisContext analysisContext) {
        list.add(data);
        if (list.size() >= BATCH_COUNT) {
            save();
            list.clear();
        }
    }
    @Override
    public void doAfterAllAnalysed(AnalysisContext analysisContext) {
        save();
    }
    private void save() {
        productService.importPartExcel(list);
    }
}
basic-server/src/main/java/com/ruoyi/basic/mapper/CertificationMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,14 @@
package com.ruoyi.basic.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.basic.pojo.Certification;
import org.apache.ibatis.annotations.Param;
public interface CertificationMapper extends BaseMapper<Certification> {
    //查询资质明细列表
    IPage<Certification> getCertificationDetail(Page page, @Param("ew") QueryWrapper<Certification> ew);
}
basic-server/src/main/java/com/ruoyi/basic/mapper/IfsInventoryQuantityMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,42 @@
package com.ruoyi.basic.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.basic.dto.IfsInventoryQuantityDto;
import com.ruoyi.basic.pojo.IfsInventoryQuantity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.time.LocalDateTime;
import java.util.List;
@Mapper
public interface IfsInventoryQuantityMapper extends BaseMapper<IfsInventoryQuantity> {
    /**
     * æ‰“印标签查询
     * @param ids
     * @return
     */
    List<IfsInventoryQuantityDto> printLabel(@Param("ids") List<Integer> ids);
    /**
     *
     * @param ifsInventoryId
     * @return
     */
    int selectReportCountById(@Param("ifsInventoryId") Integer ifsInventoryId);
    /**
     * æŸ¥è¯¢å½“前季度是否出现过该材料
     * @param partDetail         åž‹å·
     * @param supplierName       ä¾›åº”商名称
     * @param startOfNextQuarter å­£åº¦å¼€å§‹æ—¶é—´
     * @param endOfQuarter       å­£åº¦ç»“束时间
     * @return
     */
    Integer selectIsFirst(@Param("partDetail") String partDetail,
                          @Param("supplierName") String supplierName,
                          @Param("startOfNextQuarter") LocalDateTime startOfNextQuarter,
                          @Param("endOfQuarter") LocalDateTime endOfQuarter);
}
basic-server/src/main/java/com/ruoyi/basic/mapper/LaboratoryMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,20 @@
package com.ruoyi.basic.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.basic.pojo.Laboratory;
import org.apache.ibatis.annotations.Param;
/**
 * å®žéªŒå®¤ç®¡ç†(Laboratory)表数据库访问层
 */
public interface LaboratoryMapper extends BaseMapper<Laboratory> {
    IPage<Laboratory> selectItemParameter(Page page, @Param("ew") QueryWrapper<Laboratory> ew);
    Object obtainItemParameterList(@Param("page") Page page, @Param("ew") QueryWrapper<Laboratory> ew);
}
basic-server/src/main/java/com/ruoyi/basic/mapper/ProductMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,24 @@
package com.ruoyi.basic.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.basic.dto.ProductDTO1;
import com.ruoyi.basic.pojo.Product;
import org.apache.ibatis.annotations.Param;
/**
* @author z1292
* @description é’ˆå¯¹è¡¨ã€product(产品表)】的数据库操作Mapper
* @createDate 2024-04-26 01:11:02
* @Entity com.ruoyi.basic.pojo.Product
*/
public interface ProductMapper extends BaseMapper<Product> {
    IPage<Product> selectProductListByObjectId(Page page, @Param("ew") QueryWrapper<ProductDTO1> ew, @Param("partNo") String partNo);
}
basic-server/src/main/java/com/ruoyi/basic/mapper/ProductPartMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,13 @@
package com.ruoyi.basic.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.ruoyi.basic.pojo.ProductPart;
import org.apache.ibatis.annotations.Param;
public interface ProductPartMapper extends BaseMapper<ProductPart> {
    IPage<ProductPart> selectListByProductId(IPage<ProductPart> page,
                                              @Param("ew") QueryWrapper<ProductPart> ew,
                                              @Param("productId") Integer productId);
}
basic-server/src/main/java/com/ruoyi/basic/mapper/ProductSupplierDensityMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,22 @@
package com.ruoyi.basic.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.basic.pojo.ProductSupplierDensity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
 * äº§å“åŽ‚å®¶å¯†åº¦ç»‘å®šè¡¨
 *
 * @author zhuo
 * @since 2024-09-19
 */
@Mapper
public interface ProductSupplierDensityMapper extends BaseMapper<ProductSupplierDensity> {
    IPage<ProductSupplierDensity> selectListByProductId(@Param("page") Page page, @Param("ew") QueryWrapper<ProductSupplierDensity> ew, @Param("productId") Integer productId);
}
basic-server/src/main/java/com/ruoyi/basic/mapper/StandardMethodListMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,40 @@
package com.ruoyi.basic.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.basic.pojo.StandardMethodList;
import com.ruoyi.basic.pojo.StandardProductList;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* @author Administrator
* @description é’ˆå¯¹è¡¨ã€standard_method_list(标准树下的标准列表)】的数据库操作Mapper
* @createDate 2024-03-04 13:44:04
* @Entity com.ruoyi.basic.pojo.StandardMethodList
*/
public interface StandardMethodListMapper extends BaseMapper<StandardMethodList> {
    Map<String, String> selectStandardMethodById(Integer id);
    String selectUserById(Integer id);
    List<StandardMethodList> selectStandardMethodLists(String tree);
    List<StandardMethodList> selectStandardMethodListsByNull(String tree);
    List<StandardMethodList> selectStandardMethodLists3(String tree);
    List<StandardMethodList> selectStandardMethodLists2(@Param("data1") String data1, @Param("data2") String data2, @Param("data3") String data3, @Param("data4") String data4, @Param("data5") String data5);
    List<StandardProductList> selectParameterList(String code);
    List<StandardMethodList> selectListEnum();
    Integer getStandardMethodId(String code);
}
basic-server/src/main/java/com/ruoyi/basic/mapper/StandardMethodMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,26 @@
package com.ruoyi.basic.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.framework.mybatis_config.MyBaseMapper;
import com.ruoyi.basic.pojo.StandardMethod;
import org.apache.ibatis.annotations.Param;
/**
* @author Administrator
* @description é’ˆå¯¹è¡¨ã€standard_method(标准方法)】的数据库操作Mapper
* @createDate 2024-03-03 19:21:41
* @Entity com.ruoyi.basic.pojo.StandardMethod
*/
public interface StandardMethodMapper extends MyBaseMapper<StandardMethod> {
    IPage<StandardMethod> selectStandardMethodList(Page page, @Param("ew") QueryWrapper<StandardMethod> ew);
    StandardMethod selectStandMethodById(Integer id);
}
basic-server/src/main/java/com/ruoyi/basic/mapper/StandardProductListMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,69 @@
package com.ruoyi.basic.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.ruoyi.basic.pojo.StandardProductList;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* @author Administrator
* @description é’ˆå¯¹è¡¨ã€standard_product_list(标准树下的检验项目)】的数据库操作Mapper
* @createDate 2024-03-05 10:33:29
* @Entity com.ruoyi.basic.pojo.StandardProductList
*/
public interface StandardProductListMapper extends BaseMapper<StandardProductList> {
    IPage<StandardProductList> standardProductListIPage(@Param("id") Integer id, @Param("tree") String tree, IPage<StandardProductList> page, @Param("laboratory") String laboratory, @Param("insItem") String insItem, @Param("insItems") String insItems);
    StandardProductList getOne(@Param("standardMethodListId") Integer standardMethodListId, @Param("inspectionItem") String inspectionItem, @Param("sample") String sample, @Param("inspectionItemSubclass") String inspectionItemSubclass, @Param("model") String model, @Param("inspectionItemClass") String inspectionItemClass);
    List<StandardProductList> selectDetail(@Param("standardMethodListId") Integer standardMethodListId, @Param("state") int state, @Param("model") String model, @Param("isCableTag") String isCableTag);
    List<StandardProductList> selectDetail2(@Param("standardMethodListId") Integer standardMethodListId, @Param("state") int state, @Param("tree") String tree, @Param("isCableTag") String isCableTag);
    /**
     * æŸ¥è¯¢é›¶ä»¶é¢œè‰²
     * @param partNo
     * @return
     */
    Map<String, String> selectPartColor(@Param("partNo") String partNo);
    /**
     * åŒºé—´ä¿®æ”¹
     * @param productList
     * @return
     */
    void updateSection(@Param("productList") StandardProductList productList);
    /**
     * ä»Žä¸Šå¾€ä¸‹ä¿®æ”¹é¡ºåº
     * @param beginIndex å¼€å§‹ä½ç½®
     * @param endIndex ç»“束位置
     * @param methodId æ ‡å‡†id
     * @param tree æ ‘
     */
    void updateSortUp(@Param("beginIndex") Integer beginIndex,
                      @Param("endIndex") Integer endIndex,
                      @Param("methodId") Integer methodId,
                      @Param("tree") String tree);
    /**
     * ä»Žä¸‹ç½‘上修改顺序
     * @param beginIndex
     * @param endIndex
     * @param methodId
     * @param tree
     */
    void updateSortDown(@Param("beginIndex") Integer beginIndex,
                        @Param("endIndex") Integer endIndex,
                        @Param("methodId") Integer methodId,
                        @Param("tree") String tree);
}
basic-server/src/main/java/com/ruoyi/basic/mapper/StandardProductListSupplierAskMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,18 @@
package com.ruoyi.basic.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.basic.pojo.StandardProductListSupplierAsk;
import org.apache.ibatis.annotations.Mapper;
/**
 * æ£€éªŒé¡¹ç›®åŽ‚å®¶å¯†åº¦ç»‘å®šè¡¨
 *
 * @author zhuo
 * @since 2024-09-23
 */
@Mapper
public interface StandardProductListSupplierAskMapper extends BaseMapper<StandardProductListSupplierAsk> {
}
basic-server/src/main/java/com/ruoyi/basic/mapper/StandardTemplateMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,32 @@
package com.ruoyi.basic.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.basic.pojo.StandardTemplate;
import org.apache.ibatis.annotations.Param;
/**
* @author Administrator
* @description é’ˆå¯¹è¡¨ã€standard_template(标准模板)】的数据库操作Mapper
* @createDate 2024-03-11 13:47:52
* @Entity com.ruoyi.basic.pojo.StandardTemplate
*/
public interface StandardTemplateMapper extends BaseMapper<StandardTemplate> {
    IPage<StandardTemplate> selectStandardTemplatePageList(Page page, @Param("ew") QueryWrapper<StandardTemplate> ew);
    StandardTemplate getStandTempIdByName(String name);
    /**
     * æŸ¥è¯¢åŽ‹ç¼©åŽçš„æ•°æ®
     * @param templateId
     * @return
     */
    String selectCompressThing(Integer templateId);
}
basic-server/src/main/java/com/ruoyi/basic/mapper/StandardTreeMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,92 @@
package com.ruoyi.basic.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.basic.dto.*;
import com.ruoyi.basic.pojo.IfsInventoryQuantity;
import com.ruoyi.basic.pojo.StandardMethodList;
import com.ruoyi.basic.pojo.StandardProductList;
import com.ruoyi.basic.pojo.StandardTree;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
 * @author Administrator
 * @description é’ˆå¯¹è¡¨ã€standard_tree(标准树)】的数据库操作Mapper
 * @createDate 2024-03-01 15:06:44
 * @Entity com.ruoyi.basic.pojo.StandardTree
 */
public interface StandardTreeMapper extends BaseMapper<StandardTree> {
    List<FactoryDto> selectStandardTreeList();
    List<StandardTree> selectStandardTreeList2(String sampleType);
    StandardProductList selectStandardProductById(Integer id);
    List<StandardProductList> getStandardProductListBySample(String sampleType);
    List<StandardMethodList> getStandardMethodListBySample(String sampleType);
    List<StandardProductList> selectStandardProductListByTree(String tree, String sample, String model, String trees, String laboratory);
    List<StandardProductList> selectStandardProductListByTree2(String tree, String sample, String model, String trees, String laboratory);
    List<SampleTypeDto> getStandardTree2();
    List<SampleDto> getStandardTree3(String sampleType);
    String getLaboratory(String str);
    Integer getStructureItemParameterId(String sampleType, String item, String itemChild, String inspectionItemClass);
    List<ProductDto> selectPList(String name);
    String selSample(String sample);
    List<FactoryDto> selectStandardTreeListByPartNo(@Param("partNo") String partNo);
    IPage<IfsInventoryQuantity> selectIfsPage(IPage<IfsInventoryQuantity> page,
                                              @Param("ew") QueryWrapper<IfsInventoryQuantity> ew);
    IPage<IfsInventoryQuantityDto> getIfsByStateOne(IPage<IfsInventoryQuantityDto> page,
                                                    @Param("ew") QueryWrapper<IfsInventoryQuantityDto> ew);
    IPage<IfsInventoryQuantityCheckDto> selectIfsInventoryQuantity(Page<IfsInventoryQuantityCheckDto> page, @Param("ew")QueryWrapper<IfsInventoryQuantityCheckDto> ew);
    /**
     * åŽŸææŠ¥æ£€æŸ¥è¯¢å…¨éƒ¨(分页)
     * @param page
     * @param ew
     * @return
     */
    IPage<IfsInventoryQuantitySupplierDto> getIfsByOver(Page<IfsInventoryQuantitySupplierDto> page, @Param("ew") QueryWrapper<IfsInventoryQuantitySupplierDto> ew, @Param("beginDeclareDate") String beginDeclareDate, @Param("endDeclareDate")String endDeclareDate);
    /**
     * åŽŸææŠ¥æ£€æŸ¥è¯¢å…¨éƒ¨(无分页)
     * @param ew
     * @return
     */
    List<IfsInventoryQuantitySupplierDto> getIfsByOverList(@Param("ew") QueryWrapper<IfsInventoryQuantitySupplierDto> ew, @Param("beginDeclareDate") String beginDeclareDate, @Param("endDeclareDate")String endDeclareDate);
    /**
     * åŽŸææ–™æŸ¥è¯¢å­£åº¦æ£€éªŒ
     * @param page
     * @param
     * @param beginDeclareDate
     * @param endDeclareDate
     * @return
     */
    IPage<IfsInventoryQuantitySupplierDto> getIfsByQuarter(Page<IfsInventoryQuantitySupplierDto> page, @Param("ew") QueryWrapper<IfsInventoryQuantitySupplierDto> ew, @Param("beginDeclareDate") String beginDeclareDate, @Param("endDeclareDate")String endDeclareDate);
}
basic-server/src/main/java/com/ruoyi/basic/mapper/StructureItemParameterMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,30 @@
package com.ruoyi.basic.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.basic.dto.TestItemDto;
import com.ruoyi.basic.pojo.StructureItemParameter;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
 * æ£€éªŒé¡¹ç›®å‚æ•°(StructureItemParameter)表数据库访问层
 *
 * @author makejava
 * @since 2024-02-26 16:21:17
 */
public interface StructureItemParameterMapper extends BaseMapper<StructureItemParameter> {
    IPage<StructureItemParameter> selectItemParameterList(Page page, @Param("ew") QueryWrapper<StructureItemParameter> ew);
    List<Map<String, Object>> getInsProduction();
    List<TestItemDto> getItemTree();
    int removeNoSample(@Param("sample") String sample);
}
basic-server/src/main/java/com/ruoyi/basic/mapper/StructureTestObjectMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,22 @@
package com.ruoyi.basic.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.basic.dto.PageTestObjectDto;
import com.ruoyi.basic.pojo.StructureTestObject;
import org.apache.ibatis.annotations.Param;
/**
 * æ£€æµ‹å¯¹è±¡(StructureTestObject)表数据库访问层
 *
 * @author makejava
 * @since 2024-02-26 17:36:41
 */
public interface StructureTestObjectMapper extends BaseMapper<StructureTestObject> {
    IPage<PageTestObjectDto> selectTestObjectList(Page page, @Param("ew") QueryWrapper<PageTestObjectDto> ew, @Param("partNo") String partNo);
}
basic-server/src/main/java/com/ruoyi/basic/mapper/StructureTestObjectPartMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,21 @@
package com.ruoyi.basic.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.basic.pojo.StructureTestObjectPart;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
 * æ£€éªŒå¯¹è±¡é›¶ä»¶è¡¨
 *
 * @author zhuo
 * @since 2024-08-07
 */
@Mapper
public interface StructureTestObjectPartMapper extends BaseMapper<StructureTestObjectPart> {
    IPage<StructureTestObjectPart> selectListByTestObjectId(Page page, @Param("ew") QueryWrapper<StructureTestObjectPart> structureTestObjectPartQueryWrapper, @Param("testObjectId") Integer testObjectId);
}
basic-server/src/main/java/com/ruoyi/basic/pojo/Certification.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,72 @@
package com.ruoyi.basic.pojo;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
@TableName(value = "certification")
@Data
public class Certification implements Serializable {
    @ApiModelProperty(value = "主键")
    @TableId(type = IdType.AUTO)
    private Integer id;
    @ApiModelProperty(value = "资质名称")
    private String name;
    @ApiModelProperty(value = "资质编码")
    private String code;
    @ApiModelProperty(value = "颁发机构")
    private String organization;
    @ApiModelProperty(value = "资质说明")
    private String explanation;
    @ApiModelProperty(value = "首次颁发时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime firstIssuanceDate;
    @ApiModelProperty(value = "最近颁发时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime latestIssuanceDate;
    @ApiModelProperty(value = "到期颁发时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime expireTime;
    @ApiModelProperty(value = "颁布日期")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime dateOfIssuance;
    @ApiModelProperty(value = "创建人")
    @TableField(fill = FieldFill.INSERT)
    private Integer createUser;
    @ApiModelProperty(value = "更新人")
    private String createUserName;
    @ApiModelProperty(value = "修改人id")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Integer updateUser;
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;
    @ApiModelProperty(value = "资质图片地址")
    private String imageUrl;
    @ApiModelProperty(value = "资质附件地址")
    private String fileUrl;
}
basic-server/src/main/java/com/ruoyi/basic/pojo/IfsInventoryQuantity.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,210 @@
package com.ruoyi.basic.pojo;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@Data
@TableName("ifs_inventory_quantity")
@ExcelIgnoreUnannotated
public class IfsInventoryQuantity  implements Serializable {
    @TableId(type = IdType.AUTO)
    private Integer id;
    @ApiModelProperty("域")
    private String contract;
    @ExcelProperty(index = 13, value = "订单号")
    @ApiModelProperty("订单号")
    private String orderNo;
    @ApiModelProperty("行号")
    private String lineNo;
    @ApiModelProperty("下达号")
    private String releaseNo;
    @ApiModelProperty("接收号")
    private Integer receiptNo;
    @ExcelProperty(index = 3, value = "零件号")
    @ApiModelProperty("零件号")
    private String partNo;
    @ExcelProperty(index = 4, value = "零件描述")
    @ApiModelProperty("零件描述")
    private String partDesc;
    @ApiModelProperty("状态描述(IFS原本拉取的状态)")
    private String status;
    @ApiModelProperty("状态(IFS原本拉取的状态)")
    private String statusDb;
    @ExcelProperty(index = 11, value = "抵达的采购数量")
    @ApiModelProperty("抵达的采购数量")
    private BigDecimal qtyArrived;
    @ApiModelProperty("已检验的购买数量")
    private BigDecimal qtyInspected;
    @ApiModelProperty("要检验的采购数量")
    private BigDecimal qtyToInspect;
    @ApiModelProperty("供应商编号")
    private String supplierId;
    @ExcelProperty(index = 5, value = "供应商名称")
    @ApiModelProperty("供应商名称")
    private String supplierName;
    @ApiModelProperty("抵达的库存数量")
    private BigDecimal invQtyInStore;
    @ApiModelProperty("抵达的采购数量")
    private BigDecimal purQtyInStore;
    @ApiModelProperty("配置标识")
    private String configurationId;
    @ApiModelProperty("批号")
    private String lotBatchNo;
    @ApiModelProperty("wdr号")
    private String waivDevRejNo;
    @ApiModelProperty("活动序列")
    private Integer activitySeq;
    @ApiModelProperty("序列号")
    private String serialNo;
    @ApiModelProperty("库位号")
    private String locationNo;
    @ApiModelProperty("版本号")
    private String engChgLevel;
    @ApiModelProperty("接收人")
    private String receiver;
    @ApiModelProperty("接收人姓名")
    private String receiverName;
    @ApiModelProperty("采购员")
    private String buyerCode;
    @ApiModelProperty("采购员姓名")
    private String buyerName;
    @ApiModelProperty("实际到货日期")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private LocalDateTime arriveDate;
    @ApiModelProperty("实际交货日期")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private LocalDateTime deliveryDate;
    @ApiModelProperty("生产日期")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private LocalDateTime productDate;
    @ApiModelProperty("失效日期")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private LocalDateTime invalidDate;
    @ApiModelProperty("审批日期")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private LocalDateTime approvedDate;
    @ApiModelProperty("采购申请创建人")
    private String reqCeater;
    @ApiModelProperty("采购申请创建人姓名")
    private String reqCeaterName;
    @ApiModelProperty("采购订单行备注")
    private String lineRemarks;
    @ExcelProperty(index = 12, value = "单位")
    @ApiModelProperty("单位")
    private String buyUnitMeas;
    @ApiModelProperty("是否为ifs拉取,0 å¦, 1是")
    private Integer isSource;
    private Integer number;
    @ApiModelProperty("状态: 0:待报检, 1:待检验, :已审核")
    private Integer state;
    @ApiModelProperty("接收时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private LocalDateTime receiverDate;
    @ApiModelProperty("是否为首次出现 0 å¦ 1 æ˜¯")
    private Integer isFirst;
    @ApiModelProperty("目标库位号")
    private String toLocation;
    @ApiModelProperty("是否是报检 0 å¦ 1 æ˜¯")
    private Integer isInspect;
    @ApiModelProperty("报检人")
    private String declareUser;
    @ApiModelProperty("报检人id")
    private Integer declareUserId;
    @ApiModelProperty("单位")
    private String partUnit;
    @ApiModelProperty("产业链检测数据")
    private String industryChain;
    @ApiModelProperty("报检时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private LocalDateTime declareDate;
    @ApiModelProperty("是否卡可以季度检验 0 å¦ 1 æ˜¯")
    private Integer isQuarter;
    // ä¿®æ”¹åŽçš„
    @ExcelProperty(index = 1, value = "批号")
    @ApiModelProperty("批号")
    private String updateBatchNo;
    @ApiModelProperty("是否结束, 0否, 1是")
    private Integer isFinish;
    @ApiModelProperty("是否是铜单丝, 0否, 1是")
    private Integer isCopper;
    // åˆæ ¼çŠ¶æ€,: 0 æ£€éªŒä¸­, 1合格, 2不合格, 3未下单,4让步放行
    @ApiModelProperty("检验状态")
    private Integer inspectStatus;
    @ApiModelProperty("是否采购订单登记: 0否, 1:是")
    private Integer isRegister;
    @ApiModelProperty("是否修改过批号: 0否, 1:是")
    private Integer isUpdateBatch;
    // æ˜¯å¦æ˜¯è¿‡æœŸææ–™: 0否, 1:是"
    @ApiModelProperty("物料类型")
    private Integer isExpire;
}
basic-server/src/main/java/com/ruoyi/basic/pojo/InsSample1.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,123 @@
package com.ruoyi.basic.pojo;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
 * æ£€éªŒæ ·å“
 * @TableName ins_sample
 */
@TableName(value ="ins_sample")
@Data
public class InsSample1 implements Serializable {
    /**
     *
     */
    @TableId(type = IdType.AUTO)
    private Integer id;
    /**
     * 1:合格 0:不合格
     */
    private Integer insResult;
    /**
     * å¤–键:ins_order表id
     */
    private Integer insOrderId;
    /**
     * é…å¥—样品型号
     */
    private String joinModel;
    /**
     * é…å¥—样品名称
     */
    private String joinName;
    /**
     * é…å¥—样品数量
     */
    private Integer joinNum;
    /**
     * æ ·å“ç¼–码
     */
    private String sampleCode;
    /**
     * æ£€éªŒå·¥åŽ‚
     */
    private String factory;
    /**
     * å®žéªŒå®¤åç§°
     */
    private String laboratory;
    /**
     * æ ·å“ç±»åž‹
     */
    private String sampleType;
    /**
     * æ ·å“åç§°
     */
    private String sample;
    /**
     * è§„格型号
     */
    private String model;
    /**
     * æ£€éªŒçŠ¶æ€(0:待检验1:检验中 2:已检验3:待复核4:复核未通过5:复核通过)
     */
    private Integer insState;
    /**
     * å¤‡æ³¨
     */
    private String remark;
    private Integer standardMethodListId;
    @ApiModelProperty("样品单位")
    private String unit;
    private Integer cellId;
    @TableField(fill = FieldFill.INSERT)
    private Integer createUser;
    @ApiModelProperty("创建时间")
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Integer updateUser;
    @ApiModelProperty("修改时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;
    private Integer parentId;
    @ApiModelProperty("数量")
    private Integer quantity;
    @ApiModelProperty("特殊标准方法")
    private String specialStandardMethod;
    @TableField(select = false,exist = false)
    private Integer num=1;
}
basic-server/src/main/java/com/ruoyi/basic/pojo/Laboratory.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,62 @@
package com.ruoyi.basic.pojo;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
 * å®žéªŒå®¤ç®¡ç†(Laboratory)表对象
 */
@TableName(value = "laboratory")
@Data
@NoArgsConstructor
public class Laboratory  implements Serializable {
    @ApiModelProperty(value = "主键")
    @TableId(type = IdType.AUTO)
    private Integer id;
    @ApiModelProperty(value = "实验室名称")
    private String laboratoryName;
    @ApiModelProperty(value = "场所编码")
    private String laboratoryNumber;
    @ApiModelProperty(value = "实验室代号")
    private String laboratoryCode;
    @ApiModelProperty(value = "负责人电话")
    private String phoneNumber;
    @ApiModelProperty(value = "负责人")
    @TableField(fill = FieldFill.INSERT)
    private String head;
    @ApiModelProperty(value = "地址")
    private String address;
    @ApiModelProperty(value = "创建人")
    @TableField(fill = FieldFill.INSERT)
    private Integer createUser;
    @ApiModelProperty(value = "创建人")
    private String createUserName;
    @ApiModelProperty(value = "修改人id")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Integer updateUser;
    @ApiModelProperty(value = "创建时间")
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;
    @ApiModelProperty(value = "更新时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;
}
basic-server/src/main/java/com/ruoyi/basic/pojo/Product.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,57 @@
package com.ruoyi.basic.pojo;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
 * äº§å“è¡¨
 * @TableName product
 */
@TableName(value ="product")
@Data
public class Product  implements Serializable {
    /**
     *
     */
    @TableId(type = IdType.AUTO)
    private Integer id;
    /**
     * äº§å“åç§°
     */
    private String name;
    /**
     * äº§å“åç§°EN
     */
    private String nameEn;
    @ApiModelProperty(value = "创建人id")
    @TableField(fill = FieldFill.INSERT)
    private Integer createUser;
    @ApiModelProperty(value = "修改人id")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Integer updateUser;
    @ApiModelProperty(value = "创建时间")
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;
    @ApiModelProperty(value = "更新时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;
    /**
     * å¤–键:structure_test_object表id
     */
    private Integer objectId;
}
basic-server/src/main/java/com/ruoyi/basic/pojo/ProductPart.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,49 @@
package com.ruoyi.basic.pojo;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
@Data
@TableName("product_part")
public class ProductPart implements Serializable {
    @TableId(type = IdType.AUTO)
    private Integer id;
    @ApiModelProperty("产品id")
    private Integer productId;
    @ApiModelProperty("零件号")
    private String partNo;
    @ApiModelProperty("颜色")
    private String color;
    @ApiModelProperty("色标")
    private String colorCode;
    @ApiModelProperty(value = "创建人id")
    @TableField(fill = FieldFill.INSERT)
    private Integer createUser;
    @ApiModelProperty(value = "修改人id")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Integer updateUser;
    @ApiModelProperty(value = "创建时间")
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;
    @ApiModelProperty(value = "更新时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;
}
basic-server/src/main/java/com/ruoyi/basic/pojo/ProductSupplierDensity.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,57 @@
package com.ruoyi.basic.pojo;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
 * äº§å“åŽ‚å®¶å¯†åº¦ç»‘å®šè¡¨
 *
 * @author zhuo
 * @since 2024-09-19
 */
@Data
@TableName("product_supplier_density")
public class ProductSupplierDensity implements Serializable {
    @TableId(type = IdType.AUTO)
    private Integer id;
    @ApiModelProperty("产品id")
    private Integer productId;
    @ApiModelProperty("型号")
    private String model;
    @ApiModelProperty("厂家名称")
    private String supplierName;
    @ApiModelProperty("密度值")
    private String densityValue;
    @ApiModelProperty(value = "创建人id")
    @TableField(fill = FieldFill.INSERT)
    private Integer createUser;
    @ApiModelProperty(value = "修改人id")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Integer updateUser;
    @ApiModelProperty(value = "创建时间")
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;
    @ApiModelProperty(value = "更新时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;
}
basic-server/src/main/java/com/ruoyi/basic/pojo/StandardMethod.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,85 @@
package com.ruoyi.basic.pojo;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
 * æ ‡å‡†æ–¹æ³•
 * @TableName standard_method
 */
@TableName(value ="standard_method")
@Data
public class StandardMethod implements Serializable {
    /**
     *
     */
    @TableId(type = IdType.AUTO)
    private Integer id;
    private String field;
    @ApiModelProperty("检验对象")
    private String structureTestObjectId;
    /**
     * æ ‡å‡†ç¼–号
     */
    @ApiModelProperty(value = "标准编号")
    private String code;
    /**
     * æ ‡å‡†æ–¹æ³•
     */
    @ApiModelProperty(value = "标准描述")
    private String name;
    @ApiModelProperty(value = "标准描述EN")
    private String nameEn;
    /**
     * å¤‡æ³¨
     */
    @ApiModelProperty(value = "备注")
    private String remark;
    @ApiModelProperty(value = "资质")
    private String qualificationId;
    @ApiModelProperty(value = "是否产品标准")
    private Integer isProduct;
    @ApiModelProperty(value = "是否启用")
    private Integer isUse;
    @ApiModelProperty(value = "创建人id")
    @TableField(fill = FieldFill.INSERT)
    private Integer createUser;
    @ApiModelProperty(value = "修改人id")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Integer updateUser;
    @ApiModelProperty(value = "创建人")
    @TableField(exist = false,select = false)
    private String createUserName;
    @ApiModelProperty(value = "更新人")
    @TableField(exist = false,select = false)
    private String updateUserName;
    @ApiModelProperty(value = "创建时间")
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;
    @ApiModelProperty(value = "更新时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;
}
basic-server/src/main/java/com/ruoyi/basic/pojo/StandardMethodList.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,83 @@
package com.ruoyi.basic.pojo;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
 * æ ‡å‡†æ ‘下的标准列表
 * @TableName standard_method_list
 */
@TableName(value ="standard_method_list")
@Data
public class StandardMethodList implements Serializable {
    /**
     *
     */
    @TableId(type = IdType.AUTO)
    private Integer id;
    /**
     * æ ‡å‡†ç¼–号
     */
    @ApiModelProperty("标准编号")
    private String code;
    /**
     * æ ‡å‡†åç§°
     */
    @ApiModelProperty("标准称号")
    private String name;
    /**
     * å¤‡æ³¨
     */
    @ApiModelProperty("备注")
    private String remark;
    @ApiModelProperty("工厂")
    private String factory;
    @ApiModelProperty("实验室")
    private String laboratory;
    @ApiModelProperty("样品分类")
    private String sampleType;
    @ApiModelProperty("样品")
    private String sample;
    @ApiModelProperty("型号")
    private String model;
    @ApiModelProperty("")
    @TableField(fill = FieldFill.INSERT)
    private Integer createUser;
    @TableField(exist = false)
    private String createUserName;
    /**
     *
     */
    @ApiModelProperty("创建时间")
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;
    /**
     *
     */
    @ApiModelProperty("")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Integer updateUser;
    /**
     *
     */
    @ApiModelProperty("修改时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;
}
basic-server/src/main/java/com/ruoyi/basic/pojo/StandardProductList.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,221 @@
package com.ruoyi.basic.pojo;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
 * æ ‡å‡†æ ‘下的检验项目
 * @TableName standard_product_list
 */
@TableName(value ="standard_product_list")
@Data
public class StandardProductList implements Serializable {
    /**
     * ä¸»é”®id
     */
    @TableId(value = "id",type = IdType.ASSIGN_ID)
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;
    /**
     * æ£€éªŒé¡¹
     */
    @ApiModelProperty("检验项")
    private String inspectionItem;
    @ApiModelProperty("检验项EN")
    private String inspectionItemEn;
    /**
     * æ£€éªŒé¡¹å°ç±»
     */
    @ApiModelProperty("检验项小类")
    private String inspectionItemSubclass;
    @ApiModelProperty("检验项小类EN")
    private String inspectionItemSubclassEn;
    /**
     * å®žéªŒå®¤
     */
    @ApiModelProperty("实验室")
    private String laboratory;
    @ApiModelProperty("子实验室")
    private String sonLaboratory;
    /**
     * è®¡é‡å•位
     */
    @ApiModelProperty("计量单位")
    private String unit;
    /**
     * å•ä»·(元)
     */
    @ApiModelProperty("单价")
    private String price;
    /**
     * å·¥æ—¶(H)
     */
    @ApiModelProperty("工时")
    private String manHour;
    /**
     * å·¥æ—¶åˆ†ç»„
     */
    @ApiModelProperty("工时分组")
    private String manHourGroup;
    /**
     * æ£€éªŒé¡¹ç±»åž‹
     */
    @ApiModelProperty("检验项类型")
    private String inspectionItemType;
    /**
     * æ£€éªŒå€¼ç±»åž‹
     */
    @ApiModelProperty("检验值类型")
    private String inspectionValueType;
    /**
     * æ£€éªŒæ¬¡æ•°
     */
    @ApiModelProperty("检验次数")
    private Integer checkoutNumber;
    /**
     * åŒºé—´
     */
    @ApiModelProperty("区间")
    private String section;
    /**
     * åŒºé—´
     */
    @ApiModelProperty("芯数区间")
    private String cores;
    /**
     * æ–¹æ³•
     */
    @ApiModelProperty("方法列表")
    private String method;
    @ApiModelProperty("方法")
    private String methodS;
    /**
     * é¢„计时间(天)
     */
    @ApiModelProperty("预计时间")
    private Integer manDay;
    /**
     * ç‰¹æ®Šæ ‡è¯†
     */
    @ApiModelProperty("特殊标识")
    private String bsm;
    /**
     * è¦æ±‚值
     */
    @ApiModelProperty("要求值")
    private String ask;
    @ApiModelProperty("要求描述")
    private String tell;
    /**
     * å¤–键:标准方法id
     */
    @ApiModelProperty("标准方法id")
    private Integer standardMethodListId;
    @ApiModelProperty("工厂")
    private String factory;
    @ApiModelProperty("样品分类")
    private String sampleType;
    @ApiModelProperty("样品")
    private String sample;
    @ApiModelProperty("型号")
    private String model;
    @ApiModelProperty("型号")
    private Integer templateId;
    @ApiModelProperty("")
    @TableField(fill = FieldFill.INSERT)
    private Integer createUser;
    /**
     *
     */
    @ApiModelProperty("创建时间")
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;
    /**
     *
     */
    @ApiModelProperty("")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Integer updateUser;
    /**
     *
     */
    @ApiModelProperty("修改时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;
    @ApiModelProperty("1:有效 0:无效")
    private Integer state;
    private String dic;
    private String tree;
    private Integer structureItemParameterId;
    @ApiModelProperty(value = "检验项分类")
    private String inspectionItemClass;
    @ApiModelProperty(value = "检验项分类EN")
    private String inspectionItemClassEn;
    @ApiModelProperty(value = "条件")
    private String radius;
    @ApiModelProperty(value = "条件列表")
    private String radiusList;
    @ApiModelProperty(value = "收费标准(元/次)")
    private String rates;
    @ApiModelProperty(value = "索引顺序")
    private Integer sort;
    /**
     * å¯¼ä½“材质
     */
    @ApiModelProperty("导体材质")
    private String conductorMaterial;
    /**
     * å¯¼ä½“类型
     */
    @ApiModelProperty("导体类型")
    private String conductorType;
}
basic-server/src/main/java/com/ruoyi/basic/pojo/StandardProductListSupplierAsk.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,58 @@
package com.ruoyi.basic.pojo;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDateTime;
/**
 * æ£€éªŒé¡¹ç›®åŽ‚å®¶å¯†åº¦ç»‘å®šè¡¨
 *
 * @author zhuo
 * @since 2024-09-23
 */
@TableName(value ="standard_product_list_supplier_ask")
@Data
public class StandardProductListSupplierAsk {
    @TableId(type = IdType.AUTO)
    private Integer supplierAskId;
    @JsonSerialize(using = ToStringSerializer.class)
    @ApiModelProperty("检验项目id")
    private Long productListId;
    @ApiModelProperty("厂家名称")
    private String supplierName;
    @ApiModelProperty("要求值")
    private String ask;
    @ApiModelProperty("要求描述")
    private String tell;
    @ApiModelProperty(value = "创建人id")
    @TableField(fill = FieldFill.INSERT)
    private Integer createUser;
    @ApiModelProperty(value = "修改人id")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Integer updateUser;
    @ApiModelProperty(value = "创建时间")
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;
    @ApiModelProperty(value = "更新时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;
}
basic-server/src/main/java/com/ruoyi/basic/pojo/StandardTemplate.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,76 @@
package com.ruoyi.basic.pojo;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
 * æ ‡å‡†æ¨¡æ¿
 * @TableName standard_template
 */
@TableName(value ="standard_template")
@Data
public class StandardTemplate  implements Serializable {
    /**
     *
     */
    @TableId(type = IdType.AUTO)
    private Integer id;
    /**
     * æ¨¡æ¿åç§°
     */
    @ApiModelProperty("模板名称")
    private String name;
    /**
     * å¤‡æ³¨
     */
    @ApiModelProperty("备注")
    private String remark;
    /**
     * æ¨¡æ¿ç»“æž„
     */
    private String thing;
    @TableField(fill = FieldFill.INSERT)
    private Integer createUser;
    /**
     *
     */
    @ApiModelProperty("创建时间")
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;
    /**
     *
     */
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Integer updateUser;
    /**
     *
     */
    @ApiModelProperty("修改时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;
    @ApiModelProperty("创建用户")
    @TableField(exist = false)
    private String createUserName;
    @ApiModelProperty("更新用户")
    @TableField(exist = false)
    private String updateUserName;
    /**
     * æ¨¡æ¿ç¼–号
     */
    @ApiModelProperty("模板编号")
    private String number;
}
basic-server/src/main/java/com/ruoyi/basic/pojo/StandardTree.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,96 @@
package com.ruoyi.basic.pojo;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* æ ‡å‡†æ ‘
* @TableName standard_tree
*/
@TableName(value ="standard_tree")
@Data
public class StandardTree implements Serializable {
    /**
    *
    */
    @NotNull(message="[]不能为空")
    @ApiModelProperty("")
    @TableId(type = IdType.AUTO)
    private Integer id;
    /**
    * å·¥åŽ‚
    */
    @Size(max= 255,message="编码长度不能超过255")
    @ApiModelProperty("工厂")
    @Length(max= 255,message="编码长度不能超过255")
    private String factory;
    /**
    * å®žéªŒå®¤
    */
    @Size(max= 255,message="编码长度不能超过255")
    @ApiModelProperty("实验室")
    @Length(max= 255,message="编码长度不能超过255")
    private String laboratory;
    /**
    * æ ·å“å¤§ç±»
    */
    @Size(max= 255,message="编码长度不能超过255")
    @ApiModelProperty("样品大类")
    @Length(max= 255,message="编码长度不能超过255")
    private String sampleType;
    /**
    * æ ·å“
    */
    @Size(max= 255,message="编码长度不能超过255")
    @ApiModelProperty("样品")
    @Length(max= 255,message="编码长度不能超过255")
    private String sample;
    /**
    * åž‹å·
    */
    @Size(max= 255,message="编码长度不能超过255")
    @ApiModelProperty("型号")
    @Length(max= 255,message="编码长度不能超过255")
    private String model;
    /**
    *
    */
    @ApiModelProperty("")
    @TableField(fill = FieldFill.INSERT)
    private Integer createUser;
    /**
    *
    */
    @ApiModelProperty("创建时间")
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;
    /**
    *
    */
    @ApiModelProperty("")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Integer updateUser;
    /**
    *
    */
    @ApiModelProperty("修改时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;
    /**
     * ä¿®æ”¹å‰åç§°
     */
    @TableField(exist = false,select = false)
    private String oldModel;
}
basic-server/src/main/java/com/ruoyi/basic/pojo/StructureItemParameter.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,121 @@
package com.ruoyi.basic.pojo;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
 * æ£€éªŒé¡¹ç›®å‚æ•°(StructureItemParameter)表对象
 *
 * @author makejava
 * @since 2024-02-26 16:21:17
 */
@TableName(value ="structure_item_parameter")
@Data
public class StructureItemParameter implements Serializable {
    @ApiModelProperty(value = "主键")
    @TableId(type = IdType.AUTO)
    private Integer id;
    @ApiModelProperty(value = "检验项")
    private String inspectionItem;
    @ApiModelProperty(value = "检验项EN")
    private String inspectionItemEn;
    @ApiModelProperty(value = "检验子项")
    private String inspectionItemSubclass;
    @ApiModelProperty(value = "检验子项EN")
    private String inspectionItemSubclassEn;
    @ApiModelProperty(value = "检验对象")
    private String sample;
    @ApiModelProperty(value = "单价(元)")
    private String price;
    @ApiModelProperty(value = "场所")
    private String laboratory;
    @ApiModelProperty(value = "试验室")
    private String sonLaboratory;
    @ApiModelProperty(value = "要求描述")
    private String askTell;
    @ApiModelProperty(value = "要求值")
    private String ask;
    @ApiModelProperty(value = "计量单位")
    private String unit;
    @ApiModelProperty(value = "试验方法")
    private String method;
    @ApiModelProperty(value = "工时(H)")
    private Double manHour;
    @ApiModelProperty(value = "预计时间(H)")
    private Integer manDay;
    @ApiModelProperty(value = "工时分组")
    private String manHourGroup;
    @ApiModelProperty(value = "检验项类型")
    private String inspectionItemType;
    @ApiModelProperty(value = "检验值类型")
    private String inspectionValueType;
    @ApiModelProperty(value = "检验次数")
    private Integer checkoutNumber;
    @ApiModelProperty(value = "区间")
    private String section;
    @ApiModelProperty(value = "特殊标识")
    private String bsm;
    @ApiModelProperty(value = "原始记录模板")
    private Integer templateId;
    @ApiModelProperty(value = "创建人id")
    @TableField(fill = FieldFill.INSERT)
    private Integer createUser;
    @ApiModelProperty(value = "修改人id")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Integer updateUser;
    @ApiModelProperty(value = "创建时间")
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;
    @ApiModelProperty(value = "修改时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;
    @ApiModelProperty(value = "字典类型")
    private String dic;
    @ApiModelProperty(value = "检验项分类")
    private String inspectionItemClass;
    @ApiModelProperty(value = "检验项分类EN")
    private String inspectionItemClassEn;
    @ApiModelProperty(value = "条件")
    private String radiusList;
    @ApiModelProperty(value = "收费标准(元/次)")
    private String rates;
}
basic-server/src/main/java/com/ruoyi/basic/pojo/StructureTestObject.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,63 @@
package com.ruoyi.basic.pojo;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
 * æ£€æµ‹å¯¹è±¡(StructureTestObject)表对象
 *
 * @author makejava
 * @since 2024-02-26 17:36:41
 */
@TableName(value ="structure_test_object")
@Data
public class StructureTestObject implements Serializable {
    @ApiModelProperty(value = "主键")
    @TableId(type = IdType.AUTO)
    private Integer id;
    @ApiModelProperty(value = "场所")
    private Integer laboratoryId;
    @ApiModelProperty(value = "检验对象")
    private String specimenName;
    @ApiModelProperty(value = "检验对象EN")
    private String specimenNameEn;
    @ApiModelProperty(value = "对象代号")
    private String code;
    @ApiModelProperty(value = "创建人id")
    @TableField(fill = FieldFill.INSERT)
    private Integer createUser;
    @ApiModelProperty(value = "修改人id")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Integer updateUser;
    @ApiModelProperty(value = "创建时间")
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;
    @ApiModelProperty(value = "更新时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;
    @ApiModelProperty(value = "排序")
    private Integer sort;
    //"对象类型, 1:原材料, 2:成品, 3:辅材"
    @ApiModelProperty(value = "对象类型")
    private String objectType;
}
basic-server/src/main/java/com/ruoyi/basic/pojo/StructureTestObjectPart.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,56 @@
package com.ruoyi.basic.pojo;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
 * æ£€éªŒå¯¹è±¡é›¶ä»¶è¡¨(StructureTestObjectPart)$desc
 *
 * @author makejava
 * @since 2024-08-07 10:10:30
 */
@TableName(value ="structure_test_object_part")
@Data
public class StructureTestObjectPart implements Serializable {
    @TableId(type = IdType.AUTO)
    private Integer id;
    @ApiModelProperty("检验对象id")
    private Integer testObjectId;
    @ApiModelProperty("零件号")
    private String partNo;
    @ApiModelProperty("颜色")
    private String color;
    @ApiModelProperty("色标")
    private String colorCode;
    @ApiModelProperty(value = "创建人id")
    @TableField(fill = FieldFill.INSERT)
    private Integer createUser;
    @ApiModelProperty(value = "修改人id")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Integer updateUser;
    @ApiModelProperty(value = "创建时间")
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;
    @ApiModelProperty(value = "更新时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;
}
basic-server/src/main/java/com/ruoyi/basic/service/CapacityScopeService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,46 @@
package com.ruoyi.basic.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.basic.dto.PageTestObjectDto;
import com.ruoyi.basic.dto.TestItemDto;
import com.ruoyi.basic.pojo.StructureItemParameter;
import com.ruoyi.basic.pojo.StructureTestObject;
import java.util.List;
import java.util.Map;
/**
 * æ£€éªŒé¡¹ç›®å‚æ•°(StructureItemParameter)表服务接口
 *
 * @author makejava
 * @since 2024-02-26 16:21:17
 */
public interface CapacityScopeService extends IService<StructureItemParameter> {
    IPage<StructureItemParameter> selectItemParameterList(Page page, StructureItemParameter itemParameter);
    int addItemParameter(StructureItemParameter itemParameter);
    int delItemParameter(Integer id);
    int upItemParameter(StructureItemParameter itemParameter);
    IPage<PageTestObjectDto> selectTestObjectList(Page page, PageTestObjectDto pageTestObjectDto);
    int addTestObject(StructureTestObject testObject);
    int delTestObject(Integer id);
    int upTestObject(StructureTestObject testObject);
    List<StructureTestObject> selectTestObjectByName();
    //设备里面选择检验项目(树形结构)
    List<Map<String, Object>> getInsProduction();
    List<TestItemDto> getItemTree();
}
basic-server/src/main/java/com/ruoyi/basic/service/CertificationService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,17 @@
package com.ruoyi.basic.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.basic.pojo.Certification;
public interface CertificationService extends IService<Certification> {
    //查询资质明细列表
    IPage<Certification> getCertificationDetail(Page page, Certification certification);
    //添加资质明细列表
    int addCertificationDetail(Certification certification);
    //删除资质明细列表
    int delCertificationDetail(String ids);
}
basic-server/src/main/java/com/ruoyi/basic/service/LaboratoryService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,27 @@
package com.ruoyi.basic.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.basic.pojo.Laboratory;
import java.util.List;
/**
 * å®žéªŒå®¤ç®¡ç†(Laboratory)表服务接口
 */
public interface LaboratoryService extends IService<Laboratory> {
    IPage<Laboratory> selectItemParameter(Page page, Laboratory itemParameter);
    int addParameter(Laboratory itemParameter);
    int delParameter(Integer id);
    int upParameter(Laboratory itemParameter);
    List<Laboratory> obtainItemParameterList();
}
basic-server/src/main/java/com/ruoyi/basic/service/ProductPartService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,14 @@
package com.ruoyi.basic.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.basic.pojo.ProductPart;
public interface ProductPartService extends IService<ProductPart> {
    IPage<ProductPart> selectByProductId(IPage<ProductPart> page,ProductPart productPart);
    void addProductPart(ProductPart productPart);
    void updateProductPartById(ProductPart productPart);
}
basic-server/src/main/java/com/ruoyi/basic/service/ProductService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,28 @@
package com.ruoyi.basic.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.basic.dto.ProductDTO1;
import com.ruoyi.basic.excel.StructureTestObjectData;
import com.ruoyi.basic.pojo.Product;
import java.util.List;
/**
* @author z1292
* @description é’ˆå¯¹è¡¨ã€product(产品表)】的数据库操作Service
* @createDate 2024-04-26 01:11:02
*/
public interface ProductService extends IService<Product> {
    IPage<Product> selectProductListByObjectId(Page page, ProductDTO1 productDto);
    int addProduct(Product product);
    int upProduct(Product product);
    int delProduct(Integer id);
    void importPartExcel(List<StructureTestObjectData> list);
}
basic-server/src/main/java/com/ruoyi/basic/service/ProductSupplierDensityService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,22 @@
package com.ruoyi.basic.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.basic.pojo.ProductSupplierDensity;
/**
 * äº§å“åŽ‚å®¶å¯†åº¦ç»‘å®šè¡¨
 *
 * @author zhuo
 * @since 2024-09-19
 */
public interface ProductSupplierDensityService extends IService<ProductSupplierDensity> {
    IPage<ProductSupplierDensity> selectByProductId(Page page, ProductSupplierDensity supplierDensity);
    void addProductSupplierDensity(ProductSupplierDensity supplierDensity);
    void updateProductSupplierDensity(ProductSupplierDensity supplierDensity);
}
basic-server/src/main/java/com/ruoyi/basic/service/StandardMethodListService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,28 @@
package com.ruoyi.basic.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.basic.pojo.StandardMethodList;
import java.util.List;
import java.util.Map;
/**
* @author Administrator
* @description é’ˆå¯¹è¡¨ã€standard_method_list(标准树下的标准列表)】的数据库操作Service
* @createDate 2024-03-04 13:44:04
*/
public interface StandardMethodListService extends IService<StandardMethodList> {
    int addStandardMethodList(Integer standardId, String tree);
    Map<String, List<?>> selectsStandardMethodByFLSSM(String tree);
    Map<String, List<?>> selectsStandardMethodByFLSSM2(String tree);
    int delStandardMethodByFLSSM(Integer id);
    List<StandardMethodList> selectStandardMethodEnum();
    Integer getStandardMethodId(String code);
}
basic-server/src/main/java/com/ruoyi/basic/service/StandardMethodService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,30 @@
package com.ruoyi.basic.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.basic.pojo.StandardMethod;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.util.List;
/**
* @author Administrator
* @description é’ˆå¯¹è¡¨ã€standard_method(标准方法)】的数据库操作Service
* @createDate 2024-03-03 19:21:41
*/
public interface StandardMethodService extends IService<StandardMethod> {
    IPage<StandardMethod> selectStandardMethodList(Page page, StandardMethod standardMethod);
    List<StandardMethod> selectStandardMethods();
    int addStandardMethod(StandardMethod standardMethod);
    int delStandardMethod(Integer id);
    int upStandardMethod(StandardMethod standardMethod);
    void inputExcel(MultipartFile file) throws IOException;
}
basic-server/src/main/java/com/ruoyi/basic/service/StandardProductListService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,67 @@
package com.ruoyi.basic.service;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.basic.dto.CopyStandardProductListDto;
import com.ruoyi.basic.dto.InsSampleReceiveDto;
import com.ruoyi.basic.dto.ResetTreeDragDTO;
import com.ruoyi.basic.pojo.StandardProductList;
import java.util.List;
import java.util.Map;
/**
 * @author Administrator
 * @description é’ˆå¯¹è¡¨ã€standard_product_list(标准树下的检验项目)】的数据库操作Service
 * @createDate 2024-03-05 10:33:29
 */
public interface StandardProductListService extends IService<StandardProductList> {
    int upStandardProductList(StandardProductList list);
    int delStandardProduct(JSONArray list);
    List<StandardProductList> selectStandardProductList(InsSampleReceiveDto insSample);
    Map<String, Object> selectStandardProductListByMethodId(Integer id, String tree, Integer page);
    IPage<StandardProductList> selectStandardProductByMethodId(Integer id, String tree, Integer page, String laboratory, String item, String items);
    Map<String, List<?>> selectStandardProductEnumByMethodId(Integer id, String tree, String item);
    boolean updateSection(StandardProductList list);
    /**
     * æ ‡å‡†åº“拖拽
     * @param resetTreeDragDTO
     */
    void resetTreeDrag(ResetTreeDragDTO resetTreeDragDTO);
    /**
     * æ ‡å‡†åº“拖拽
     * @param standardProductLists
     */
    void resetTreeDragBatch(List<StandardProductList> standardProductLists);
    /**
     * æ£€éªŒé¡¹è¦æ±‚值对比
     * @param copyStandardProductListDto
     * @return
     */
    List<StandardProductList> copyStandardProductList(CopyStandardProductListDto copyStandardProductListDto);
    /**
     * æ£€éªŒé¡¹è¦æ±‚值对比一个
     * @param copyStandardProductListDto
     * @return
     */
    List<StandardProductList> copyStandardProductOne(CopyStandardProductListDto copyStandardProductListDto);
    /**
     * æ£€éªŒé¡¹å¤åˆ¶æŽ’序
     * @param copyStandardProductListDto
     * @return
     */
    boolean copyStandardProductSort(CopyStandardProductListDto copyStandardProductListDto);
}
basic-server/src/main/java/com/ruoyi/basic/service/StandardProductListService2.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,13 @@
package com.ruoyi.basic.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.basic.pojo.StandardProductList;
/**
* @author Administrator
* @description é’ˆå¯¹è¡¨ã€standard_product_list(标准树下的检验项目)】的数据库操作Service
* @createDate 2024-03-05 10:33:29
*/
public interface StandardProductListService2 extends IService<StandardProductList> {
}
basic-server/src/main/java/com/ruoyi/basic/service/StandardProductListSupplierAskService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,23 @@
package com.ruoyi.basic.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.basic.pojo.StandardProductListSupplierAsk;
import java.util.List;
/**
 * æ£€éªŒé¡¹ç›®åŽ‚å®¶å¯†åº¦ç»‘å®šè¡¨
 *
 * @author makejava
 * @since 2024-09-23
 */
public interface StandardProductListSupplierAskService extends IService<StandardProductListSupplierAsk> {
    List<StandardProductListSupplierAsk> selectByProductId(StandardProductListSupplierAsk supplierAsk);
    Integer addProductSupplierAsk(StandardProductListSupplierAsk supplierAsk);
    Integer updateProductSupplierAsk(StandardProductListSupplierAsk supplierAsk);
}
basic-server/src/main/java/com/ruoyi/basic/service/StandardTemplateService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,34 @@
package com.ruoyi.basic.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.basic.pojo.StandardTemplate;
import java.util.List;
/**
* @author Administrator
* @description é’ˆå¯¹è¡¨ã€standard_template(标准模板)】的数据库操作Service
* @createDate 2024-03-11 13:47:52
*/
public interface StandardTemplateService extends IService<StandardTemplate> {
    IPage<StandardTemplate> selectStandardTemplatePageList(Page page, StandardTemplate standardTemplate);
    int addStandardTemplate(StandardTemplate standardTemplate);
    int upStandardTemplate(StandardTemplate standardTemplate);
    int delStandardTemplate(Integer id);
    List<StandardTemplate> getStandardTemplate();
    String getStandTempThingById(Integer templateId);
    String getStandTempNameById(Integer templateId);
    StandardTemplate getStandTempIdByName(String name);
    int copyStandardTemplate(StandardTemplate newTemplate);
}
basic-server/src/main/java/com/ruoyi/basic/service/StandardTreeService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,52 @@
package com.ruoyi.basic.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.basic.dto.FactoryDto;
import com.ruoyi.basic.dto.SampleTypeDto;
import com.ruoyi.basic.pojo.StandardTree;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
import java.util.Map;
/**
* @author Administrator
* @description é’ˆå¯¹è¡¨ã€standard_tree(标准树)】的数据库操作Service
* @createDate 2024-03-01 15:06:44
*/
public interface StandardTreeService extends IService<StandardTree> {
    List<FactoryDto> selectStandardTreeList();
    int addStandardTree(StandardTree standardTree);
    int delStandardTree(String tree);
    int addStandardProduct(String ids, String tree);
    List<SampleTypeDto> getStandardTree2();
    int upStandardProducts(Map<String, Object> product);
    List<StandardTree> getStandTreeBySampleType(String laboratory, String sampleType);
    void inExcelOfTree(MultipartFile file);
    void resetTreeOfPrice(String tree, Integer standardId);
    void resetTreeOfHour(String tree, Integer standardId);
    void resetTreeOfAsk(String tree, Integer standardId);
    void importWorkstationExcel(MultipartFile file);
    /**
     * æ ‡å‡†æ•°æŽ’序
     * @param list
     * @return
     */
    boolean updateTreeSort(List<FactoryDto> list);
    int updateStandardTree(StandardTree standardTree);
}
basic-server/src/main/java/com/ruoyi/basic/service/StructureItemParameterService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,8 @@
package com.ruoyi.basic.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.basic.pojo.StructureItemParameter;
public interface StructureItemParameterService extends IService<StructureItemParameter> {
    void removeNoSample(String sample);
}
basic-server/src/main/java/com/ruoyi/basic/service/StructureTestObjectPartService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,22 @@
package com.ruoyi.basic.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.basic.pojo.StructureTestObjectPart;
/**
 * æ£€éªŒå¯¹è±¡é›¶ä»¶è¡¨
 *
 * @author zhuo
 * @since 2024-08-07
 */
public interface StructureTestObjectPartService extends IService<StructureTestObjectPart> {
    IPage<StructureTestObjectPart> selectByTestObjectId(Page page, StructureTestObjectPart structureTestObjectPart);
    void addTestObjectPart(StructureTestObjectPart structureTestObjectPart);
    void updateTestObjectPart(StructureTestObjectPart structureTestObjectPart);
}
basic-server/src/main/java/com/ruoyi/basic/service/StructureTestObjectService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,15 @@
package com.ruoyi.basic.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.basic.pojo.StructureTestObject;
/**
 * æ£€æµ‹å¯¹è±¡(StructureTestObject)$desc
 *
 * @author makejava
 * @since 2024-09-13 09:45:55
 */
public interface StructureTestObjectService extends IService<StructureTestObject> {
}
basic-server/src/main/java/com/ruoyi/basic/service/impl/CapacityScopeServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,185 @@
package com.ruoyi.basic.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.exception.base.BaseException;
import com.ruoyi.common.utils.QueryWrappers;
import com.ruoyi.basic.dto.PageTestObjectDto;
import com.ruoyi.basic.dto.TestItemDto;
import com.ruoyi.basic.mapper.*;
import com.ruoyi.basic.pojo.*;
import com.ruoyi.basic.service.CapacityScopeService;
import com.ruoyi.basic.service.StandardProductListService;
import com.ruoyi.basic.service.StructureItemParameterService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
 * æ£€éªŒé¡¹ç›®å‚æ•°(StructureItemParameter)表服务实现类
 *
 * @author makejava
 * @since 2024-02-26 16:21:17
 */
@Service
@AllArgsConstructor
public class CapacityScopeServiceImpl extends ServiceImpl<StructureItemParameterMapper, StructureItemParameter> implements CapacityScopeService {
    private LaboratoryMapper laboratoryMapper;
    private StructureItemParameterMapper structureItemParameterMapper;
    private StructureTestObjectMapper structureTestObjectMapper;
    private ProductMapper productMapper;
    private StructureTestObjectPartMapper structureTestObjectPartMapper;
    private ProductPartMapper productPartMapper;
    private StandardProductListService standardProductListService;
    private StandardTreeMapper standardTreeMapper;
    private StructureItemParameterService structureItemParameterService;
    @Override
    public IPage<StructureItemParameter> selectItemParameterList(Page page, StructureItemParameter itemParameter) {
       return structureItemParameterMapper.selectItemParameterList(page, QueryWrappers.queryWrappers(itemParameter));
    }
    @Override
    public int addItemParameter(StructureItemParameter itemParameter) {
        if (itemParameter.getBsm().equals("")||itemParameter.getBsm()==null){
            itemParameter.setBsm("0");
        }
        int insert = structureItemParameterMapper.insert(itemParameter);
        return insert;
    }
    @Override
    public int delItemParameter(Integer id) {
        return structureItemParameterMapper.deleteById(id);
    }
    @Override
    public int upItemParameter(StructureItemParameter itemParameter) {
        return structureItemParameterMapper.updateById(itemParameter);
    }
    @Override
    public IPage<PageTestObjectDto> selectTestObjectList(Page page, PageTestObjectDto pageTestObjectDto) {
        String partNo = pageTestObjectDto.getPartNo();
        pageTestObjectDto.setPartNo(null);
        return structureTestObjectMapper.selectTestObjectList(page, QueryWrappers.queryWrappers(pageTestObjectDto),partNo);
    }
    @Override
    public int addTestObject(StructureTestObject testObject) {
        Long count = structureTestObjectMapper.selectCount(Wrappers.<StructureTestObject>lambdaQuery().eq(StructureTestObject::getSpecimenName, testObject.getSpecimenName()));
        if(count.compareTo(0L) > 0){
            throw new BaseException("检验对象不能重复");
        }
        return structureTestObjectMapper.insert(testObject);
    }
    @Override
    public int delTestObject(Integer id) {
        // äº§å‡ºæ£€éªŒå¯¹è±¡äº§å“ç»´æŠ¤
        structureTestObjectPartMapper.delete(Wrappers.<StructureTestObjectPart>lambdaQuery()
                .eq(StructureTestObjectPart::getTestObjectId, id));
        // åˆ é™¤äº§å“ç»´æŠ¤çš„零件绑定
        List<Product> products = productMapper.selectList(Wrappers.<Product>lambdaQuery()
                .eq(Product::getObjectId, id));
        List<Integer> productIds = products.stream().map(Product::getId).collect(Collectors.toList());
        productPartMapper.delete(Wrappers.<ProductPart>lambdaQuery()
                .in(ProductPart::getProductId, productIds));
        // åˆ é™¤äº§å“ç»´æŠ¤
        productMapper.delete(Wrappers.<Product>lambdaQuery()
                .in(Product::getId, productIds));
        return structureTestObjectMapper.deleteById(id);
    }
    @Override
    public int upTestObject(StructureTestObject testObject) {
        // æŸ¥è¯¢æ—§çš„æ£€éªŒå¯¹è±¡
        StructureTestObject oldTestObject = structureTestObjectMapper.selectById(testObject.getId());
        if (!oldTestObject.getSpecimenName().equals(testObject.getSpecimenName())) {
            // æŸ¥è¯¢æ‰€æœ‰å¯¹è±¡ä¸€æ ·çš„æ£€éªŒé¡¹ç›®
            List<StandardProductList> standardProductLists = standardProductListService.list(Wrappers.<StandardProductList>lambdaUpdate()
                    .eq(StandardProductList::getSampleType, oldTestObject.getSpecimenName()));
            if (CollectionUtils.isNotEmpty(standardProductLists)){
                for (StandardProductList standardProductList : standardProductLists) {
                    // ä¿®æ”¹æ‰€æœ‰çš„对象名称和数型结构
                    standardProductList.setSampleType(testObject.getSpecimenName());
                    // éœ€è¦æˆªå–第三级, é¿å…ä¸‰å››çº§åç§°ä¸€æ ·ä¿®æ”¹é”™è¯¯
                    String[] trees = standardProductList.getTree().split(" - ");
                    trees[2] = testObject.getSpecimenName();
                    List<String> list = CollUtil.newArrayList(trees);
                    String newName = CollUtil.join(list, " - ");
                    standardProductList.setTree(newName);
                }
                standardProductListService.updateBatchById(standardProductLists);
            }
            // ä¿®æ”¹æ£€éªŒé¡¹ç›®å‚数的检验对象
            // æ‹¼æŽ¥ ["object", æŸ¥è¯¢æ£€éªŒé¡¹ç›®å‚数修改绑定的检验对象
            String format = "[\"{}\",";
            String sampleOld = StrUtil.format(format, oldTestObject.getSpecimenName());
            List<StructureItemParameter> itemParameterList = structureItemParameterService.list(Wrappers.<StructureItemParameter>lambdaQuery()
                    .like(StructureItemParameter::getSample, sampleOld));
            if (CollectionUtils.isNotEmpty(itemParameterList)) {
                for (StructureItemParameter structureItemParameter : itemParameterList) {
                    // ä¿®æ”¹ç»‘定的样品名称
                    String sampleNew = StrUtil.format(format, testObject.getSpecimenName());
                    String sampleUp = structureItemParameter.getSample().replace(sampleOld, sampleNew);
                    structureItemParameter.setSample(sampleUp);
                }
                structureItemParameterService.updateBatchById(itemParameterList);
            }
            // ä¿®æ”¹æ ‘的型号
            standardTreeMapper.update(null, Wrappers.<StandardTree>lambdaUpdate()
                    .eq(StandardTree::getSampleType, oldTestObject.getSpecimenName())
                    .set(StandardTree::getSampleType, testObject.getSpecimenName()));
        }
        Long count = structureTestObjectMapper.selectCount(Wrappers.<StructureTestObject>lambdaQuery()
                .eq(StructureTestObject::getSpecimenName, testObject.getSpecimenName())
                .ne(StructureTestObject::getId, testObject.getId()));
        if(count.compareTo(0L) > 0){
            throw new BaseException("检验对象不能重复");
        }
        return structureTestObjectMapper.updateById(testObject);
    }
    @Override
    public List<StructureTestObject> selectTestObjectByName() {
        return structureTestObjectMapper.selectList(Wrappers.<StructureTestObject>lambdaQuery().select(StructureTestObject::getSpecimenName,StructureTestObject::getId));
    }
    //设备里面选择检验项目(树形结构)
    @Override
    public List<Map<String, Object>> getInsProduction() {
        return structureItemParameterMapper.getInsProduction();
    }
    @Override
    public List<TestItemDto> getItemTree() {
        return structureItemParameterMapper.getItemTree();
    }
}
basic-server/src/main/java/com/ruoyi/basic/service/impl/CertificationServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,45 @@
package com.ruoyi.basic.service.impl;
import com.alibaba.fastjson2.JSON;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.QueryWrappers;
import com.ruoyi.basic.mapper.CertificationMapper;
import com.ruoyi.basic.pojo.Certification;
import com.ruoyi.basic.service.CertificationService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Service
@AllArgsConstructor
@Transactional(rollbackFor = Exception.class)
public class CertificationServiceImpl extends ServiceImpl<CertificationMapper, Certification> implements CertificationService {
    private CertificationMapper certificationMapper;
    //查询资质明细列表
    @Override
    public IPage<Certification> getCertificationDetail(Page page, Certification certification) {
        return  certificationMapper.getCertificationDetail(page, QueryWrappers.queryWrappers(certification));
    }
    //添加资质明细列表
    @Override
    public int addCertificationDetail(Certification certification) {
        return certificationMapper.insert(certification);
    }
    //删除资质明细列表
    @Override
    public int delCertificationDetail(String ids) {
        List<Integer> list = JSON.parseArray(ids,Integer.class);
        return certificationMapper.deleteBatchIds(list);
    }
}
basic-server/src/main/java/com/ruoyi/basic/service/impl/LaboratoryServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,53 @@
package com.ruoyi.basic.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.QueryWrappers;
import com.ruoyi.basic.mapper.LaboratoryMapper;
import com.ruoyi.basic.pojo.Laboratory;
import com.ruoyi.basic.service.LaboratoryService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.List;
/**
 * å®žéªŒå®¤ç®¡ç†(Laboratory)表服务实现类
 */
@Service
@AllArgsConstructor
public class LaboratoryServiceImpl extends ServiceImpl<LaboratoryMapper, Laboratory> implements LaboratoryService {
    private LaboratoryMapper laboratoryMapper;
    @Override
    public IPage<Laboratory> selectItemParameter(Page page, Laboratory itemParameter) {
        return laboratoryMapper.selectItemParameter(page, QueryWrappers.queryWrappers(itemParameter));
    }
    @Override
    public int addParameter(Laboratory itemParameter) {
        return laboratoryMapper.insert(itemParameter);
    }
    @Override
    public int delParameter(Integer id) {
        return laboratoryMapper.deleteById(id);
    }
    @Override
    public int upParameter(Laboratory itemParameter) {
        return laboratoryMapper.updateById(itemParameter);
    }
    @Override
    public List<Laboratory> obtainItemParameterList() {
        return laboratoryMapper.selectList(Wrappers.<Laboratory>lambdaQuery().select(Laboratory::getLaboratoryName, Laboratory::getId));
    }
}
basic-server/src/main/java/com/ruoyi/basic/service/impl/ProductPartServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,68 @@
package com.ruoyi.basic.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
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.common.exception.base.BaseException;
import com.ruoyi.common.utils.QueryWrappers;
import com.ruoyi.basic.mapper.ProductPartMapper;
import com.ruoyi.basic.mapper.StructureTestObjectPartMapper;
import com.ruoyi.basic.pojo.ProductPart;
import com.ruoyi.basic.pojo.StructureTestObjectPart;
import com.ruoyi.basic.service.ProductPartService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Transactional
@Service
@AllArgsConstructor
public class ProductPartServiceImpl extends ServiceImpl<ProductPartMapper, ProductPart> implements ProductPartService {
    private  ProductPartMapper productPartMapper;
    private StructureTestObjectPartMapper structureTestObjectPartMapper;
    @Override
    public IPage<ProductPart> selectByProductId(IPage<ProductPart> page,ProductPart productPart) {
        return productPartMapper.selectListByProductId(page, QueryWrappers.queryWrappers(productPart),productPart.getProductId());
    }
    @Override
    public void addProductPart(ProductPart productPart) {
        if (productPart.getProductId() == null) {
            throw new BaseException("缺少产品对象id");
        }
        this.isPartNoExist(productPart.getPartNo(), productPart.getProductId(), null);
        productPartMapper.insert(productPart);
    }
    @Override
    public void updateProductPartById(ProductPart productPart) {
        this.isPartNoExist(productPart.getPartNo(), productPart.getProductId(), productPart.getId());
        if (productPart.getProductId() == null) {
            throw new BaseException("缺少产品对象id");
        }
        productPartMapper.updateById(productPart);
    }
    // åˆ¤æ–­é›¶ä»¶å·æ˜¯å¦å­˜åœ¨
    public void isPartNoExist(String partNo,Integer productId, Integer id) {
        // é›¶ä»¶å·å”¯ä¸€ ä½†ä¸å¿…å¡«
        if (StringUtils.isNotBlank(partNo)) {
            Long count = productPartMapper.selectCount(new LambdaQueryWrapper<ProductPart>()
//                    .eq(ProductPart::getProductId, productId)
                    .eq(ProductPart::getPartNo, partNo)
                    .ne(id != null, ProductPart::getId, id));
            Long selectCount = structureTestObjectPartMapper.selectCount(Wrappers.<StructureTestObjectPart>lambdaQuery()
                    .eq(StructureTestObjectPart::getPartNo, partNo));
            if (count > 0 || selectCount > 0) {
                throw new BaseException("该零件号已绑定过检验对象");
            }
        } else {
            throw new BaseException("请输入零件号");
        }
    }
}
basic-server/src/main/java/com/ruoyi/basic/service/impl/ProductServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,188 @@
package com.ruoyi.basic.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.exception.base.BaseException;
import com.ruoyi.common.utils.QueryWrappers;
import com.ruoyi.basic.dto.ProductDTO1;
import com.ruoyi.basic.excel.StructureTestObjectData;
import com.ruoyi.basic.mapper.ProductMapper;
import com.ruoyi.basic.mapper.ProductPartMapper;
import com.ruoyi.basic.mapper.StandardTreeMapper;
import com.ruoyi.basic.mapper.StructureTestObjectMapper;
import com.ruoyi.basic.pojo.*;
import com.ruoyi.basic.service.LaboratoryService;
import com.ruoyi.basic.service.ProductService;
import com.ruoyi.basic.service.StandardProductListService;
import com.ruoyi.basic.service.StructureItemParameterService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* @author z1292
* @description é’ˆå¯¹è¡¨ã€product(产品表)】的数据库操作Service实现
* @createDate 2024-04-26 01:11:02
*/
@Service
@AllArgsConstructor
public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product>
    implements ProductService{
    private ProductMapper productMapper;
    private LaboratoryService laboratoryService;
    private StructureTestObjectMapper structureTestObjectMapper;
    private ProductPartMapper productPartMapper;
    private StandardProductListService standardProductListService;
    private StandardTreeMapper standardTreeMapper;
    private StructureItemParameterService structureItemParameterService;
    @Override
    public IPage<Product> selectProductListByObjectId(Page page, ProductDTO1 product) {
        String partNo = product.getPartNo();
        product.setPartNo(null);
        return productMapper.selectProductListByObjectId(page, QueryWrappers.queryWrappers(product), partNo);
    }
    @Override
    public int addProduct(Product product) {
        return productMapper.insert(product);
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public int upProduct(Product product) {
        // æŸ¥è¯¢åŽŸæœ¬çš„åç§°
        Product oldProduct = productMapper.selectById(product.getId());
        if (!oldProduct.getName().equals(product.getName())) {
            // ä¿®æ”¹åç§°åŒ¹é…çš„æ ‡å‡†æ ‘下的检验项目
            // æŸ¥è¯¢æ‰€æœ‰å¯¹è±¡+名称的树
            StructureTestObject testObject = structureTestObjectMapper.selectById(oldProduct.getObjectId());
            List<StandardProductList> standardProductLists = standardProductListService.list(Wrappers.<StandardProductList>lambdaUpdate()
                    .eq(StandardProductList::getSample, oldProduct.getName())
                    .eq(StandardProductList::getSampleType, testObject.getSpecimenName()));
            if (CollectionUtils.isNotEmpty(standardProductLists)) {
                for (StandardProductList standardProductList : standardProductLists) {
                    // ä¿®æ”¹æ ·å“åç§°
                    standardProductList.setSample(product.getName());
                    // ä¿®æ”¹æ ‘名称
                    // éœ€è¦æˆªå–第四级, é¿å…ä¸‰å››çº§åç§°ä¸€æ ·ä¿®æ”¹é”™è¯¯
                    String[] trees = standardProductList.getTree().split(" - ");
                    trees[3] = product.getName();
                    List<String> list = CollUtil.newArrayList(trees);
                    String newName = CollUtil.join(list, " - ");
                    standardProductList.setTree(newName);
                }
                standardProductListService.updateBatchById(standardProductLists);
            }
            // ä¿®æ”¹æ£€éªŒé¡¹ç›®å‚数的检验对象
            // æ‹¼æŽ¥["object","product"]查询检验项目参数修改绑定的检验对象
            String format = "[\"{}\",\"{}\"]";
            String sampleOld = StrUtil.format(format, testObject.getSpecimenName(), oldProduct.getName());
            List<StructureItemParameter> itemParameterList = structureItemParameterService.list(Wrappers.<StructureItemParameter>lambdaQuery()
                    .like(StructureItemParameter::getSample, sampleOld));
            if (CollectionUtils.isNotEmpty(itemParameterList)) {
                for (StructureItemParameter structureItemParameter : itemParameterList) {
                    // ä¿®æ”¹ç»‘定的样品名称
                    String sampleNew = StrUtil.format(format, testObject.getSpecimenName(), product.getName());
                    String sampleUp = structureItemParameter.getSample().replace(sampleOld, sampleNew);
                    structureItemParameter.setSample(sampleUp);
                }
                structureItemParameterService.updateBatchById(itemParameterList);
            }
            // ä¿®æ”¹æ ‘的型号
            standardTreeMapper.update(null, Wrappers.<StandardTree>lambdaUpdate()
                    .eq(StandardTree::getSampleType, testObject.getSpecimenName())
                    .eq(StandardTree::getSample, oldProduct.getName())
                    .set(StandardTree::getSample, product.getName()));
        }
        return productMapper.updateById(product);
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public int delProduct(Integer id) {
        // åˆ é™¤é›¶ä»¶ç»‘定
        productPartMapper.delete(Wrappers.<ProductPart>lambdaQuery()
                .eq(ProductPart::getProductId, id));
        return productMapper.deleteById(id);
    }
    @Transactional(rollbackFor = Exception.class)
    @Override
    public void importPartExcel(List<StructureTestObjectData> list) {
        list.forEach(i -> {
            // æ£€éªŒå¯¹è±¡
            StructureTestObject structureTestObject1 = structureTestObjectMapper.selectOne(Wrappers.<StructureTestObject>lambdaQuery()
                    .eq(StructureTestObject::getSpecimenName, i.getSpecimenName())
                    .eq(StructureTestObject::getSpecimenNameEn, i.getSpecimenNameEn()));
            Laboratory laboratory = laboratoryService.getOne(Wrappers.<Laboratory>lambdaQuery()
                    .eq(Laboratory::getLaboratoryName, i.getLaboratory()));
            if (ObjectUtils.isEmpty(laboratory)) {
                throw new BaseException("未找到该场所:" + i.getLaboratory() + ",请检查是否存在该场所!");
            }
            // å¦‚果为空进行新增
            if(ObjectUtils.isEmpty(structureTestObject1)) {
                StructureTestObject structureTestObject = new StructureTestObject();
                structureTestObject.setLaboratoryId(laboratory.getId());
                structureTestObject.setSpecimenName(i.getSpecimenName());
                structureTestObject.setSpecimenNameEn(i.getSpecimenNameEn());
                structureTestObject.setCode(i.getCode());
                structureTestObjectMapper.insert(structureTestObject);
                // äº§å“
                Product product = productMapper.selectOne(Wrappers.<Product>lambdaQuery()
                        .eq(Product::getName, i.getName())
                        .eq(Product::getNameEn, i.getNameEn()));
                if (ObjectUtils.isEmpty(product)){
                    Product product1 = new Product();
                    product1.setName(i.getName());
                    product1.setNameEn(i.getNameEn());
                    product1.setObjectId(structureTestObject.getId());
                    baseMapper.insert(product1);
                }
            } else {
                structureTestObject1.setCode(i.getCode());
                structureTestObject1.setLaboratoryId(laboratory.getId());
                structureTestObjectMapper.updateById(structureTestObject1);
                // äº§å“
                Product product = productMapper.selectOne(Wrappers.<Product>lambdaQuery()
                        .eq(Product::getName, i.getName())
                        .eq(Product::getNameEn, i.getNameEn()));
                if (ObjectUtils.isEmpty(product)){
                    Product product1 = new Product();
                    product1.setName(i.getName());
                    product1.setNameEn(i.getNameEn());
                    product1.setObjectId(structureTestObject1.getId());
                    baseMapper.insert(product1);
                } else {
                    product.setName(i.getName());
                    product.setNameEn(i.getNameEn());
                    product.setObjectId(structureTestObject1.getId());
                    baseMapper.updateById(product);
                }
            }
        });
    }
}
basic-server/src/main/java/com/ruoyi/basic/service/impl/ProductSupplierDensityServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,64 @@
package com.ruoyi.basic.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.exception.base.BaseException;
import com.ruoyi.common.utils.QueryWrappers;
import com.ruoyi.basic.mapper.ProductSupplierDensityMapper;
import com.ruoyi.basic.pojo.ProductSupplierDensity;
import com.ruoyi.basic.service.ProductSupplierDensityService;
import org.springframework.stereotype.Service;
/**
 * äº§å“åŽ‚å®¶å¯†åº¦ç»‘å®šè¡¨
 *
 * @author zhuo
 * @since 2024-09-19
 */
@Service
public class ProductSupplierDensityServiceImpl extends ServiceImpl<ProductSupplierDensityMapper, ProductSupplierDensity> implements ProductSupplierDensityService {
    @Override
    public IPage<ProductSupplierDensity> selectByProductId(Page page, ProductSupplierDensity supplierDensity) {
        if (supplierDensity.getProductId() == null) {
            throw new BaseException("缺少产品对象id");
        }
        return baseMapper.selectListByProductId(page, QueryWrappers.queryWrappers(supplierDensity), supplierDensity.getProductId());
    }
    @Override
    public void addProductSupplierDensity(ProductSupplierDensity supplierDensity) {
        if (supplierDensity.getProductId() == null) {
            throw new BaseException("缺少产品对象id");
        }
        // æŸ¥è¯¢æ”¹åŽ‚å®¶æ˜¯å¦ç»‘å®šè¿‡
//        Long count = baseMapper.selectCount(Wrappers.<ProductSupplierDensity>lambdaQuery()
//                .eq(ProductSupplierDensity::getProductId, supplierDensity.getProductId())
//                .eq(ProductSupplierDensity::getModel, supplierDensity)
//                .eq(ProductSupplierDensity::getSupplierName, supplierDensity.getSupplierName()));
//        if (count > 0){
//            throw new BaseException("该产品已绑定过该厂家");
//        }
        baseMapper.insert(supplierDensity);
    }
    @Override
    public void updateProductSupplierDensity(ProductSupplierDensity supplierDensity) {
        if (supplierDensity.getProductId() == null) {
            throw new BaseException("缺少产品对象id");
        }
        // æŸ¥è¯¢æ”¹åŽ‚å®¶æ˜¯å¦ç»‘å®šè¿‡
//        Long count = baseMapper.selectCount(Wrappers.<ProductSupplierDensity>lambdaQuery()
//                .ne(ProductSupplierDensity::getId, supplierDensity.getId())
//                .eq(ProductSupplierDensity::getProductId, supplierDensity.getProductId())
//                .eq(ProductSupplierDensity::getModel, supplierDensity)
//                .eq(ProductSupplierDensity::getSupplierName, supplierDensity.getSupplierName()));
//        if (count > 0){
//            throw new BaseException("该产品已绑定过该厂家");
//        }
        baseMapper.updateById(supplierDensity);
    }
}
basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardMethodListServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,150 @@
package com.ruoyi.basic.service.impl;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.basic.mapper.StandardMethodListMapper;
import com.ruoyi.basic.mapper.StandardProductListMapper;
import com.ruoyi.basic.pojo.StandardMethodList;
import com.ruoyi.basic.pojo.StandardProductList;
import com.ruoyi.basic.service.StandardMethodListService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author Administrator
* @description é’ˆå¯¹è¡¨ã€standard_method_list(标准树下的标准列表)】的数据库操作Service实现
* @createDate 2024-03-04 13:44:04
*/
@Service
@AllArgsConstructor
public class StandardMethodListServiceImpl extends ServiceImpl<StandardMethodListMapper, StandardMethodList>
    implements StandardMethodListService{
    private StandardMethodListMapper standardMethodListMapper;
    private StandardProductListMapper standardProductListMapper;
    @Override
    public int addStandardMethodList(Integer standardId, String tree) {
        String[] trees = tree.split(" - ");
        Map<String, String> map = standardMethodListMapper.selectStandardMethodById(standardId);
        StandardMethodList list = new StandardMethodList();
        list.setCode(map.get("code"));
        list.setName(map.get("name"));
        list.setRemark(map.get("remark"));
        list.setFactory(trees[0]);
        try {
            list.setLaboratory(trees[1]);
        }catch (Exception e){}
        try {
            list.setSampleType(trees[2]);
        }catch (Exception e){}
        try {
            list.setSample(trees[3]);
        }catch (Exception e){}
        try {
            list.setModel(trees[4]);
        }catch (Exception e){}
        standardMethodListMapper.insert(list);
        List<StandardProductList> standardProductLists = standardMethodListMapper.selectParameterList(list.getCode());
        for (StandardProductList standardProductList : standardProductLists) {
            standardProductList.setStandardMethodListId(list.getId());
            standardProductList.setFactory(trees[0]);
            try {
                standardProductList.setLaboratory(trees[1]);
            }catch (Exception e){}
            try {
                standardProductList.setSampleType(trees[2]);
            }catch (Exception e){}
            try {
                standardProductList.setSample(trees[3]);
            }catch (Exception e){}
            try {
                standardProductList.setModel(trees[4]);
            }catch (Exception e){}
            standardProductListMapper.insert(standardProductList);
        }
        return 1;
    }
    @Override
    public Map<String, List<?>> selectsStandardMethodByFLSSM(String tree) {
        String[] trees = tree.split(" - ");
        Map<String, List<?>> map = new HashMap<>();
        String str = "";
        List<StandardMethodList> standardMethodLists = new ArrayList<>();
        switch (trees.length){
            case 5:
                str += "\"" + trees[2] + "\",\"" + trees[3] + "\",\"" + trees[4] + "\"";
                standardMethodLists.addAll(standardMethodListMapper.selectStandardMethodLists(str));
                standardMethodLists.addAll(standardMethodListMapper.selectStandardMethodLists("\"" + trees[2] + "\",\"" + trees[3] + "\""));
                standardMethodLists.addAll(standardMethodListMapper.selectStandardMethodLists("\"" + trees[2] + "\""));
                break;
            case 4:
                str += "\"" + trees[2] + "\",\"" + trees[3] + "\"";
                standardMethodLists.addAll(standardMethodListMapper.selectStandardMethodLists(str));
                standardMethodLists.addAll(standardMethodListMapper.selectStandardMethodLists("\"" + trees[2] + "\""));
                break;
            case 3:
                str += "\"" + trees[2] + "\"";
                standardMethodLists.addAll(standardMethodListMapper.selectStandardMethodLists3(str));
                break;
            default:
                map.put("standardMethodList", null);
                return map;
        }
        standardMethodLists.addAll(standardMethodListMapper.selectStandardMethodListsByNull(str));
        map.put("standardMethodList", standardMethodLists);
        return map;
    }
    @Override
    public Map<String, List<?>> selectsStandardMethodByFLSSM2(String tree) {
        String[] trees = tree.split(" - ");
        List<StandardMethodList> standardMethodLists = null;
        switch (trees.length){
            case 5:
                standardMethodLists = standardMethodListMapper.selectStandardMethodLists2(trees[0],trees[1],trees[2],trees[3],trees[4]);
                break;
            case 4:
                standardMethodLists = standardMethodListMapper.selectStandardMethodLists2(trees[0],trees[1],trees[2],trees[3],null);
                break;
            case 3:
                standardMethodLists = standardMethodListMapper.selectStandardMethodLists2(trees[0],trees[1],trees[2],null,null);
                break;
            case 2:
                standardMethodLists = standardMethodListMapper.selectStandardMethodLists2(trees[0],trees[1],null,null,null);
                break;
            case 1:
                standardMethodLists = standardMethodListMapper.selectStandardMethodLists2(trees[0],null,null,null,null);
                break;
        }
        Map<String, List<?>> map = new HashMap<>();
        map.put("standardMethodList", standardMethodLists);
        return map;
    }
    @Override
    public int delStandardMethodByFLSSM(Integer id) {
        standardProductListMapper.delete(Wrappers.<StandardProductList>lambdaUpdate().eq(StandardProductList::getStandardMethodListId, id));
        return standardMethodListMapper.deleteById(id);
    }
    @Override
    public List<StandardMethodList> selectStandardMethodEnum() {
        return standardMethodListMapper.selectListEnum();
    }
    @Override
    public Integer getStandardMethodId(String code) {
        return baseMapper.getStandardMethodId(code);
    }
}
basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardMethodServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,260 @@
package com.ruoyi.basic.service.impl;
import cn.hutool.json.JSONUtil;
import cn.hutool.poi.excel.ExcelUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.QueryWrappers;
import com.ruoyi.basic.mapper.StandardMethodMapper;
import com.ruoyi.basic.mapper.StandardProductListMapper;
import com.ruoyi.basic.mapper.StructureItemParameterMapper;
import com.ruoyi.basic.pojo.StandardMethod;
import com.ruoyi.basic.pojo.StandardProductList;
import com.ruoyi.basic.pojo.StructureItemParameter;
import com.ruoyi.basic.service.StandardMethodService;
import com.ruoyi.basic.service.StandardProductListService;
import com.ruoyi.basic.service.StructureItemParameterService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.util.*;
import java.util.concurrent.CompletableFuture;
/**
 * @author Administrator
 * @description é’ˆå¯¹è¡¨ã€standard_method(标准方法)】的数据库操作Service实现
 * @createDate 2024-03-03 19:21:41
 */
@Service
@AllArgsConstructor
public class StandardMethodServiceImpl extends ServiceImpl<StandardMethodMapper, StandardMethod>
        implements StandardMethodService {
    private StandardMethodMapper standardMethodMapper;
    StandardProductListMapper standardProductListMapper;
    StandardProductListService standardProductListService;
    StructureItemParameterMapper structureItemParameterMapper;
    StructureItemParameterService structureItemParameterService;
    @Override
    public IPage<StandardMethod> selectStandardMethodList(Page page, StandardMethod standardMethod) {
        return standardMethodMapper.selectStandardMethodList(page, QueryWrappers.queryWrappers(standardMethod));
    }
    @Override
    public List<StandardMethod> selectStandardMethods() {
        return standardMethodMapper.selectList(Wrappers.<StandardMethod>lambdaQuery().select(StandardMethod::getId, StandardMethod::getCode, StandardMethod::getName).ne(StandardMethod::getId, 0));
    }
    @Override
    public int addStandardMethod(StandardMethod standardMethod) {
        int insert = standardMethodMapper.insert(standardMethod);
        return insert;
    }
    @Override
    public int delStandardMethod(Integer id) {
        int i = standardMethodMapper.deleteById(id);
        return i;
    }
    @Override
    public int upStandardMethod(StandardMethod standardMethod) {
        StandardMethod oldStandardMethod = standardMethodMapper.selectById(standardMethod.getId());
        if (!oldStandardMethod.getCode().equals(standardMethod.getCode())) {
            CompletableFuture.supplyAsync(() -> replaceMethod(oldStandardMethod.getCode(), standardMethod.getCode()));
        }
        int i = standardMethodMapper.updateById(standardMethod);
        return i;
    }
    //编辑method后全部替换
    public String replaceMethod(String oldCode, String code) {
        //查询StandardProductList中所有Method如果包含之前的则替换
        List<StandardProductList> standardProductLists = standardProductListMapper.selectList(null);
        for (StandardProductList standardProductList : standardProductLists) {
            if (standardProductList.getMethod().contains(oldCode)) {
                String[] split = standardProductList.getMethod().split(",");
                String a = null;
                for (int i = 0; i < split.length; i++) {
                    String methodName = split[i].substring(1, split[i].length() - 1);
                    if (i == 0) {
                        methodName = split[i].substring(2, split[i].length() - 1);
                    } else if (i == split.length - 1) {
                        methodName = split[i].substring(1, split[i].length() - 2);
                    }
                    if (methodName.equals(oldCode)) {
                        methodName = code;
                    }
                    a += "\"" + methodName + "\",";
                }
                String method = "[\"" + a.substring(0, a.length() - 1) + "\"]";
                standardProductList.setMethod(method);
            }
        }
        standardProductListService.updateBatchById(standardProductLists);
        //查询StructureItemParameter中所有Method如果包含之前的则替换
        List<StructureItemParameter> structureItemParameters = structureItemParameterMapper.selectList(null);
        for (StructureItemParameter structureItemParameter : structureItemParameters) {
            if (structureItemParameter.getMethod().contains(oldCode)) {
                String[] split = structureItemParameter.getMethod().split(",");
                String a = null;
                for (int i = 0; i < split.length; i++) {
                    String methodName = split[i].substring(1, split[i].length() - 1);
                    if (i == 0) {
                        methodName = split[i].substring(2, split[i].length() - 1);
                    } else if (i == split.length - 1) {
                        methodName = split[i].substring(1, split[i].length() - 2);
                    }
                    if (methodName.equals(oldCode)) {
                        methodName = code;
                    }
                    a += "\"" + methodName + "\",";
                }
                String method = "[\"" + a.substring(0, a.length() - 1) + "\"]";
                structureItemParameter.setMethod(method);
            }
        }
        structureItemParameterService.updateBatchById(structureItemParameters);
        return "替换完毕!";
    }
    @Transactional(rollbackFor = Exception.class)
    @Override
    public void inputExcel(MultipartFile file) throws IOException {
        // å­˜å‚¨æ£€æµ‹å¯¹è±¡List
        List<Object> structureTestObjectIdList = new ArrayList<>();
        List<StandardMethod> result = new ArrayList<>();
        ExcelUtil.readBySax(file.getInputStream(), 0, (i, l, list) -> {
            // åŽ»é™¤ç¬¬ä¸€è¡Œè¡¨å¤´
            if (l == 0) {
                return;
            }
            // å­˜å‚¨å”¯ä¸€æ£€æµ‹å¯¹è±¡
            if (!structureTestObjectIdList.contains(list.get(2))) {
                structureTestObjectIdList.add(list.get(2));
            }
            StandardMethod standardMethod = formatData(list);
            result.add(standardMethod);
        });
        addStructureTest(structureTestObjectIdList, result);
    }
    // æ ¼å¼åŒ–数据
    public StandardMethod formatData(List<Object> list) {
        StandardMethod standardMethod = new StandardMethod();
        standardMethod.setField(list.get(1).toString());
        // é€ æ ¼å¼
        List<List<Object>> structureTestObjectId = new ArrayList<>();
        if (ObjectUtils.isEmpty(list.get(3))) {
            structureTestObjectId.add(Arrays.asList(list.get(2)));
        } else {
            structureTestObjectId.add(Arrays.asList(list.get(2), list.get(3)));
        }
        standardMethod.setStructureTestObjectId(JSONUtil.toJsonStr(structureTestObjectId));
        standardMethod.setCode(list.get(4).toString());
        standardMethod.setName(list.get(5).toString());
        standardMethod.setNameEn(list.get(6).toString());
        if (!Objects.equals(list.get(7), null)) {
            standardMethod.setRemark(list.get(7).toString());
        }
        standardMethod.setQualificationId(list.get(8).toString());
        if (ObjectUtils.isNotEmpty(list.get(9))) {
            if (list.get(9).equals("是")) {
                standardMethod.setIsProduct(1);
            } else if (list.get(9).equals("否")) {
                standardMethod.setIsProduct(0);
            }
        }
        if (ObjectUtils.isNotEmpty(list.get(10))) {
            if (list.get(10).equals("是")) {
                standardMethod.setIsUse(1);
            } else if (list.get(9).equals("否")) {
                standardMethod.setIsUse(0);
            }
        }
        return standardMethod;
    }
    // æ–°å¢žæ•°æ®
    public void addStructureTest(List<Object> structureTestObjectIdList, List<StandardMethod> standardMethodList) {
        List<StandardMethod> updateList = new ArrayList<>();
        List<Integer> deleteListId = new ArrayList<>();
        List<StandardMethod> addList = new ArrayList<>();
        if (!structureTestObjectIdList.isEmpty()) {
            // å¾ªçޝexcel里面的分组
            structureTestObjectIdList.forEach(j -> {
                // ä»¥excel中的组名查询数据库中的分组
                List<StandardMethod> standardMethods = baseMapper.selectList(Wrappers.<StandardMethod>lambdaQuery()
                        .like(StandardMethod::getStructureTestObjectId, "\"" + j + "\""));
                // å°†ç»“果循环匹配
                for (int i = 0; i < standardMethods.size(); i++) {
                    boolean isExistence = false;
                    for (int i1 = 0; i1 < standardMethodList.size(); i1++) {
                        // æ›´æ–°
                        if (standardMethods.get(i).getStructureTestObjectId().equals(standardMethodList.get(i1).getStructureTestObjectId())
                                && standardMethods.get(i).getCode().equals(standardMethodList.get(i1).getCode())
                                && standardMethods.get(i).getField().equals(standardMethodList.get(i1).getField())) {
                            // ç»™excel数据赋值id做更新
                            standardMethodList.get(i1).setId(standardMethods.get(i).getId());
                            // æ›´æ–°
                            updateList.add(standardMethodList.get(i1));
                            isExistence = true;
                            break;
                        }
                    }
                    // åˆ é™¤
                    if (!isExistence) {
                        deleteListId.add(standardMethods.get(i).getId());
                    }
                }
                for (int i = 0; i < standardMethodList.size(); i++) {
                    if (standardMethodList.get(i).getStructureTestObjectId().contains("\"" + j + "\"")) {
                        boolean isExistence = false;
                        for (int i1 = 0; i1 < standardMethods.size(); i1++) {
                            if (standardMethods.get(i1).getStructureTestObjectId().equals(standardMethodList.get(i).getStructureTestObjectId())
                                    && standardMethods.get(i1).getCode().equals(standardMethodList.get(i).getCode())
                                    && standardMethods.get(i1).getField().equals(standardMethodList.get(i).getField())) {
                                isExistence = true;
                                break;
                            }
                        }
                        // æ–°å¢ž
                        if (!isExistence) {
                            addList.add(standardMethodList.get(i));
                        }
                    }
                }
            });
        }
        if (!addList.isEmpty()) {
            // æ–°å¢ž
            baseMapper.insertBatchSomeColumn(addList);
        }
        if (!deleteListId.isEmpty()) {
            // åˆ é™¤
            baseMapper.deleteBatchIds(deleteListId);
        }
        if (!updateList.isEmpty()) {
            // æ›´æ–°
            updateList.forEach(i -> {
                baseMapper.updateById(i);
            });
        }
    }
}
basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardProductListService2Impl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,12 @@
package com.ruoyi.basic.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.basic.mapper.StandardProductListMapper;
import com.ruoyi.basic.pojo.StandardProductList;
import com.ruoyi.basic.service.StandardProductListService2;
import org.springframework.stereotype.Service;
@Service
public class StandardProductListService2Impl extends ServiceImpl<StandardProductListMapper, StandardProductList>
        implements StandardProductListService2 {
}
basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardProductListServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,701 @@
package com.ruoyi.basic.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.exception.base.BaseException;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.basic.dto.CopyStandardProductListDto;
import com.ruoyi.basic.dto.InsSampleReceiveDto;
import com.ruoyi.basic.dto.ProductDto;
import com.ruoyi.basic.dto.ResetTreeDragDTO;
import com.ruoyi.basic.mapper.IfsInventoryQuantityMapper;
import com.ruoyi.basic.mapper.StandardProductListMapper;
import com.ruoyi.basic.mapper.StandardProductListSupplierAskMapper;
import com.ruoyi.basic.mapper.StandardTreeMapper;
import com.ruoyi.basic.pojo.StandardProductList;
import com.ruoyi.basic.pojo.StandardProductListSupplierAsk;
import com.ruoyi.basic.pojo.StandardTree;
import com.ruoyi.basic.service.StandardProductListService;
import com.ruoyi.basic.service.StandardProductListService2;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
/**
 * @author Administrator
 * @description é’ˆå¯¹è¡¨ã€standard_product_list(标准树下的检验项目)】的数据库操作Service实现
 * @createDate 2024-03-05 10:33:29
 */
@Service
@AllArgsConstructor
public class StandardProductListServiceImpl extends ServiceImpl<StandardProductListMapper, StandardProductList>
        implements StandardProductListService {
    private StandardProductListMapper standardProductListMapper;
    private StandardTreeMapper standardTreeMapper;
    private StandardProductListService2 standardProductListService2;
    private IfsInventoryQuantityMapper ifsInventoryQuantityMapper;
    private StandardProductListSupplierAskMapper standardProductListSupplierAskMapper;
    @Override
    public int upStandardProductList(StandardProductList list) {
        return standardProductListMapper.updateById(list);
    }
    @Override
    public int delStandardProduct(JSONArray list) {
        return standardProductListMapper.deleteBatchIds(list);
    }
    @Override
    public List<StandardProductList> selectStandardProductList(InsSampleReceiveDto insSample) {
        // æ˜¯å¦æ²¡æœ‰äº§å“
        boolean isNoSample = false;
//        String[] models = insSample.getModel().split("-(?=[^-]*$)");//拆分最后一个【-】
        String model = insSample.getModel();
        String modelNum = insSample.getModelNum();
        List<StandardProductList> list = standardProductListMapper.selectDetail(insSample.getStandardMethodListId(), 1, model, insSample.getIsCableTag());
        if (list.size() == 0) {
            if (Objects.equals(insSample.getFactory(), "") || insSample.getFactory() == null) {
                return null;
            }
            String[] split = insSample.getFactory().split(" - ");
            split[3] = split[3].replace("- ", "");
            String tree = split[0] + " - " + split[1] + " - " + split[2] + " - " + split[3] + " - null";
            list = standardProductListMapper.selectDetail2(insSample.getStandardMethodListId(), 1, tree, insSample.getIsCableTag());
            if (list.size() == 0) {
                String tree1 = split[0] + " - " + split[1] + " - " + split[2] + " - null - " + split[3];
                list = standardProductListMapper.selectDetail2(insSample.getStandardMethodListId(), 1, tree1, insSample.getIsCableTag());
                // åªæœ‰å¯¹è±¡çš„一层
                if (list.size() == 0) {
                    String tree2 = split[0] + " - " + split[1] + " - " + split[2] + " - null - null";
                    list = standardProductListMapper.selectDetail2(insSample.getStandardMethodListId(), 1, tree2, insSample.getIsCableTag());
                    // æ ·å“ç›´æŽ¥èµ‹å€¼æ ·å“åˆ†ç±»
                    list.forEach(standardProductList -> standardProductList.setSample(standardProductList.getSampleType()));
                    isNoSample = true;
                }
            }
        }
        String[] split1 = insSample.getFactory().split(" - ");
        if (!isNoSample) {
            //判断长度
            if (split1.length > 4) {
                if (ObjectUtils.isNotEmpty(split1[3])) {
                    list = list.stream().filter(list1 -> Objects.nonNull(list1.getSample()) && Objects.equals(list1.getSample(), split1[3])).collect(Collectors.toList());
                } else if (split1[3].equals("")) {
                    list = list.stream().filter(list1 -> Objects.nonNull(list1.getSampleType()) && Objects.equals(list1.getSampleType(), split1[2])).collect(Collectors.toList());
                }
            }
        }
        list = list.stream().filter(a -> {
                    try {
                        if (a.getSection() != null && !Objects.equals(a.getSection(), "")) {
                            List<String> sections = JSON.parseArray(a.getSection(), String.class);// åŒºé—´
                            List<String> cores = JSON.parseArray(a.getCores(), String.class); // èŠ¯æ•°
                            List<String> conductorMaterials = JSON.parseArray(a.getConductorMaterial(), String.class); // å¯¼ä½“材质
                            List<String> conductorTypes = JSON.parseArray(a.getConductorType(), String.class); // å¯¼ä½“类型
                            List<String> asks = JSON.parseArray(a.getAsk(), String.class);
                            List<String> tells = JSON.parseArray(a.getTell(), String.class);
                            boolean isIf;
                            for (int i = 0; i < sections.size(); i++) {
                                if (Objects.equals(a.getBsm(), "1")) {
                                    return true;
                                } else {
                                    if (sections.get(i).contains("&")) {
                                        String[] split = sections.get(i).split("&");
                                        isIf = getIsIf(split[0], modelNum, cores.get(i), conductorMaterials.get(i), conductorTypes.get(i), insSample)
                                                && getIsIf(split[1], modelNum, cores.get(i), conductorMaterials.get(i), conductorTypes.get(i), insSample);
                                    } else {
                                        isIf = getIsIf(sections.get(i), modelNum, cores.get(i), conductorMaterials.get(i), conductorTypes.get(i), insSample);
                                    }
                                    if (isIf) {
                                        a.setSection(sections.get(i));
                                        a.setAsk(asks.get(i));
                                        a.setTell(tells.get(i));
                                        return true;
                                    }
                                }
                            }
                            return false;
                        }
                    } catch (Exception ignored) {
                        return false;
                    }
                    return true;
                }).peek(standardProductList -> {
                    // todo: åˆ¤æ–­æ˜¯å¦æ˜¯åŽŸæä¸‹å•, éœ€è¦å•ŠæŠŠé¢œè‰²ç»‘å®šåˆ°è¯•æ ·é¢œè‰²çš„è¦æ±‚å€¼ä¸Š
                    if (StringUtils.isNotBlank(insSample.getPartNo())) {
                        // åˆ¤æ–­æ˜¯å¦æœ‰è¿™ä¸ªå­—段且是文本类型
                        if (StringUtils.isNotBlank(standardProductList.getInspectionItem())
                                && standardProductList.getInspectionItem().contains("试样颜色")) {
                            Map<String, String> partColor = baseMapper.selectPartColor(insSample.getPartNo());
                            if (CollectionUtils.isNotEmpty(partColor)) {
                                if (StringUtils.isNotBlank(partColor.get("color"))) {
                                    // åˆ¤æ–­æ£€éªŒå€¼æ˜¯å¦ä¸ºç©ºå’Œä¸ç­‰äºŽ -  å’Œ /
                                    if (StringUtils.isBlank(standardProductList.getAsk()) || partColor.get("color").contains("本")) { // æ²¡æœ‰ask直接复制
                                        // æŸ¥è¯¢å¯¹è±¡ç»‘定表和产品绑定表
                                        standardProductList.setAsk("=" + partColor.get("color")
                                                + (StringUtils.isBlank(partColor.get("color_code")) ? "" : "(" + partColor.get("color_code") + ")"));
                                        standardProductList.setTell(partColor.get("color")
                                                + (StringUtils.isBlank(partColor.get("color_code")) ? "" : "(" + partColor.get("color_code") + ")"));
                                        standardProductList.setInspectionValueType("2");
                                    } else { // æ‹¼æŽ¥åˆ°è¦æ±‚描述前面
                                        standardProductList.setTell(partColor.get("color")
                                                + (StringUtils.isBlank(partColor.get("color_code")) ? "" : "(" + partColor.get("color_code") + ")") + "@" + standardProductList.getTell());
                                    }
                                }
                            }
                        }
                    }
                })
                .collect(Collectors.toList());
        // æŸ¥è¯¢åŽ‚å®¶æ˜¯å¦æœ‰ç‰¹æ®Šè¦æ±‚å€¼
        if (insSample.getIfsInventoryId() != null) {
            // æŸ¥è¯¢åŽŸææ–™åŽ‚å®¶åç§°
            String supplierName = ifsInventoryQuantityMapper.selectById(insSample.getIfsInventoryId())
                    .getSupplierName();
            List<Long> collect = list.stream().map(StandardProductList::getId).collect(Collectors.toList());
            if (CollectionUtils.isNotEmpty(collect)) {
                List<StandardProductListSupplierAsk> supplierAsks = standardProductListSupplierAskMapper.selectList(Wrappers.<StandardProductListSupplierAsk>lambdaQuery()
                        .in(StandardProductListSupplierAsk::getProductListId, collect)
                        .eq(StandardProductListSupplierAsk::getSupplierName, supplierName));
                // åˆ¤æ–­æœ‰æ²¡æœ‰ç‰¹æ®Šå€¼ç»‘定
                if (CollectionUtils.isNotEmpty(supplierAsks)) {
                    for (StandardProductList standardProductList : list) {
                        for (StandardProductListSupplierAsk supplierAsk : supplierAsks) {
                            if (standardProductList.getId().equals(supplierAsk.getProductListId())) {
                                // é‡æ–°èµ‹å€¼è¦æ±‚值和要求描述
                                standardProductList.setAsk(supplierAsk.getAsk());
                                standardProductList.setTell(supplierAsk.getTell());
                            }
                        }
                    }
                }
            }
        }
        return list;
    }
    /**
     *
     * @param str                 åˆ¤å®šå…¬å¼
     * @param model               åž‹å·
     * @param standardCores       èŠ¯æ•°
     * @param conductorMaterial   å¯¼ä½“材质
     * @param conductorType       å¯¼ä½“类型
     * @param insSample
     * @return
     */
    private boolean getIsIf(String str, String model, String standardCores, String conductorMaterial, String conductorType,InsSampleReceiveDto insSample) {
        Matcher matcher = Pattern.compile("\\d+(\\.\\d+)?").matcher(model);
        String model2 = "";
        while (matcher.find()) {
            model2 += matcher.group();
            break;
        }
        boolean flag = false;
        if (str.contains("≥") || str.contains(">=")) {
            String param = str.replace("≥", "").replace(">=", "");
            flag = new BigDecimal(model2).compareTo(new BigDecimal(param)) > -1;
        } else if (str.contains("≤") || str.contains("<=")) {
            String param = str.replace("≤", "").replace("<=", "");
            flag = new BigDecimal(model2).compareTo(new BigDecimal(param)) < 1;
        } else if (str.contains(">") || str.contains(">")) {
            String param = str.replace(">", "").replace(">", "");
            flag = new BigDecimal(model2).compareTo(new BigDecimal(param)) > 0;
        } else if (str.contains("<") || str.contains("<")) {
            String param = str.replace("<", "").replace("<", "");
            flag = new BigDecimal(model2).compareTo(new BigDecimal(param)) < 0;
        } else if (str.contains("=")) {
            String param = str.replace("=", "");
            flag = new BigDecimal(model2).compareTo(new BigDecimal(param)) == 0;
        }
        if (flag) {
            boolean coresMatch = true;
            boolean conductorMaterialMatch = true;
            boolean conductorTypeMatch = true;
            // åˆ¤æ–­æ˜¯å¦æœ‰çº¿èŠ¯æ•°é‡
            if (StringUtils.isNotBlank(standardCores)) {
                if (StringUtils.isBlank(insSample.getCores()) || !standardCores.equals(insSample.getCores())) {
                    coresMatch = false;
                }
            }
            // åˆ¤æ–­æ˜¯å¦æœ‰å¯¼ä½“材质
            if (StringUtils.isNotBlank(conductorMaterial)) {
                if (StringUtils.isBlank(insSample.getConductorMaterial()) || !conductorMaterial.equals(insSample.getConductorMaterial())) {
                    conductorMaterialMatch = false;
                }
            }
            // åˆ¤æ–­æ˜¯å¦æœ‰å¯¼ä½“类型
            if (StringUtils.isNotBlank(conductorType)) {
                if (StringUtils.isBlank(insSample.getConductorType()) || !conductorType.equals(insSample.getConductorType())) {
                    conductorTypeMatch = false;
                }
            }
            // æœ€ç»ˆåˆ¤æ–­
            flag = coresMatch && conductorMaterialMatch && conductorTypeMatch;
        }
        return flag;
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public Map<String, Object> selectStandardProductListByMethodId(Integer id, String tree, Integer page) {
        String[] trees = tree.split(" - ");
        try {
            String tree1 = trees[2];
        } catch (Exception e) {
            throw new BaseException("操作太快,系统传参错误!!!!");
        }
        boolean isDrag = false;
        List<StandardProductList> list = new ArrayList<>();
        if (trees.length == 3) {
            List<StandardTree> treeList = new ArrayList<>();
            StandardTree standardTree = new StandardTree();
            standardTree.setFactory(trees[0]);
            standardTree.setLaboratory(trees[1]);
            standardTree.setSampleType(trees[2]);
            List<ProductDto> pList = standardTreeMapper.selectPList(trees[2]);
            if (pList.size() == 0 || pList.get(0) == null) {
                List<StandardTree> treeList1 = standardTreeMapper.selectList(Wrappers.<StandardTree>lambdaQuery().eq(StandardTree::getLaboratory, trees[1]).eq(StandardTree::getSampleType, trees[2]));
                if (treeList1.size() == 0) {
                    treeList.add(standardTree);
                } else {
                    treeList.addAll(treeList1);
                }
            } else {
                for (ProductDto p : pList) {
                    standardTree.setSample(p.getName());
                    List<StandardTree> treeList1 = standardTreeMapper.selectList(Wrappers.<StandardTree>lambdaQuery().eq(StandardTree::getLaboratory, trees[1]).eq(StandardTree::getSampleType, trees[2]).eq(StandardTree::getSample, p.getName()));
                    if (treeList1.size() == 0) {
                        treeList.add(JSON.parseObject(JSON.toJSONString(standardTree), StandardTree.class));
                    } else {
                        treeList.addAll(treeList1);
                    }
                }
            }
            for (StandardTree standardTree2 : treeList) {
                String tree2 = trees[0] + " - " + trees[1] + " - " + trees[2] + " - " + standardTree2.getSample() + " - " + standardTree2.getModel();
                list.addAll(standardTreeMapper.selectStandardProductListByTree("\"" + trees[2] + "\"", standardTree2.getSample(), standardTree2.getModel(), tree2, trees[1]));
                list.addAll(standardTreeMapper.selectStandardProductListByTree2("\"" + trees[2] + "\",\"" + standardTree2.getSample() + "\"", standardTree2.getSample(), standardTree2.getModel(), tree2, trees[1]));
            }
        } else if (trees.length == 4) {
            // åˆ¤æ–­ç¬¬å››å±‚是否有型号
            Long count = standardProductListMapper.selectCount(Wrappers.<StandardProductList>lambdaQuery()
                    .eq(StandardProductList::getStandardMethodListId, id)
                    .isNull(StandardProductList::getModel)
                    .like(StandardProductList::getTree, tree));
            if (count == 0) {
                isDrag = true;
            }
            isDrag = true;
            List<StandardTree> treeList = standardTreeMapper.selectList(Wrappers.<StandardTree>lambdaQuery().eq(StandardTree::getLaboratory, trees[1]).eq(StandardTree::getSampleType, trees[2]).eq(StandardTree::getSample, trees[3]));
            if (treeList.size() == 0) {
                StandardTree standardTree = new StandardTree();
                standardTree.setFactory(trees[0]);
                standardTree.setLaboratory(trees[1]);
                standardTree.setSampleType(trees[2]);
                standardTree.setSample(trees[3]);
                treeList.add(standardTree);
            }
            for (StandardTree standardTree : treeList) {
                String str = tree + " - " + standardTree.getModel();
                list.addAll(standardTreeMapper.selectStandardProductListByTree("\"" + trees[2] + "\"", standardTree.getSample(), standardTree.getModel(), str, trees[1]));
                list.addAll(standardTreeMapper.selectStandardProductListByTree2("\"" + trees[2] + "\",\"" + trees[3] + "\"", standardTree.getSample(), standardTree.getModel(), str, trees[1]));
            }
        } else {
            isDrag = true;
            list.addAll(standardTreeMapper.selectStandardProductListByTree("\"" + trees[2] + "\"", trees[3].equals("null") ? null : trees[3], trees[4], tree, trees[1]));
            list.addAll(standardTreeMapper.selectStandardProductListByTree2("\"" + trees[2] + "\",\"" + trees[3] + "\"", trees[3].equals("null") ? null : trees[3], trees[4], tree, trees[1]));
        }
        for (StandardProductList productList : list) {
            productList.setId(IdWorker.getId());
        }
        List<StandardProductList> standardProductLists;
        if (isDrag) {
            standardProductLists = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery()
                    .eq(StandardProductList::getStandardMethodListId, id)
                    .like(StandardProductList::getTree, tree)
                    .orderByAsc(StandardProductList::getSort));
            // åˆ¤æ–­æ˜¯å¦æœ‰æ²¡æœ‰åºå·çš„, æ²¡æœ‰åºå·é‡ç½®
            boolean b = standardProductLists.stream().anyMatch(standardProductList -> standardProductList.getSort() == null);
        } else {
            standardProductLists = standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery()
                    .eq(StandardProductList::getStandardMethodListId, id)
                    .like(StandardProductList::getTree, tree));
        }
        for (StandardProductList sp : standardProductLists) {
            for (StandardProductList pl : list) {
                // åˆ¤æ–­æ¡ä»¶æ˜¯å¦åªæœ‰ä¸€ä¸ª, æœ‰ä¸€ä¸ªçš„话默认第一个
                String radiusList = pl.getRadiusList();
                if (StringUtils.isNotBlank(radiusList) && !radiusList.equals("null") && !radiusList.equals("\"\"")) {
                    JSONArray jsonArray = JSON.parseArray(radiusList);
                    List<String> radius = jsonArray.toJavaList(String.class);
                    if (CollectionUtils.isNotEmpty(radius) && radius.size() == 1) {
                        pl.setRadius(radius.get(0));
                    }
                }
                if (Objects.equals(sp.getInspectionItem(), pl.getInspectionItem())
                        && Objects.equals((sp.getInspectionItemSubclass() == null) ? "" : sp.getInspectionItemSubclass(), pl.getInspectionItemSubclass() == null ? "" : pl.getInspectionItemSubclass())
//                        && Objects.equals(sp.getSample(), pl.getSample())
                        && Objects.equals(sp.getModel(), pl.getModel())
                        && sp.getTree().indexOf(pl.getSample() == null ? "null" : pl.getSample()) > -1
                        && Objects.equals(sp.getStructureItemParameterId(), pl.getStructureItemParameterId())) {
                    pl.setId(sp.getId());
                    // æ·»åŠ æŽ’åºå­—æ®µ
                    pl.setSort(sp.getSort());
                    if (sp.getState() != null && !sp.getState().equals("")) {
                        pl.setState(sp.getState());
                    } else {
                        pl.setState(id == 0 ? 1 : 0);
                    }
                    if (sp.getMethodS() != null && !sp.getMethodS().equals("")) {
                        pl.setMethod(sp.getMethodS());
                    }
                    if (sp.getRadius() != null && !sp.getRadius().equals("")) {
                        pl.setRadius(sp.getRadius());
                    }
                    if (sp.getRates() != null && !sp.getRates().equals("")) {
                        pl.setRates(sp.getRates());
                    }
                    if (sp.getAsk() != null && !sp.getAsk().equals("")) {
                        pl.setAsk(sp.getAsk());
                    }
                    if (sp.getTell() != null && !sp.getTell().equals("")) {
                        pl.setTell(sp.getTell());
                    }
                    if (sp.getPrice() != null && !sp.getPrice().equals("")) {
                        pl.setPrice(sp.getPrice());
                    }
                    if (sp.getManHour() != null && !sp.getManHour().equals("")) {
                        pl.setManHour(sp.getManHour());
                    }
                    if (sp.getSection() != null && !sp.getSection().equals("")) {
                        pl.setSection(sp.getSection());
                    }
                    if (sp.getCores() != null && !sp.getCores().equals("")) {
                        pl.setCores(sp.getCores());
                    }
                    if (sp.getConductorMaterial() != null && !sp.getConductorMaterial().equals("")) {
                        pl.setConductorMaterial(sp.getConductorMaterial());
                    }
                    if (sp.getConductorType() != null && !sp.getConductorType().equals("")) {
                        pl.setConductorType(sp.getConductorType());
                    }
                    if (sp.getTemplateId() != null && !sp.getTemplateId().equals("")) {
                        pl.setTemplateId(sp.getTemplateId());
                    }
                    //因为还有个产品叫耐张线夹 æŽ¥ç»­é‡‘å…· ,这两个项目的数据完全一样,特殊处理
                    if (sp.getTree() != null && !sp.getTree().equals("") && !pl.getTree().equals("中天科技检测中心 - ç”µåŠ›äº§å“å®žéªŒå®¤ - é‡‘å…· - è€å¼ çº¿å¤¹ - null")) {
                        pl.setTree(sp.getTree());
                    }
                    break;
                }
            }
        }
        if (page == 1) {
            Integer userId = SecurityUtils.getUserId().intValue();
//            CompletableFuture.supplyAsync(() -> {
            if (trees.length == 5) {
                standardProductListMapper.delete(Wrappers.<StandardProductList>lambdaUpdate()
                        .eq(StandardProductList::getStandardMethodListId, id)
                        .eq(StandardProductList::getTree, tree));
            } else {
                standardProductListMapper.delete(Wrappers.<StandardProductList>lambdaUpdate()
                        .eq(StandardProductList::getStandardMethodListId, id)
                        .like(StandardProductList::getTree, tree));
            }
            boolean success = false;
            int retryCount = 0;
            while (!success && retryCount < 100) {
                try {
                    standardProductListService2.saveBatch(list.stream().map(a -> {
                        a.setFactory(trees[0]);
                        a.setLaboratory(trees[1]);
                        a.setSampleType(trees[2]);
                        a.setCreateUser(userId);
                        a.setUpdateUser(userId);
                        a.setStandardMethodListId(id);
                        return a;
                    }).collect(Collectors.toList()));
                    ;
                    success = true;
                } catch (Exception e) {
                    // å¤„理重复 ID çš„记录,重新生成 ID å¹¶ç»§ç»­å°è¯•插入
                    for (StandardProductList productList : list) {
                        productList.setId(IdWorker.getId());
                    }
                }
            }
            if (!success) {
                throw new RuntimeException("插入失败");
            }
        }
        Map<String, Object> map = new HashMap<>();
        Collections.sort(list, (o1, o2) -> {
            String field1 = o1.getManHourGroup();
            String field2 = o2.getManHourGroup();
            boolean isEmpty1 = field1 == null || field1.isEmpty();
            boolean isEmpty2 = field2 == null || field2.isEmpty();
            if (isEmpty1 && isEmpty2) {
                return 0;
            } else if (isEmpty1) {
                return 1;
            } else if (isEmpty2) {
                return -1;
            } else {
                int num1 = extractNumber(field1);
                int num2 = extractNumber(field2);
                return Integer.compare(num1, num2);
            }
        });
          // æŒ‰ç…§ç´¢å¼•排序
        if (isDrag) {
            list.sort((o1, o2) -> (o1.getSort() == null ? 0 : o1.getSort())
                    - (o2.getSort() == null ? 0 : o2.getSort()));
        }
        try {
            map.put("productList", list.subList((page - 1) * 300, page * 300));
        } catch (IndexOutOfBoundsException e) {
            map.put("productList", list.subList((page - 1) * 300, list.size()));
        }
        map.put("total", list.size());
        return map;
    }
    private int extractNumber(String s) {
        // ä»Žå­—符串中提取数字的逻辑,这里假设字段的格式是 "text<number>"
        String number = s;
        if (!s.matches("\\d+")) {
            number = s.replaceAll("\\D", "");
        }
        return Integer.parseInt(number);
    }
    @Override
    public IPage<StandardProductList> selectStandardProductByMethodId(Integer id, String tree, Integer page, String laboratory, String item, String items) {
        IPage<StandardProductList> iPage = new Page<>();
        iPage.setSize(100);
        iPage.setCurrent(page);
        return standardProductListMapper.standardProductListIPage(id, tree, iPage, laboratory, item, items);
    }
    @Override
    public Map<String, List<?>> selectStandardProductEnumByMethodId(Integer id, String tree, String item) {
        HashMap<String, List<?>> map = new HashMap<>();
        map.put("item", standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery()
                .eq(StandardProductList::getStandardMethodListId, id)
                .like(StandardProductList::getTree, tree)
                .select(StandardProductList::getInspectionItem)
                .groupBy(StandardProductList::getInspectionItem)));
        if (ObjectUtils.isNotEmpty(item)) {
            map.put("items", standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery()
                    .eq(StandardProductList::getStandardMethodListId, id)
                    .eq(StandardProductList::getInspectionItem, item)
                    .like(StandardProductList::getTree, tree)
                    .select(StandardProductList::getInspectionItemSubclass)
                    .groupBy(StandardProductList::getInspectionItemSubclass)));
        } else {
            map.put("items", standardProductListMapper.selectList(Wrappers.<StandardProductList>lambdaQuery()
                    .eq(StandardProductList::getStandardMethodListId, id)
                    .like(StandardProductList::getTree, tree)
                    .select(StandardProductList::getInspectionItemSubclass)
                    .groupBy(StandardProductList::getInspectionItemSubclass)));
        }
        return map;
    }
    /**
     * ä¿®æ”¹æ ‡å‡†åº“区间
     * @param list
     * @return
     */
    @Override
    public boolean updateSection(StandardProductList list) {
        standardProductListMapper.updateSection(list);
        return true;
    }
    /**
     * æ ‡å‡†åº“拖拽
     * @param resetTreeDragDTO
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void resetTreeDrag(ResetTreeDragDTO resetTreeDragDTO) {
        Integer beginIndex = Integer.parseInt(resetTreeDragDTO.getBeginIndex());
        Integer endIndex = Integer.parseInt(resetTreeDragDTO.getEndIndex());
        Integer methodId = Integer.parseInt(resetTreeDragDTO.getMethodId());
        Long productionId = Long.parseLong(resetTreeDragDTO.getProductionId());
        // åˆ¤æ–­æ˜¯ä»Žä¸Šå¾€ä¸‹æ‹–拽还是从下往上放拖拽
        // ä»Žä¸Šå¾€ä¸‹
        if (beginIndex < endIndex) {
            standardProductListMapper.updateSortUp(beginIndex,
                    endIndex,
                    methodId,
                    resetTreeDragDTO.getTree());
            // ä»Žä¸‹å¾€ä¸Š
        } else if (beginIndex > endIndex){
            standardProductListMapper.updateSortDown(beginIndex,
                    endIndex,
                    methodId,
                    resetTreeDragDTO.getTree());
        } else {
            return;
        }
        // ä¿®æ”¹æ ‡å‡†åº“项顺序
        standardProductListMapper.update(null, Wrappers.<StandardProductList>lambdaUpdate()
                .eq(StandardProductList::getId, productionId)
                .set(StandardProductList::getSort, endIndex));
    }
    @Override
    public void resetTreeDragBatch(List<StandardProductList> standardProductLists) {
        standardProductListService2.updateBatchById(standardProductLists);
    }
    /**
     * æ£€éªŒé¡¹è¦æ±‚值对比
     * @param copyDto
     * @return
     */
    @Override
    public List<StandardProductList> copyStandardProductList(CopyStandardProductListDto copyDto) {
        List<StandardProductList> productLists = new ArrayList<>();
        // å¯¹æ¯”检验项一样的填充要求值要求描述
        for (StandardProductList oldProductList : copyDto.getOldStandardProductList()) {
            String oldItemName = oldProductList.getInspectionItemClassEn()
                    + oldProductList.getInspectionItem()
                    + oldProductList.getInspectionItemSubclass();
            for (StandardProductList newProductList : copyDto.getNewStandardProductList()) {
                String newItemName = newProductList.getInspectionItemClassEn()
                        + newProductList.getInspectionItem()
                        + newProductList.getInspectionItemSubclass();
                // åˆ¤æ–­åç§°æ˜¯å¦ä¸€æ ·
                if (oldItemName.equals(newItemName)) {
                    // åŒºé—´
                    oldProductList.setSection(newProductList.getSection());
                    // èŠ¯æ•°
                    oldProductList.setCores(newProductList.getCores());
                    // è¦æ±‚值
                    oldProductList.setAsk(newProductList.getAsk());
                    // è¦æ±‚描述
                    oldProductList.setTell(newProductList.getTell());
                    // å•ä»·
                    oldProductList.setPrice(newProductList.getPrice());
                    // å·¥æ—¶åˆ†ç»„
                    oldProductList.setManHour(newProductList.getManHour());
                    // å¯¼ä½“材质
                    oldProductList.setConductorMaterial(newProductList.getConductorMaterial());
                    // å¯¼ä½“类型
                    oldProductList.setConductorType(newProductList.getConductorType());
                    productLists.add(oldProductList);
                }
            }
        }
        return productLists;
    }
    /**
     * æ£€éªŒé¡¹å¤åˆ¶å¯¹æ¯”一个
     * @param dto
     * @return
     */
    @Override
    public List<StandardProductList> copyStandardProductOne(CopyStandardProductListDto dto) {
        if (CollectionUtils.isEmpty(dto.getNewStandardProductList()) && dto.getNewStandardProductList().size() == 1 &&
                CollectionUtils.isEmpty(dto.getOldStandardProductList()) && dto.getOldStandardProductList().size() == 1) {
            throw new BaseException("需要对比的检验项请选择一个");
        }
        StandardProductList newProductList = dto.getNewStandardProductList().get(0);
        StandardProductList oldProductList = dto.getOldStandardProductList().get(0);
        // åŒºé—´
        oldProductList.setSection(newProductList.getSection());
        // èŠ¯æ•°
        oldProductList.setCores(newProductList.getCores());
        // è¦æ±‚值
        oldProductList.setAsk(newProductList.getAsk());
        // è¦æ±‚描述
        oldProductList.setTell(newProductList.getTell());
        // å•ä»·
        oldProductList.setPrice(newProductList.getPrice());
        // å·¥æ—¶åˆ†ç»„
        oldProductList.setManHour(newProductList.getManHour());
        // å¯¼ä½“材质
        oldProductList.setConductorMaterial(newProductList.getConductorMaterial());
        // å¯¼ä½“类型
        oldProductList.setConductorType(newProductList.getConductorType());
        List<StandardProductList> productLists = new ArrayList<>();
        productLists.add(oldProductList);
        return productLists;
    }
    /**
     * æ£€éªŒé¡¹å¤åˆ¶æŽ’序
     * @param copyDto
     * @return
     */
    @Override
    public boolean copyStandardProductSort(CopyStandardProductListDto copyDto) {
        List<StandardProductList> productLists = new ArrayList<>();
        // å¯¹æ¯”检验项一样的填充要求值要求描述
        for (StandardProductList oldProductList : copyDto.getOldStandardProductList()) {
            String oldItemName = oldProductList.getInspectionItemClassEn()
                    + oldProductList.getInspectionItem()
                    + oldProductList.getInspectionItemSubclass();
            for (StandardProductList newProductList : copyDto.getNewStandardProductList()) {
                String newItemName = newProductList.getInspectionItemClassEn()
                        + newProductList.getInspectionItem()
                        + newProductList.getInspectionItemSubclass();
                // åˆ¤æ–­åç§°æ˜¯å¦ä¸€æ ·
                if (oldItemName.equals(newItemName)) {
                    StandardProductList standardProductList = new StandardProductList();
                    standardProductList.setId(oldProductList.getId());
                    // å¤åˆ¶æŽ’序
                    standardProductList.setSort(newProductList.getSort());
                    productLists.add(standardProductList);
                }
            }
        }
        this.updateBatchById(productLists);
        return false;
    }
}
basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardProductListSupplierAskServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,79 @@
package com.ruoyi.basic.service.impl;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.exception.base.BaseException;
import com.ruoyi.basic.mapper.StandardProductListSupplierAskMapper;
import com.ruoyi.basic.pojo.StandardProductListSupplierAsk;
import com.ruoyi.basic.service.StandardProductListSupplierAskService;
import org.springframework.stereotype.Service;
import java.util.List;
/**
 * æ£€éªŒé¡¹ç›®åŽ‚å®¶å¯†åº¦ç»‘å®šè¡¨
 *
 * @author zhuo
 * @since 2024-09-23
 */
@Service
public class StandardProductListSupplierAskServiceImpl extends ServiceImpl<StandardProductListSupplierAskMapper, StandardProductListSupplierAsk> implements StandardProductListSupplierAskService {
    /**
     * æŸ¥è¯¢åŽ‚å®¶è¦æ±‚å€¼ç»‘å®š
     * @param supplierAsk
     * @return
     */
    @Override
    public List<StandardProductListSupplierAsk> selectByProductId(StandardProductListSupplierAsk supplierAsk) {
        if (supplierAsk.getProductListId() == null) {
            throw new BaseException("缺少检验项id");
        }
        return baseMapper.selectList(Wrappers.<StandardProductListSupplierAsk>lambdaQuery()
                .eq(StandardProductListSupplierAsk::getProductListId, supplierAsk.getProductListId()));
    }
    /**
     * æ–°å¢žåŽ‚å®¶è¦æ±‚å€¼ç»‘å®š
     * @param supplierAsk
     * @return
     */
    @Override
    public Integer addProductSupplierAsk(StandardProductListSupplierAsk supplierAsk) {
        if (supplierAsk.getProductListId() == null) {
            throw new BaseException("缺少产品对象id");
        }
        // æŸ¥è¯¢æ”¹åŽ‚å®¶æ˜¯å¦ç»‘å®šè¿‡
        Long count = baseMapper.selectCount(Wrappers.<StandardProductListSupplierAsk>lambdaQuery()
                .eq(StandardProductListSupplierAsk::getProductListId, supplierAsk.getProductListId())
                .eq(StandardProductListSupplierAsk::getSupplierName, supplierAsk.getSupplierName()));
        if (count > 0){
            throw new BaseException("该产品已绑定过该厂家");
        }
        baseMapper.insert(supplierAsk);
        return supplierAsk.getSupplierAskId();
    }
    /**
     * ä¿®æ”¹åŽ‚å®¶è¦æ±‚å€¼ç»‘å®š
     * @param supplierAsk
     * @return
     */
    @Override
    public Integer updateProductSupplierAsk(StandardProductListSupplierAsk supplierAsk) {
        if (supplierAsk.getProductListId() == null) {
            throw new BaseException("缺少检验项id");
        }
        // æŸ¥è¯¢æ”¹åŽ‚å®¶æ˜¯å¦ç»‘å®šè¿‡
        Long count = baseMapper.selectCount(Wrappers.<StandardProductListSupplierAsk>lambdaQuery()
                .ne(StandardProductListSupplierAsk::getSupplierAskId, supplierAsk.getSupplierAskId())
                .eq(StandardProductListSupplierAsk::getProductListId, supplierAsk.getProductListId())
                .eq(StandardProductListSupplierAsk::getSupplierName, supplierAsk.getSupplierName()));
        if (count > 0){
            throw new BaseException("该检验项已绑定过该厂家");
        }
        baseMapper.updateById(supplierAsk);
        return supplierAsk.getSupplierAskId();
    }
}
basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardTemplateServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,130 @@
package com.ruoyi.basic.service.impl;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.numgen.NumberGenerator;
import com.ruoyi.common.utils.QueryWrappers;
import com.ruoyi.basic.mapper.StandardTemplateMapper;
import com.ruoyi.basic.pojo.StandardTemplate;
import com.ruoyi.basic.service.StandardTemplateService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
* @author Administrator
* @description é’ˆå¯¹è¡¨ã€standard_template(标准模板)】的数据库操作Service实现
* @createDate 2024-03-11 13:47:52
*/
@Service
@AllArgsConstructor
public class StandardTemplateServiceImpl extends ServiceImpl<StandardTemplateMapper, StandardTemplate>
    implements StandardTemplateService{
    private StandardTemplateMapper standardTemplateMapper;
    private final NumberGenerator<StandardTemplate> numberGenerator;
    @Override
    public IPage<StandardTemplate> selectStandardTemplatePageList(Page page, StandardTemplate standardTemplate) {
        return standardTemplateMapper.selectStandardTemplatePageList(page, QueryWrappers.queryWrappers(standardTemplate));
    }
    @Override
    public int addStandardTemplate(StandardTemplate standardTemplate) {
        if (StringUtils.isBlank(standardTemplate.getNumber())) {
            String giveCode = numberGenerator.generateNumberWithPrefix(5,
                    "MB" + DateUtil.format(new Date(), "yyMM"),
                    StandardTemplate::getNumber);
            standardTemplate.setNumber(giveCode);
        }
        return standardTemplateMapper.insert(standardTemplate);
    }
    @Override
    public int upStandardTemplate(StandardTemplate standardTemplate) {
        if(standardTemplate.getThing().equals("")){
            standardTemplate.setThing(null);
        }
        return standardTemplateMapper.updateById(standardTemplate);
    }
    @Override
    public int delStandardTemplate(Integer id) {
        return standardTemplateMapper.deleteById(id);
    }
    @Override
    public List<StandardTemplate> getStandardTemplate() {
        return standardTemplateMapper.selectList(Wrappers.<StandardTemplate>lambdaQuery().select(StandardTemplate::getId,StandardTemplate::getName));
    }
    @Override
    public String getStandTempThingById(Integer templateId) {
        StandardTemplate standardTemplate = standardTemplateMapper.selectOne(Wrappers.<StandardTemplate>lambdaQuery()
                .eq(StandardTemplate::getId, templateId)
                .select(StandardTemplate::getThing));
        if(standardTemplate==null){
            return null;
        }else{
            return standardTemplate.getThing();
        }
        // æŸ¥è¯¢åŽ‹ç¼©åŽçš„æ•°æ®
//        String thing = standardTemplateMapper.selectCompressThing(templateId);
//        if (StringUtils.isNotBlank(thing)) {
//            try {
//                return DecompressMySQLData.decompress(java.util.Base64.getDecoder().decode(thing));
//            } catch (Exception e) {
//                throw new RuntimeException(e);
//            }
//        } else {
//            return null;
//        }
    }
    @Override
    public String getStandTempNameById(Integer templateId) {
        StandardTemplate standardTemplate = standardTemplateMapper.selectOne(Wrappers.<StandardTemplate>lambdaQuery()
                .eq(StandardTemplate::getId, templateId)
                .select(StandardTemplate::getName));
        if(standardTemplate==null){
            return null;
        }else{
            return standardTemplate.getName();
        }
    }
    @Override
    public StandardTemplate getStandTempIdByName(String name) {
        return standardTemplateMapper.getStandTempIdByName(name);
    }
    /**
     * å¤åˆ¶åŽŸå§‹è®°å½•æ¨¡æ¿
     * @param newTemplate
     * @return
     */
    @Override
    public int copyStandardTemplate(StandardTemplate newTemplate) {
        // æŸ¥è¯¢æ—§æ¨¡æ¿
        StandardTemplate standardTemplate = baseMapper.selectById(newTemplate.getId());
        newTemplate.setThing(standardTemplate.getThing());
        if (StringUtils.isBlank(newTemplate.getNumber())) {
            String giveCode = numberGenerator.generateNumberWithPrefix(5,
                    "MB" + DateUtil.format(new Date(), "yyMM"),
                    StandardTemplate::getNumber);
            newTemplate.setNumber(giveCode);
        }
        newTemplate.setId(null);
        return standardTemplateMapper.insert(newTemplate);
    }
}
basic-server/src/main/java/com/ruoyi/basic/service/impl/StandardTreeServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,535 @@
package com.ruoyi.basic.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.poi.excel.ExcelUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
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.common.exception.base.BaseException;
import com.ruoyi.basic.dto.FactoryDto;
import com.ruoyi.basic.dto.LaboratoryDto;
import com.ruoyi.basic.dto.SampleTypeDto;
import com.ruoyi.basic.mapper.StandardProductListMapper;
import com.ruoyi.basic.mapper.StandardTreeMapper;
import com.ruoyi.basic.pojo.StandardProductList;
import com.ruoyi.basic.pojo.StandardTemplate;
import com.ruoyi.basic.pojo.StandardTree;
import com.ruoyi.basic.pojo.StructureTestObject;
import com.ruoyi.basic.service.*;
import lombok.AllArgsConstructor;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicReference;
/**
 * @author Administrator
 * @description é’ˆå¯¹è¡¨ã€standard_tree(标准树)】的数据库操作Service实现
 * @createDate 2024-03-01 15:06:44
 */
@Service
@AllArgsConstructor
public class StandardTreeServiceImpl extends ServiceImpl<StandardTreeMapper, StandardTree>
        implements StandardTreeService {
    private StandardTreeMapper standardTreeMapper;
    private StandardMethodListService standardMethodListService;
    private StandardProductListMapper standardProductListMapper;
    private StandardProductListService standardProductListService;
    private StandardTemplateService standardTemplateService;
    private StructureTestObjectService structureTestObjectService;
    @Override
    public List<FactoryDto> selectStandardTreeList() {
        List<FactoryDto> factoryDtos = standardTreeMapper.selectStandardTreeList();
        for (FactoryDto factoryDto : factoryDtos) {
            for (LaboratoryDto laboratoryDto : factoryDto.getChildren()) {
                laboratoryDto.getChildren().sort((o1, o2) -> (o1.getSort() == null ? 0 : o1.getSort())
                        - (o2.getSort() == null ? 0 : o2.getSort()));
                for (SampleTypeDto sampleTypeDto : laboratoryDto.getChildren()) {
//                    if (sampleTypeDto.getChildren().size() == 0) {
                        sampleTypeDto.getChildren().addAll(standardTreeMapper.getStandardTree3(sampleTypeDto.getValue()));
//                    }
                }
            }
        }
        return factoryDtos;
    }
    @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());
        }
        StandardTree tree = standardTreeMapper.selectOne(wrapper);
        if (tree != null) {
            throw new BaseException("该型号已存在");
        }
        return standardTreeMapper.insert(standardTree);
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public int delStandardTree(String tree) {
        String[] trees = tree.split(" - ");
        switch (trees.length) {
            case 5:
                if (trees[3].equals("null")) {
                    standardTreeMapper.delete(Wrappers.<StandardTree>lambdaUpdate().eq(StandardTree::getFactory, trees[0]).eq(StandardTree::getLaboratory, trees[1]).eq(StandardTree::getSampleType, trees[2]).isNull(StandardTree::getSample).eq(StandardTree::getModel, trees[4]));
                } else {
                    standardTreeMapper.delete(Wrappers.<StandardTree>lambdaUpdate().eq(StandardTree::getFactory, trees[0]).eq(StandardTree::getLaboratory, trees[1]).eq(StandardTree::getSampleType, trees[2]).eq(StandardTree::getSample, trees[3]).eq(StandardTree::getModel, trees[4]));
                }
                break;
            /*case 4:
                standardTreeMapper.delete(Wrappers.<StandardTree>lambdaUpdate().eq(StandardTree::getFactory, trees[0]).eq(StandardTree::getLaboratory, trees[1]).eq(StandardTree::getSampleType, trees[2]).eq(StandardTree::getSample, trees[3]));
                break;
            case 3:
                standardTreeMapper.delete(Wrappers.<StandardTree>lambdaUpdate().eq(StandardTree::getFactory, trees[0]).eq(StandardTree::getLaboratory, trees[1]).eq(StandardTree::getSampleType, trees[2]));
                break;
            case 2:
                standardTreeMapper.delete(Wrappers.<StandardTree>lambdaUpdate().eq(StandardTree::getFactory, trees[0]).eq(StandardTree::getLaboratory, trees[1]));
                break;
            case 1:
                standardTreeMapper.delete(Wrappers.<StandardTree>lambdaUpdate().eq(StandardTree::getFactory, trees[0]));
                break;*/
        }
        return 1;
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public int addStandardProduct(String ids, String tree) {
        String[] trees = tree.split(" - ");
        JSONArray jsonArray = JSON.parseArray(ids);
        for (Object o : jsonArray) {
            StandardProductList standardProductList = standardTreeMapper.selectStandardProductById(Integer.parseInt("" + o));
            standardProductList.setFactory(trees[0]);
            try {
                standardProductList.setLaboratory(trees[1]);
            } catch (Exception e) {
            }
            try {
                standardProductList.setSampleType(trees[2]);
            } catch (Exception e) {
            }
            try {
                standardProductList.setSample(trees[3]);
            } catch (Exception e) {
            }
            try {
                standardProductList.setModel(trees[4]);
            } catch (Exception e) {
            }
            standardProductListMapper.insert(standardProductList);
        }
        return 1;
    }
    @Override
    public List<SampleTypeDto> getStandardTree2() {
        return standardTreeMapper.getStandardTree2();
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public int upStandardProducts(Map<String, Object> product) {
        List<Integer> ids = JSON.parseArray(product.get("ids") + "");
        StandardProductList productList = JSON.parseObject(JSON.toJSONString(product.get("standardProductList")), StandardProductList.class);
        if (productList.getMethodS() != null) {
            standardProductListMapper.update(productList, Wrappers.<StandardProductList>lambdaUpdate().in(StandardProductList::getId, ids).like(StandardProductList::getMethod, productList.getMethodS()));
            return 1;
        }
        if (productList.getRadiusList() != null) {
            standardProductListMapper.update(productList, Wrappers.<StandardProductList>lambdaUpdate().in(StandardProductList::getId, ids).like(StandardProductList::getRadiusList, productList.getRadius()));
            return 1;
        }
        standardProductListMapper.update(productList, Wrappers.<StandardProductList>lambdaUpdate().in(StandardProductList::getId, ids));
        return 1;
    }
    @Override
    public List<StandardTree> getStandTreeBySampleType(String laboratory, String sampleType) {
        return standardTreeMapper.selectList(Wrappers.<StandardTree>lambdaQuery()
                .eq(StandardTree::getLaboratory, laboratory)
                .eq(StandardTree::getSampleType, sampleType)
                .select(StandardTree::getModel, StandardTree::getSample));
    }
    /**
     * æ²³å£æ£€æµ‹ä¸­å¿ƒå¯¼å…¥
     * @param file
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void inExcelOfTree(MultipartFile file) {
        InputStream inputStream;
        try {
            inputStream = file.getInputStream();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        List<StandardProductList> lists = new ArrayList<>();
        AtomicReference<String> laboratory = new AtomicReference<>();
        ExcelUtil.readBySax(inputStream, 0, (i, l, list) -> {
            StandardProductList str = new StandardProductList();
            if (i == 0 && l == 1) {
                laboratory.set(standardTreeMapper.getLaboratory(list.get(1) + ""));
                if (laboratory.get() == null) {
                    throw new BaseException("检验对象不存在:" + list.get(1));
                }
            }
            if (i == 0 && l >= 1) {
                Integer standardMethodId = standardMethodListService.getStandardMethodId(list.get(0) + "");
                if (standardMethodId == null) {
                    throw new BaseException("标准编号不存在:" + list.get(0));
                }
                str.setStandardMethodListId(standardMethodId);
                str.setSampleType(list.get(1) + "");
                if (list.get(2) != null) {
                    String sample = baseMapper.selSample(list.get(2) + "");
                    if (sample == null) {
                        throw new BaseException("样品不存在:" + list.get(2));
                    }
                    str.setSample(list.get(2) + "");
                } else {
                    str.setSample(null);
                }
                if (list.get(3) != null) {
                    str.setModel(list.get(3) + "");
                    Long aLong = standardTreeMapper.selectCount(Wrappers.<StandardTree>lambdaQuery()
                            .eq(StandardTree::getModel, str.getModel())
                            .eq(StandardTree::getSampleType, list.get(1) + ""));
                    if (aLong == 0) {
                        StandardTree standardTree = new StandardTree();
                        standardTree.setFactory("中天科技检测中心");
                        standardTree.setLaboratory(laboratory.get());
                        standardTree.setSampleType(str.getSampleType());
                        standardTree.setSample(str.getSample());
                        standardTree.setModel(str.getModel());
                        standardTreeMapper.insert(standardTree);
                    }
                } else {
                    str.setModel(null);
                }
                str.setInspectionItem(list.get(4) + "");
                if (list.get(6) == null) {
                    str.setInspectionItemSubclass("");
                } else {
                    str.setInspectionItemSubclass(list.get(6).toString());
                }
                StandardProductList db_str;
                try {
                    db_str = standardProductListMapper.getOne(str.getStandardMethodListId(), str.getInspectionItem(), str.getSample(), str.getInspectionItemSubclass(), str.getModel(), str.getInspectionItemClass());
                } catch (Exception e) {
                    throw new BaseException("重复查询:" + str.getInspectionItem() + " " + str.getInspectionItemSubclass());
                }
                if (ObjectUtils.isNotEmpty(db_str)) {
                    str.setId(db_str.getId());
                    str.setStructureItemParameterId(db_str.getStructureItemParameterId());
                }
                if (list.get(8) != null) {
                    str.setMethodS(list.get(8) + "");
                }
                if (list.get(11) == null) {
                    str.setTell(null);
                } else {
                    str.setTell(list.get(11).toString());
                }
                if (list.get(12) == null) {
                    str.setAsk(null);
                } else {
                    str.setAsk(list.get(12).toString());
                }
                if (list.get(13) == null) {
                    str.setPrice(null);
                } else {
                    str.setPrice((list.get(13).toString()));
                }
                if (list.get(14) == null) {
                    str.setManHour(null);
                } else {
                    str.setManHour(list.get(14).toString());
                }
                StandardTemplate standTempIdByName = standardTemplateService.getStandTempIdByName(String.valueOf(list.get(21)));
                if (standTempIdByName != null) {
                    str.setTemplateId(standTempIdByName.getId());
                } else {
                    throw new BaseException("模板不存在:" + list.get(21));
                }
                str.setFactory("中天科技检测中心");
                str.setLaboratory(laboratory.get());
                str.setState(1);
                str.setTree(str.getFactory() + " - " + str.getLaboratory() + " - " + str.getSampleType() + " - " + str.getSample() + " - " + (str.getModel() == null ? "" : str.getModel()));
                try {
                    str.setStructureItemParameterId(standardTreeMapper.getStructureItemParameterId("\"" + str.getSampleType() + "\"", str.getInspectionItem(), str.getInspectionItemSubclass(), str.getInspectionItemClass()));
                } catch (Exception e) {
                    str.setStructureItemParameterId(standardTreeMapper.getStructureItemParameterId("\"" + str.getSampleType() + "\",\"" + str.getSample() + "\"", str.getInspectionItem(), str.getInspectionItemSubclass(), str.getInspectionItemClass()));
                }
                if (str.getStructureItemParameterId() == null) {
                    throw new BaseException("检验项目不存在:" + str.getInspectionItem() + " " + str.getInspectionItemSubclass());
                }
                lists.add(str);
            }
        });
        lists.forEach(a -> {
            if (a.getId() != null) {
                standardProductListMapper.updateById(a);
            } else {
                standardProductListMapper.insert(a);
            }
        });
    }
    @Override
    public void importWorkstationExcel(MultipartFile file) {
        InputStream inputStream;
        try {
            inputStream = file.getInputStream();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        List<StandardProductList> lists = new ArrayList<>();
        AtomicReference<String> laboratory = new AtomicReference<>();
        ExcelUtil.readBySax(inputStream, 0, (i, l, list) -> {
            StandardProductList str = new StandardProductList();
            if (i == 0 && l == 1) {
                laboratory.set(standardTreeMapper.getLaboratory(list.get(1) + ""));
                if (laboratory.get() == null) {
                    throw new BaseException("检验对象不存在:" + list.get(1));
                }
            }
            if (i == 0 && l >= 1) {
                Integer standardMethodId = standardMethodListService.getStandardMethodId(list.get(0) + "");
                if (standardMethodId == null) {
                    throw new BaseException("标准编号不存在:" + list.get(0));
                }
                str.setStandardMethodListId(standardMethodId);
                str.setSampleType(list.get(1) + "");
                if (list.get(2) != null) {
                    String sample = baseMapper.selSample(list.get(2) + "");
                    if (sample == null) {
                        throw new BaseException("样品不存在:" + list.get(2));
                    }
                    str.setSample(list.get(2) + "");
                } else {
                    str.setSample(null);
                }
                if (list.get(3) != null) {
                    str.setModel(list.get(3) + "");
                    Long aLong = standardTreeMapper.selectCount(Wrappers.<StandardTree>lambdaQuery()
                            .eq(StandardTree::getModel, str.getModel())
                            .eq(StandardTree::getSampleType, list.get(1) + ""));
                    if (aLong == 0) {
                        StandardTree standardTree = new StandardTree();
                        standardTree.setFactory("中天科技检测中心");
                        standardTree.setLaboratory(laboratory.get());
                        standardTree.setSampleType(str.getSampleType());
                        standardTree.setSample(str.getSample());
                        standardTree.setModel(str.getModel());
                        standardTreeMapper.insert(standardTree);
                    }
                } else {
                    str.setModel(null);
                }
                str.setInspectionItemClass(list.get(4).toString());
                str.setInspectionItemClassEn(list.get(5).toString());
                // å¼€å§‹åŠ 2
                str.setInspectionItem(list.get(6) + "");
                if (list.get(8) == null) {
                    str.setInspectionItemSubclass("");
                } else {
                    str.setInspectionItemSubclass(list.get(8).toString());
                }
                StandardProductList db_str;
                try {
                    db_str = standardProductListMapper.getOne(str.getStandardMethodListId(), str.getInspectionItem(), str.getSample(), str.getInspectionItemSubclass(), str.getModel(), str.getInspectionItemClass());
                } catch (Exception e) {
                    throw new BaseException("重复查询:" + str.getInspectionItem() + " " + str.getInspectionItemSubclass());
                }
                if (ObjectUtils.isNotEmpty(db_str)) {
                    str.setId(db_str.getId());
                    str.setStructureItemParameterId(db_str.getStructureItemParameterId());
                }
                if (list.get(10) != null) {
                    str.setMethodS(list.get(10) + "");
                }
                if (list.get(13) == null) {
                    str.setTell(null);
                } else {
                    str.setTell(list.get(13).toString());
                }
                if (list.get(14) == null) {
                    str.setAsk(null);
                } else {
                    str.setAsk(list.get(14).toString());
                }
                if (list.get(15) == null) {
                    str.setPrice(null);
                } else {
                    str.setPrice((list.get(15).toString()));
                }
                if (list.get(16) == null) {
                    str.setManHour(null);
                } else {
                    str.setManHour(list.get(16).toString());
                }
                StandardTemplate standTempIdByName = standardTemplateService.getStandTempIdByName(String.valueOf(list.get(23)));
                if (standTempIdByName != null) {
                    str.setTemplateId(standTempIdByName.getId());
                } else {
                    throw new BaseException("模板不存在:" + list.get(23));
                }
                str.setFactory("中天科技检测中心");
                str.setLaboratory(laboratory.get());
                str.setState(1);
                str.setTree(str.getFactory() + " - " + str.getLaboratory() + " - " + str.getSampleType() + " - " + str.getSample() + " - " + (str.getModel() == null ? "" : str.getModel()));
                try {
                    str.setStructureItemParameterId(standardTreeMapper.getStructureItemParameterId("\"" + str.getSampleType() + "\"", str.getInspectionItem(), str.getInspectionItemSubclass(), str.getInspectionItemClass()));
                } catch (Exception e) {
                    str.setStructureItemParameterId(standardTreeMapper.getStructureItemParameterId("\"" + str.getSampleType() + "\",\"" + str.getSample() + "\"", str.getInspectionItem(), str.getInspectionItemSubclass(), str.getInspectionItemClass()));
                }
                if (str.getStructureItemParameterId() == null) {
                    throw new BaseException("检验项目不存在:" + str.getInspectionItem() + " " + str.getInspectionItemSubclass());
                }
                lists.add(str);
            }
        });
        lists.forEach(a -> {
            if (a.getId() != null) {
                standardProductListMapper.updateById(a);
            } else {
                standardProductListMapper.insert(a);
            }
        });
    }
    @Override
    public boolean updateTreeSort(List<FactoryDto> list) {
        List<StructureTestObject> testObjects = new ArrayList<>();
        for (FactoryDto factoryDto : list) {
            for (LaboratoryDto laboratoryDto : factoryDto.getChildren()) {
                List<SampleTypeDto> children = laboratoryDto.getChildren();
                int sort = 0;
                // å¾ªçŽ¯ç¬¬ä¸‰å±‚
                for (SampleTypeDto child : children) {
                    StructureTestObject structureTestObject = new StructureTestObject();
                    structureTestObject.setSort(sort);
                    structureTestObject.setId(child.getSampleTypeId());
                    testObjects.add(structureTestObject);
                    sort++;
                }
            }
        }
        structureTestObjectService.updateBatchById(testObjects);
        return true;
    }
    /**
     * ä¿®æ”¹æ ‡å‡†æ•°
     * @param standardTree
     * @return
     */
    @Override
    public int updateStandardTree(StandardTree standardTree) {
        // ä¿®æ”¹åç§°åŒ¹é…çš„æ ‡å‡†æ ‘下的检验项目
        // æŸ¥è¯¢æ‰€æœ‰å¯¹è±¡+名称的树
        List<StandardProductList> standardProductLists = standardProductListService.list(Wrappers.<StandardProductList>lambdaUpdate()
                .eq(StandardProductList::getSample, standardTree.getSample())
                .eq(StandardProductList::getSampleType, standardTree.getSampleType())
                .eq(StandardProductList::getModel, standardTree.getOldModel()));
        if (CollectionUtils.isNotEmpty(standardProductLists)) {
            for (StandardProductList standardProductList : standardProductLists) {
                // ä¿®æ”¹æ ·å“åç§°
                standardProductList.setModel(standardTree.getModel());
                // ä¿®æ”¹æ ‘名称
                // éœ€è¦æˆªå–第四级, é¿å…ä¸‰å››çº§åç§°ä¸€æ ·ä¿®æ”¹é”™è¯¯
                String[] trees = standardProductList.getTree().split(" - ");
                trees[4] = standardTree.getModel();
                List<String> list = CollUtil.newArrayList(trees);
                String newName = CollUtil.join(list, " - ");
                standardProductList.setTree(newName);
            }
            standardProductListService.updateBatchById(standardProductLists);
        }
        // ä¿®æ”¹æ ‡å‡†æ•°æ£€éªŒé¡¹ç›®
        LambdaUpdateWrapper<StandardTree> wrapper = Wrappers.<StandardTree>lambdaUpdate()
                .eq(StandardTree::getFactory, standardTree.getFactory())
                .eq(StandardTree::getLaboratory, standardTree.getLaboratory())
                .eq(StandardTree::getSampleType, standardTree.getSampleType())
                .eq(StandardTree::getModel, standardTree.getOldModel())
                .set(StandardTree::getModel, standardTree.getModel());
        if (StringUtils.isNotBlank(standardTree.getSample())) {
            wrapper.eq(StandardTree::getSample, standardTree.getSample());
        }
        return standardTreeMapper.update(null, wrapper);
    }
    @Override
    public void resetTreeOfPrice(String tree, Integer standardId) {
        standardProductListMapper.update(null, Wrappers.<StandardProductList>lambdaUpdate().like(StandardProductList::getTree, tree).eq(StandardProductList::getStandardMethodListId, standardId).set(StandardProductList::getPrice, null));
    }
    @Override
    public void resetTreeOfHour(String tree, Integer standardId) {
        standardProductListMapper.update(null, Wrappers.<StandardProductList>lambdaUpdate().like(StandardProductList::getTree, tree).eq(StandardProductList::getStandardMethodListId, standardId).set(StandardProductList::getManHour, null));
    }
    @Override
    public void resetTreeOfAsk(String tree, Integer standardId) {
        standardProductListMapper.update(null, Wrappers.<StandardProductList>lambdaUpdate().like(StandardProductList::getTree, tree).eq(StandardProductList::getStandardMethodListId, standardId)
                .set(StandardProductList::getAsk, null)
                .set(StandardProductList::getTell, null)
                .set(StandardProductList::getSection, null)
                .set(StandardProductList::getCores, null)
                .set(StandardProductList::getConductorMaterial, null)
                .set(StandardProductList::getConductorType, null)
                .set(StandardProductList::getPrice, null)
                .set(StandardProductList::getManHour, null));
    }
}
basic-server/src/main/java/com/ruoyi/basic/service/impl/StructureItemParameterServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,24 @@
package com.ruoyi.basic.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.basic.mapper.StructureItemParameterMapper;
import com.ruoyi.basic.pojo.StructureItemParameter;
import com.ruoyi.basic.service.StructureItemParameterService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@Service
@AllArgsConstructor
public class StructureItemParameterServiceImpl extends ServiceImpl<StructureItemParameterMapper, StructureItemParameter> implements StructureItemParameterService {
    @Resource
    private StructureItemParameterMapper structureItemParameterMapper;
    @Override
    public void removeNoSample(String sample) {
        structureItemParameterMapper.removeNoSample("\""+sample+"\"");
    }
}
basic-server/src/main/java/com/ruoyi/basic/service/impl/StructureTestObjectPartServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,75 @@
package com.ruoyi.basic.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.exception.base.BaseException;
import com.ruoyi.common.utils.QueryWrappers;
import com.ruoyi.basic.mapper.ProductPartMapper;
import com.ruoyi.basic.mapper.StructureTestObjectPartMapper;
import com.ruoyi.basic.pojo.ProductPart;
import com.ruoyi.basic.pojo.StructureTestObjectPart;
import com.ruoyi.basic.service.StructureTestObjectPartService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
 * æ£€éªŒå¯¹è±¡é›¶ä»¶è¡¨
 *
 * @author zhuo
 * @since 2024-08-07
 */
@Transactional
@Service
@AllArgsConstructor
public class StructureTestObjectPartServiceImpl extends ServiceImpl<StructureTestObjectPartMapper, StructureTestObjectPart> implements StructureTestObjectPartService {
    private ProductPartMapper productPartMapper;
    @Override
    public IPage<StructureTestObjectPart> selectByTestObjectId(Page page, StructureTestObjectPart structureTestObjectPart) {
        return baseMapper.selectListByTestObjectId(page, QueryWrappers.queryWrappers(structureTestObjectPart),structureTestObjectPart.getTestObjectId());
    }
    @Override
    public void addTestObjectPart(StructureTestObjectPart structureTestObjectPart) {
        this.isPartNoExist(structureTestObjectPart.getPartNo(), null);
        if (structureTestObjectPart.getTestObjectId() == null) {
            throw new BaseException("缺少产品对象id");
        }
        baseMapper.insert(structureTestObjectPart);
    }
    @Override
    public void updateTestObjectPart(StructureTestObjectPart structureTestObjectPart) {
        this.isPartNoExist(structureTestObjectPart.getPartNo(),  structureTestObjectPart.getId());
        if (structureTestObjectPart.getTestObjectId() == null) {
            throw new BaseException("缺少产品对象id");
        }
        baseMapper.updateById(structureTestObjectPart);
    }
    // åˆ¤æ–­é›¶ä»¶å·æ˜¯å¦å­˜åœ¨
    public void isPartNoExist(String partNo, Integer id) {
        // é›¶ä»¶å·å”¯ä¸€ ä½†ä¸å¿…å¡«
        if (StringUtils.isNotBlank(partNo)) {
            Long count = productPartMapper.selectCount(new LambdaQueryWrapper<ProductPart>()
                    .eq(ProductPart::getPartNo, partNo));
            Long selectCount = baseMapper.selectCount(Wrappers.<StructureTestObjectPart>lambdaQuery()
                    .eq(StructureTestObjectPart::getPartNo, partNo)
                    .ne(id != null, StructureTestObjectPart::getId, id));
            if (count > 0 || selectCount > 0) {
                throw new BaseException("该零件号已绑定过检验对象");
            }
        } else {
            throw new BaseException("请输入零件号");
        }
    }
}
basic-server/src/main/java/com/ruoyi/basic/service/impl/StructureTestObjectServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,19 @@
package com.ruoyi.basic.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.basic.mapper.StructureTestObjectMapper;
import com.ruoyi.basic.pojo.StructureTestObject;
import com.ruoyi.basic.service.StructureTestObjectService;
import org.springframework.stereotype.Service;
/**
 * æ£€æµ‹å¯¹è±¡
 *
 * @author zhuo
 * @since 2024-09-13
 */
@Service
public class StructureTestObjectServiceImpl extends ServiceImpl<StructureTestObjectMapper, StructureTestObject> implements StructureTestObjectService {
}
basic-server/src/main/resources/mapper/CertificationMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.ruoyi.basic.mapper.CertificationMapper">
    <select id="getCertificationDetail" resultType="com.ruoyi.basic.pojo.Certification">
        select b.*
        from ( select a.`name`, a.`code`,a.organization,a.explanation,a.first_issuance_date,a.latest_issuance_date,c.expire_time FROM
            (SELECT id,name,MIN(date_of_issuance) AS first_issuance_date,
                    MAX(date_of_issuance) AS latest_issuance_date,
                    c.`code`,c.organization,c.explanation
             FROM
                 certification c
        <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
            ${ew.customSqlSegment}
        </if>
             GROUP BY
                 name) a left join certification c on a.id=c.id
        ) b
    </select>
</mapper>
basic-server/src/main/resources/mapper/IfsInventoryQuantityMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.ruoyi.basic.mapper.IfsInventoryQuantityMapper">
    <select id="printLabel" resultType="com.ruoyi.basic.dto.IfsInventoryQuantityDto">
        SELECT io.sample sample_name,
        iiq.supplier_name,
        io.part_detail part_desc,
        io.send_time,
        io.prepare_user,
        io.entrust_code,
        iiq.qty_arrived,
        iiq.buy_unit_meas,
        CASE
        WHEN pp.color IS NOT NULL
        THEN pp.color
        ELSE sto.color
        END   color,
        case
        when iiq.state = 2 then '2'
        when iiq.state = 1 then case
        when ROUND((select count(*)
        from ins_product ip
        where state = 1
        and ins_result is not null
        and ip.ins_sample_id in (select id
        from ins_sample
        where ins_sample.ins_order_id = io.id)) /
        (select count(*)
        from ins_product ip2
        where state = 1
        and ip2.ins_sample_id in
        (select id from ins_sample where ins_sample.ins_order_id = io.id)) *
        100, 2) != 100 then '0'
        else '1' end
        end   labelStatus,
        JSON_OBJECT(
        'sample_ame', io.sample,
        'supplier_name', iiq.supplier_name,
        'part_desc', iiq.part_desc,
        'entrust_code', io.entrust_code
        )         labelBarCode
        FROM ifs_inventory_quantity iiq
        LEFT JOIN  ins_order io on io.id = (SELECT io2.id
        FROM ins_order io2
        WHERE io2.ifs_inventory_id = iiq.id
        and io2.state != -1
        order by io2.send_time desc
        limit 1) COLLATE utf8mb4_general_ci
        LEFT JOIN product_part pp ON pp.part_no = iiq.part_no COLLATE utf8mb4_general_ci
        LEFT JOIN structure_test_object_part sto ON sto.part_no = iiq.part_no COLLATE utf8mb4_general_ci
        WHERE iiq.id in
        <foreach collection="ids" index="index" open="(" separator="," close=")" item="val">
            #{val}
        </foreach>
    </select>
    <select id="selectReportCountById" resultType="java.lang.Integer">
        select count(*)
        from ifs_inventory_quantity iiq
                 left join ins_order io on io.ifs_inventory_id = iiq.id and io.state
                 left join ins_report ir on ir.ins_order_id = io.id
        where iiq.id = #{ifsInventoryId}
          and ir.id is not null
    </select>
    <select id="selectIsFirst" resultType="java.lang.Integer">
        select count(*)
        from ifs_inventory_quantity iiq
                 LEFT JOIN ins_order io1 on io1.ifs_inventory_id = iiq.id
            and io1.state != -1
        where io1.part_detail = #{partDetail}
          and iiq.supplier_name = #{supplierName}
          and iiq.receiver_date between #{startOfNextQuarter} and #{endOfQuarter}
    </select>
</mapper>
basic-server/src/main/resources/mapper/LaboratoryMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.basic.mapper.LaboratoryMapper">
    <select id="selectItemParameter" resultType="com.ruoyi.basic.pojo.Laboratory">
        select * from
        (
        select l.id,
        laboratory_name,
        laboratory_number,
        laboratory_code,
        phone_number,
        head,
        l.address,
        u1.name create_user_name,
        l.create_time
        from laboratory l
        left join user u1 on l.create_user = u1.id
        ) a
        <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
            ${ew.customSqlSegment}
        </if>
    </select>
    <select id="obtainItemParameterList" resultType="java.lang.Object">
        select * from
            (
                select l.id,
                       laboratory_name,
                       laboratory_number,
                       phone_number,
                       head,
                       l.address,
                       u1.name create_user_name,
                       l.create_time
                from laboratory l
                         left join user u1 on l.create_user = u1.id
            ) a
    </select>
</mapper>
basic-server/src/main/resources/mapper/ProductMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.basic.mapper.ProductMapper">
    <resultMap id="BaseResultMap" type="com.ruoyi.basic.pojo.Product">
            <id property="id" column="id" jdbcType="INTEGER"/>
            <result property="name" column="name" jdbcType="VARCHAR"/>
            <result property="nameEn" column="name_en" jdbcType="VARCHAR"/>
            <result property="createUser" column="create_user" jdbcType="INTEGER"/>
            <result property="updateUser" column="update_user" jdbcType="INTEGER"/>
            <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
            <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
            <result property="objectId" column="object_id" jdbcType="INTEGER"/>
    </resultMap>
    <sql id="Base_Column_List">
        id,name,name_en,
        create_user,update_user,create_time,
        update_time,object_id
    </sql>
    <select id="selectProductListByObjectId" resultType="com.ruoyi.basic.pojo.Product">
        select * from (
        select p.id,
               p.name,
               p.name_en,
               p.create_user,
               p.update_user,
               p.create_time,
               p.update_time,
               p.object_id
        from product p
        WHERE 1=1
            <if test="partNo != null and partNo != ''">
                and p.id = (select pp.product_id
                from product_part pp
                where pp.part_no = #{partNo})
            </if>) a
            <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
                ${ew.customSqlSegment}
            </if>
    </select>
</mapper>
basic-server/src/main/resources/mapper/ProductPartMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.basic.mapper.ProductPartMapper">
    <select id="selectListByProductId" resultType="com.ruoyi.basic.pojo.ProductPart">
        SELECT * from product_part pp
        where  pp.product_id=#{productId}
    </select>
</mapper>
basic-server/src/main/resources/mapper/ProductSupplierDensityMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.ruoyi.basic.mapper.ProductSupplierDensityMapper">
    <select id="selectListByProductId" resultType="com.ruoyi.basic.pojo.ProductSupplierDensity">
        SELECT * from product_supplier_density pp
        where  pp.product_id=#{productId}
    </select>
</mapper>
basic-server/src/main/resources/mapper/StandardMethodListMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,99 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.basic.mapper.StandardMethodListMapper">
    <resultMap id="BaseResultMap" type="com.ruoyi.basic.pojo.StandardMethodList">
        <id property="id" column="id" jdbcType="INTEGER"/>
        <result property="code" column="code" jdbcType="VARCHAR"/>
        <result property="name" column="name" jdbcType="VARCHAR"/>
        <result property="remark" column="remark" jdbcType="VARCHAR"/>
        <result property="createUser" column="create_user" jdbcType="INTEGER"/>
        <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
        <result property="updateUser" column="update_user" jdbcType="INTEGER"/>
        <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
    </resultMap>
    <select id="selectStandardMethodById" resultType="java.util.Map">
        select code, name, remark
        from standard_method
        where id = #{id}
    </select>
    <select id="selectUserById" resultType="java.lang.String">
        select name
        from user
        where id = #{id}
    </select>
    <select id="selectStandardMethodLists" resultType="com.ruoyi.basic.pojo.StandardMethodList">
        select id, code, name, remark
        from standard_method
        where is_use = 1
        and is_product = 1
        and structure_test_object_id LIKE CONCAT('%[', #{tree}, ']%')
    </select>
    <select id="selectParameterList" resultType="com.ruoyi.basic.pojo.StandardProductList">
        select inspection_item,
               inspection_item_subclass,
               laboratory,
               unit,
               price,
               man_hour,
               man_hour_group,
               inspection_item_type,
               inspection_value_type,
               checkout_number,
               section,
               method,
               man_day,
               bsm,
               template_id,
               son_laboratory
        from structure_item_parameter
        where method = #{code}
    </select>
    <select id="selectStandardMethodLists2" resultType="com.ruoyi.basic.pojo.StandardMethodList">
        select sml.id, sml.code, sml.name,sml.remark, sml.create_time, u.name create_user_name
        from standard_method_list sml
        left join user u on u.id = sml.create_user
        where factory = #{data1}
        <if test="data2 != null">
            and laboratory = #{data2}
        </if>
        <if test="data3 != null">
            and sample_type = #{data3}
        </if>
        <if test="data4 != null">
            and sample = #{data4}
        </if>
        <if test="data5 != null">
            and model = #{data5}
        </if>
    </select>
    <select id="selectStandardMethodLists3" resultType="com.ruoyi.basic.pojo.StandardMethodList">
        select id, code, name, remark
        from standard_method
        where is_use = 1
          and is_product = 1
          and structure_test_object_id LIKE CONCAT('%', #{tree}, '%')
    </select>
    <select id="selectListEnum" resultType="com.ruoyi.basic.pojo.StandardMethodList">
        select id,code,name from standard_method
        where is_product = 1
        and is_use = 1
    </select>
    <select id="selectStandardMethodListsByNull" resultType="com.ruoyi.basic.pojo.StandardMethodList">
        select id, code, name, remark
        from standard_method
        where is_use = 1
          and is_product = 1
          and (
                structure_test_object_id is null
                OR structure_test_object_id = ''
                OR structure_test_object_id = '[]'
            )
    </select>
    <select id="getStandardMethodId" resultType="java.lang.Integer">
        select id from standard_method where code = #{code}
    </select>
</mapper>
basic-server/src/main/resources/mapper/StandardMethodMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.basic.mapper.StandardMethodMapper">
    <resultMap id="BaseResultMap" type="com.ruoyi.basic.pojo.StandardMethod">
        <id property="id" column="id" jdbcType="INTEGER"/>
        <result property="code" column="code" jdbcType="VARCHAR"/>
        <result property="name" column="name" jdbcType="VARCHAR"/>
        <result property="remark" column="remark" jdbcType="VARCHAR"/>
        <result property="createUser" column="create_user" jdbcType="INTEGER"/>
        <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
        <result property="updateUser" column="update_user" jdbcType="INTEGER"/>
        <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
    </resultMap>
    <select id="selectStandardMethodList" resultType="com.ruoyi.basic.pojo.StandardMethod">
        select * from (
                select sm.id,
                sm.code,
                sm.name,
                sm.structure_test_object_id,
                sto.specimen_name sample_type,
                sm.remark,
                u1.name create_user_name,
                sm.create_time,
                u2.name update_user_name,
                sm.update_time,
                sm.is_product,
                sm.field,
                sm.name_en,
                sm.is_use,
                sm.qualification_id
                from standard_method sm
                left join user u1 on sm.create_user = u1.id
                left join user u2 on sm.update_user = u2.id
                left join structure_test_object sto on sm.structure_test_object_id = sto.id
                where sm.code != '技术要求'
                ) a
        <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
            ${ew.customSqlSegment}
        </if>
    </select>
    <select id="selectStandMethodById" resultType="com.ruoyi.basic.pojo.StandardMethod">
        select sm.id,
               sm.code,
               sm.name,
               sm.structure_test_object_id,
               sto.specimen_name sample_type,
               sm.remark,
               u1.name create_user_name,
               sm.create_time,
               u2.name update_user_name,
               sm.update_time,
               sm.is_product,
               sm.field,
               sm.name_en,
               sm.is_use,
               sm.qualification_id
        from standard_method sm
                 left join user u1 on sm.create_user = u1.id
                 left join user u2 on sm.update_user = u2.id
                 left join structure_test_object sto on sm.structure_test_object_id = sto.id
        where sm.id = #{id}
    </select>
</mapper>
basic-server/src/main/resources/mapper/StandardProductListMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,144 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.basic.mapper.StandardProductListMapper">
    <resultMap id="BaseResultMap" type="com.ruoyi.basic.pojo.StandardProductList">
            <id property="id" column="id" jdbcType="INTEGER"/>
            <result property="inspectionItem" column="inspection_item" jdbcType="VARCHAR"/>
            <result property="inspectionItemSubclass" column="inspection_item_subclass" jdbcType="VARCHAR"/>
            <result property="laboratory" column="laboratory" jdbcType="VARCHAR"/>
            <result property="unit" column="unit" jdbcType="VARCHAR"/>
            <result property="price" column="price" jdbcType="DECIMAL"/>
            <result property="manHour" column="man_hour" jdbcType="INTEGER"/>
            <result property="manHourGroup" column="man_hour_group" jdbcType="VARCHAR"/>
            <result property="inspectionItemType" column="inspection_item_type" jdbcType="VARCHAR"/>
            <result property="inspectionValueType" column="inspection_value_type" jdbcType="VARCHAR"/>
            <result property="checkoutNumber" column="checkout_number" jdbcType="INTEGER"/>
            <result property="section" column="section" jdbcType="VARCHAR"/>
            <result property="method" column="method" jdbcType="VARCHAR"/>
            <result property="manDay" column="man_day" jdbcType="INTEGER"/>
            <result property="bsm" column="bsm" jdbcType="VARCHAR"/>
            <result property="ask" column="ask" jdbcType="VARCHAR"/>
            <result property="standardMethodListId" column="standard_method_list_id" jdbcType="INTEGER"/>
            <result property="createUser" column="create_user" jdbcType="INTEGER"/>
            <result property="updateUser" column="update_user" jdbcType="INTEGER"/>
            <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
            <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
    </resultMap>
    <update id="updateSection">
        UPDATE standard_product_list
        SET price=#{productList.price},
            man_hour=#{productList.manHour},
            section=#{productList.section},
            cores=#{productList.cores},
            conductor_material=#{productList.conductorMaterial},
            conductor_type=#{productList.conductorType},
            ask=#{productList.ask},
            tell=#{productList.tell},
            update_user=#{productList.updateUser},
            update_time=#{productList.updateTime}
        WHERE id = #{productList.id}
    </update>
    <update id="updateSortUp">
        update standard_product_list
        set sort = sort - 1
        where tree = #{tree}
          and standard_method_list_id = #{methodId}
          and sort between #{beginIndex} + 1 and #{endIndex}
    </update>
    <update id="updateSortDown">
        update standard_product_list
        set sort = sort + 1
        where tree = #{tree}
          and standard_method_list_id = #{methodId}
          and sort between #{endIndex} and #{beginIndex} - 1
    </update>
    <select id="standardProductListIPage" resultType="com.ruoyi.basic.pojo.StandardProductList">
        select spl.* from standard_product_list spl
        left join product p on spl.sample = p.name
        where standard_method_list_id = #{id}
        and tree like concat('%',#{tree},'%')
        <if test="laboratory != ''">
            and son_laboratory = #{laboratory}
        </if>
        <if test="insItem != ''">
            and inspection_item = #{insItem}
        </if>
        <if test="insItems != ''">
            and inspection_item_subclass = #{insItems}
        </if>
        group by spl.id
        order by p.id
    </select>
    <select id="getOne" resultType="com.ruoyi.basic.pojo.StandardProductList">
        select * from standard_product_list
        where standard_method_list_id = #{standardMethodListId}
        and inspection_item = #{inspectionItem}
        <if test="sample!=null">
            and sample = #{sample}
        </if>
        <if test="inspectionItemSubclass!=null">
            and inspection_item_subclass = #{inspectionItemSubclass}
        </if>
        <if test="inspectionItemSubclass == null">
            and (inspection_item_subclass is null or inspection_item_subclass = '')
        </if>
        <if test="model!=null">
            and model = #{model}
        </if>
        <if test="inspectionItemClass != null and inspectionItemClass != ''">
            and inspection_item_class = #{inspectionItemClass}
        </if>
    </select>
    <select id="selectDetail" resultType="com.ruoyi.basic.pojo.StandardProductList">
        select * from standard_product_list
        where standard_method_list_id = #{standardMethodListId}
        and state =#{state}
        and model=#{model}
        <if test="isCableTag != null and isCableTag != ''">
            and (inspection_item_class like concat('%结构尺寸%') or
            inspection_item_class like concat('%电缆电性能%')or
            inspection_item_class like concat('%绝缘%')or
            inspection_item_class like concat('%电缆燃烧性能%'))
        </if>
        order by sort asc,
            case when man_hour_group is NULL then 1
                      when man_hour_group ='' then 1  else 0 end,
                 CASE
                     WHEN man_hour_group REGEXP '^[0-9]' THEN CAST(man_hour_group AS UNSIGNED) -- å¦‚果以数字开头,则按照数字大小排序
                     WHEN man_hour_group REGEXP '[0-9]+' THEN CAST(SUBSTRING(man_hour_group, 2)AS UNSIGNED) END -- æå–字母后面的数字部分
                ,id asc
    </select>
    <select id="selectDetail2" resultType="com.ruoyi.basic.pojo.StandardProductList">
        select * from standard_product_list
        where standard_method_list_id = #{standardMethodListId}
          and state =#{state}
          and tree =#{tree}
        <if test="isCableTag != null and isCableTag != ''">
            and (inspection_item_class like concat('%结构尺寸%') or
            inspection_item_class like concat('%电缆电性能%')or
            inspection_item_class like concat('%绝缘%')or
            inspection_item_class like concat('%电缆燃烧性能%'))
        </if>
        order by sort asc,
            case when man_hour_group is NULL then 1
                      when man_hour_group ='' then 1  else 0 end,
                 CASE
                     WHEN man_hour_group REGEXP '^[0-9]' THEN CAST(man_hour_group AS UNSIGNED) -- å¦‚果以数字开头,则按照数字大小排序
                     WHEN man_hour_group REGEXP '[0-9]+' THEN CAST(SUBSTRING(man_hour_group, 2)AS UNSIGNED) END -- æå–字母后面的数字部分
                ,id asc
    </select>
    <select id="selectPartColor" resultType="java.util.Map">
        select color,
               color_code
        from product_part
        where part_no = #{partNo}
        union all
        select color,
               color_code
        from structure_test_object_part
        where part_no = #{partNo}
    </select>
</mapper>
basic-server/src/main/resources/mapper/StandardProductListSupplierAskMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.ruoyi.basic.mapper.StandardProductListSupplierAskMapper">
</mapper>
basic-server/src/main/resources/mapper/StandardTemplateMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.basic.mapper.StandardTemplateMapper">
    <resultMap id="BaseResultMap" type="com.ruoyi.basic.pojo.StandardTemplate">
            <id property="id" column="id" jdbcType="INTEGER"/>
            <result property="name" column="name" jdbcType="VARCHAR"/>
            <result property="remark" column="remark" jdbcType="VARCHAR"/>
            <result property="thing" column="thing" jdbcType="VARCHAR"/>
            <result property="createUser" column="create_user" jdbcType="INTEGER"/>
            <result property="updateUser" column="update_user" jdbcType="INTEGER"/>
            <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
            <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
    </resultMap>
    <select id="selectStandardTemplatePageList" resultType="com.ruoyi.basic.pojo.StandardTemplate">
        select * from (
        select st.id, st.name,st.number, st.remark, u2.name create_user_name, u3.name update_user_name, st.create_time, st.update_time
        from standard_template st
        left join user u2 on u2.id = st.create_user
        left join user u3 on u3.id = st.update_user
        ) a
        <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
            ${ew.customSqlSegment}
        </if>
    </select>
    <select id="getStandTempIdByName" resultType="com.ruoyi.basic.pojo.StandardTemplate">
        select id from standard_template where name=#{name}
    </select>
    <!-- æŸ¥è¯¢åŽ‹ç¼©åŽçš„æ•°æ® -->
    <select id="selectCompressThing" resultType="java.lang.String">
        SELECT COMPRESS(thing)
        from standard_template b
        WHERE id = #{templateId}
    </select>
</mapper>
basic-server/src/main/resources/mapper/StandardTreeMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,384 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.basic.mapper.StandardTreeMapper">
    <resultMap id="BaseResultMap" type="com.ruoyi.basic.pojo.StandardTree">
        <id property="id" column="id" jdbcType="INTEGER"/>
        <result property="factory" column="factory" jdbcType="VARCHAR"/>
        <result property="laboratory" column="laboratory" jdbcType="VARCHAR"/>
        <result property="sampleType" column="sample_type" jdbcType="VARCHAR"/>
        <result property="sample" column="sample" jdbcType="VARCHAR"/>
        <result property="model" column="model" jdbcType="VARCHAR"/>
        <result property="createUser" column="create_user" jdbcType="INTEGER"/>
        <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
        <result property="updateUser" column="update_user" jdbcType="INTEGER"/>
        <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
    </resultMap>
    <resultMap id="FactoryDto" type="com.ruoyi.basic.dto.FactoryDto">
        <result property="label" column="factory"/>
        <result property="value" column="factory"/>
        <collection property="children" resultMap="LaboratoryDto"/>
    </resultMap>
    <resultMap id="LaboratoryDto" type="com.ruoyi.basic.dto.LaboratoryDto">
        <result property="label" column="laboratory"/>
        <result property="value" column="laboratory"/>
        <collection property="children" resultMap="SampleTypeDto"/>
    </resultMap>
    <resultMap id="SampleTypeDto" type="com.ruoyi.basic.dto.SampleTypeDto">
        <result property="label" column="sample_type"/>
        <result property="value" column="sample_type"/>
        <result property="sampleTypeId" column="sample_type_id"/>
        <result property="sort" column="sort"/>
        <result property="partNo" column="part_no"/>
        <result property="sampleTypeEn" column="sample_type_en"/>
        <collection property="children" resultMap="SampleDto"/>
    </resultMap>
    <resultMap id="SampleDto" type="com.ruoyi.basic.dto.SampleDto">
        <result property="label" column="sample"/>
        <result property="value" column="sample"/>
        <result property="partNo" column="sample_part_no"/>
        <result property="sampleEn" column="sample_en"/>
        <collection property="children" resultMap="ModelDto"/>
    </resultMap>
    <resultMap id="ModelDto" type="com.ruoyi.basic.dto.ModelDto">
        <result property="label" column="model"/>
        <result property="value" column="model"/>
    </resultMap>
    <sql id="selectStandardTree">
        sample    sample2,
               inspection_item,
               inspection_item_en,
               inspection_item_subclass,
               inspection_item_subclass_en,
               inspection_item_class,
               inspection_item_class_en,
               method,
               son_laboratory,
               unit,
               ask_tell  tell,
               ask,
               price,
               man_hour,
               man_hour_group,
               man_day,
               inspection_item_type,
               inspection_value_type,
               bsm,
               template_id,
               laboratory,
               checkout_number,
               section,
               dic,
               0         state,
        #{model}
        model,
        #{sample}
        sample,
        #{trees}
        tree,
        id
        structure_item_parameter_id,
        radius_list,
        rates
    </sql>
    <select id="selectStandardTreeList" resultMap="FactoryDto">
        select '中天科技检测中心'        factory,
               l.laboratory_name laboratory,
               sto.specimen_name sample_type,
               p.name            sample,
               st.model,
               sto.code,
               sto.id  sample_type_id,
               sto.sort,
               sto.specimen_name_en sample_type_en,
               p.name_en sample_en
        from laboratory l
                 left join structure_test_object sto on sto.laboratory_id = l.id
                 left join product p on p.object_id = sto.id
                 left join standard_tree st on st.sample_type = sto.specimen_name
            and st.sample = p.name
        order by l.id, CAST(sto.code AS DECIMAL), p.id, ISNULL(st.id), st.id
    </select>
    <select id="selectStandardProductById" resultType="com.ruoyi.basic.pojo.StandardProductList">
        select inspection_item,
               inspection_item_subclass,
               laboratory,
               son_laboratory,
               unit,
               price,
               man_hour,
               man_hour_group,
               inspection_item_type,
               inspection_value_type,
               checkout_number,
               section,
               method,
               man_day,
               bsm,
               template_id
        from structure_item_parameter
        where id = #{id}
    </select>
    <select id="getStandardProductListBySample" resultType="com.ruoyi.basic.pojo.StandardProductList">
        select inspection_item,
               inspection_item_subclass,
               laboratory,
               son_laboratory,
               unit,
               price,
               man_hour,
               man_hour_group,
               inspection_item_type,
               inspection_value_type,
               checkout_number,
               section,
               method,
               man_day,
               sample,
               bsm,
               template_id,
               dic,
               ask,
               ask_tell as tell
        from structure_item_parameter sp
        where sp.sample = #{sampleType}
           or sp.sample = ''
           or sp.sample = '[]'
    </select>
    <select id="getStandardMethodListBySample" resultType="com.ruoyi.basic.pojo.StandardMethodList">
        select sm.code,sm.name,sm.remark from standard_method sm
        left join structure_test_object sto on sm.structure_test_object_id = sto.id
        where is_use = 1
        and is_product = 1
        <if test="sampleType != null">
            and sto.specimen_name = #{sampleType}
        </if>
    </select>
    <select id="selectStandardTreeList2" resultType="com.ruoyi.basic.pojo.StandardTree">
        select '中天科技检测中心'        factory,
               l.laboratory_name laboratory,
               sto.specimen_name sample_type,
               p.name            sample
        from laboratory l
                 left join structure_test_object sto on sto.laboratory_id = l.id
                 left join product p on p.object_id = sto.id
                 left join standard_tree st on st.laboratory = l.laboratory_name
            and st.sample_type = sto.specimen_name
            and st.sample = p.name
        where sto.specimen_name = #{sampleType}
        group by sto.specimen_name
    </select>
    <select id="selectStandardProductListByTree" resultType="com.ruoyi.basic.pojo.StandardProductList">
        select <include refid="selectStandardTree"/>
        from structure_item_parameter
        where (
                sample is NULL
                OR sample = ''
                or sample = '[]'
                OR sample LIKE CONCAT('%[', #{tree}, ']%')
            )
          and (laboratory is null
            or laboratory = ''
            or laboratory = #{laboratory})
        order by inspection_item_class, inspection_item, id asc
    </select>
    <select id="selectStandardProductListByTree2" resultType="com.ruoyi.basic.pojo.StandardProductList">
        select <include refid="selectStandardTree"/>
        from structure_item_parameter
        where sample LIKE CONCAT('%[', #{tree}, ']%')
          and (laboratory is null
            or laboratory = ''
            or laboratory = #{laboratory})
        order by inspection_item_class, inspection_item, id asc
    </select>
    <select id="getStandardTree2" resultMap="SampleTypeDto">
        select sto.specimen_name sample_type,
               p.name            sample,
               st.model
        from structure_test_object sto
                 left join product p on p.object_id = sto.id
                 left join standard_tree st on st.sample_type = sto.specimen_name
            and st.sample = p.name
    </select>
    <select id="getStandardTree3" resultType="com.ruoyi.basic.dto.SampleDto">
        select model label,
               model value
        from standard_tree
        where sample_type = #{sampleType}
          and sample is null
    </select>
    <select id="getLaboratory" resultType="java.lang.String">
        select l.laboratory_name
        from structure_test_object sto
                 left join laboratory l on sto.laboratory_id = l.id
        where sto.specimen_name = #{str}
    </select>
    <select id="getStructureItemParameterId" resultType="java.lang.Integer">
        select id from structure_item_parameter
        where sample like concat('%', #{sampleType}, '%')
        and inspection_item = #{item}
        <if test="itemChild != null and itemChild != ''">
            and inspection_item_subclass = #{itemChild}
        </if>
        <if test="inspectionItemClass != null and inspectionItemClass != ''">
            and inspection_item_class = #{inspectionItemClass}
        </if>
        <if test="itemChild == null or itemChild == ''">
            and (inspection_item_subclass is null or inspection_item_subclass = '')
        </if>
    </select>
    <select id="selectPList" resultType="com.ruoyi.basic.dto.ProductDto">
        select p.name
        from structure_test_object sto
                 left join product p on p.object_id = sto.id
        where sto.specimen_name = #{name}
        order by p.id
    </select>
    <select id="selSample" resultType="java.lang.String">
        select name
        from product
        where name = #{name}
    </select>
    <select id="selectStandardTreeListByPartNo" resultMap="FactoryDto">
        select '中天科技检测中心' factory,
               l.laboratory_name  laboratory,
               sto.specimen_name  sample_type,
               p.name             sample,
               st.model,
               CASE
                   WHEN p.id = (SELECT pp.product_id
                                FROM product_part pp
                                WHERE pp.part_no = #{partNo})
                       THEN #{partNo}
                   ELSE NULL
                   END AS sample_part_no,
               CASE
                   WHEN sto.id = (SELECT sto.test_object_id
                                  FROM structure_test_object_part sto
                                  WHERE sto.part_no = #{partNo})
                       THEN #{partNo}
                   ELSE NULL
                   END AS part_no
        from laboratory l
                 left join structure_test_object sto on sto.laboratory_id = l.id
                 left join product p on p.object_id = sto.id
                 left join standard_tree st on st.sample_type = sto.specimen_name
            and st.sample = p.name
        where (p.id = (select pp.product_id
                       from product_part pp
                       where pp.part_no = #{partNo})
            or sto.id = (select sto.test_object_id
                         from structure_test_object_part sto
                         where sto.part_no = #{partNo}))
        order by l.id, CAST(sto.code AS DECIMAL), p.id, ISNULL(st.id), st.id
    </select>
    <sql id="getIfsOrder">
        select *
        from (SELECT ifs.*,
                     COALESCE(io1.create_user, io2.create_user)           create_user,
                     COALESCE(io1.entrust_code, io2.entrust_code)         entrust_code,
                     COALESCE(io1.send_time, io2.send_time)               send_time,
                     io1.id                                      enter_order_id,
                     ir1.id                                      enter_report_id,
                     ir1.url                                     enter_url,
                     ir1.url_s                                   enter_url_s,
                     io2.id                                      quarter_order_id,
                     ir2.id                                      quarter_report_id,
                     ir2.url                                     quarter_url,
                     ir2.url_s                                   quarter_url_s,
                     group_concat(distinct isa.sample_code, ' ')          sample_code,
                     group_concat(distinct isa.sample, ' ')               sample_name,
                     group_concat(distinct isa.model, ' ')                sample_model,
                     COALESCE(io1.state, io2.state)                       order_state,
                     COALESCE(isu.userName, COALESCE(u1.name, u2.name)) user_name,
                     group_concat(distinct iuh.unqualified_desc, ' ')    unqualified_desc,
                     io1.is_exemption
              FROM ifs_inventory_quantity ifs
                       LEFT JOIN ins_order io1 ON io1.ifs_inventory_id = ifs.id and io1.order_type = '进厂检验' and io1.state != -1
                       left join ins_report ir1 on io1.id = ir1.ins_order_id
                       left join user u1 on io1.create_user = u1.id
                       LEFT JOIN ins_order io2 ON io2.ifs_inventory_id = ifs.id and io2.order_type = 'Quarterly inspection' and io2.state != -1
                       left join ins_report ir2 on io2.id = ir2.ins_order_id
                       left join user u2 on io2.create_user = u2.id
                       LEFT JOIN ins_sample isa ON COALESCE(io1.id, io2.id) = isa.ins_order_id
                       LEFT JOIN (SELECT ins_sample_id, GROUP_CONCAT(DISTINCT uu.name SEPARATOR ',') AS userName
                                  FROM ins_sample_user u
                                           LEFT JOIN user uu ON u.user_id = uu.id
                                  WHERE u.state = 0
                                  GROUP BY ins_sample_id
                                  ORDER BY ins_sample_id) isu ON isu.ins_sample_id = COALESCE(io1.id, io2.id)
                       left join ins_unqualified_handler iuh on iuh.inventory_quantity_id = ifs.id
              group by ifs.id) a
    </sql>
    <select id="getIfsByStateOne" resultType="com.ruoyi.basic.dto.IfsInventoryQuantityDto">
        <include refid="getIfsOrder"/>
        <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
            ${ew.customSqlSegment}
        </if>
    </select>
    <select id="selectIfsPage" resultType="com.ruoyi.basic.pojo.IfsInventoryQuantity">
        SELECT * from ifs_inventory_quantity ifs
        <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
            ${ew.customSqlSegment}
        </if>
    </select>
    <select id="selectIfsInventoryQuantity" resultType="com.ruoyi.basic.dto.IfsInventoryQuantityCheckDto">
        SELECT * from ifs_inventory_quantity ifs
        <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
            ${ew.customSqlSegment}
        </if>
    </select>
    <select id="getIfsByOver" resultType="com.ruoyi.basic.dto.IfsInventoryQuantitySupplierDto">
        select * from (<include refid="getIfsOrder"/>
        <where>
            <if test="beginDeclareDate != null and beginDeclareDate != '' and endDeclareDate != null and endDeclareDate != ''">
                send_time between #{beginDeclareDate} and #{endDeclareDate}
            </if>
        </where>
        ) a
        <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
            ${ew.customSqlSegment}
        </if>
    </select>
    <select id="getIfsByOverList" resultType="com.ruoyi.basic.dto.IfsInventoryQuantitySupplierDto">
        select * from (<include refid="getIfsOrder"/>
            <where>
                <if test="beginDeclareDate != null and beginDeclareDate != '' and endDeclareDate != null and endDeclareDate != ''">
                    send_time between #{beginDeclareDate} and #{endDeclareDate}
                </if>
            </where>
        ) a
        <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
            ${ew.customSqlSegment}
        </if>
    </select>
    <select id="getIfsByQuarter" resultType="com.ruoyi.basic.dto.IfsInventoryQuantitySupplierDto">
        select * from (<include refid="getIfsOrder"/>
        <where>
            and (quarter_order_id is not null)
            <if test="beginDeclareDate != null and beginDeclareDate != '' and endDeclareDate != null and endDeclareDate != ''">
                and  send_time between #{beginDeclareDate} and #{endDeclareDate}
            </if>
        </where>
        ) a
        <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
            ${ew.customSqlSegment}
        </if>
    </select>
</mapper>
basic-server/src/main/resources/mapper/StructureItemParameterMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,121 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.basic.mapper.StructureItemParameterMapper">
    <delete id="removeNoSample">
        delete
        from structure_item_parameter
        where sample like concat('%', #{sample}, '%')
    </delete>
    <select id="selectItemParameterList" resultType="com.ruoyi.basic.pojo.StructureItemParameter">
        select * from (select A.id,
        inspection_item,
        inspection_item_en,
        inspection_item_subclass,
        inspection_item_subclass_en,
        laboratory,
        unit,
        price,
        man_hour,
        man_hour_group,
        inspection_item_type,
        checkout_number,
        section,
        A.create_user,
        A.update_user,
        A.create_time,
        A.update_time,
        method,
        man_day,
        bsm,
        sample,
        inspection_value_type,
        dic,
        template_id,
        son_laboratory,
        ask,
        ask_tell,
        inspection_item_class,
        inspection_item_class_en,
        code,
        radius_list,
        rates
        from (select *,
        CASE
        WHEN INSTR(sample, ',') > 0 THEN
        SUBSTRING_INDEX(SUBSTRING_INDEX(sample, '","', 1), '"', -1)
        when sample = '[""]' then null
        when sample = '[]' then null
        ELSE
        TRIM(BOTH '["]' FROM SUBSTRING_INDEX(REPLACE(sample, '[["', ''), '"]]', 1))
        END AS samples
        from structure_item_parameter) A
        left join structure_test_object sto on samples = specimen_name
        <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
            ${ew.customSqlSegment}
        </if>)B
        order by CASE
        WHEN code IS NULL THEN 1
        ELSE 0
        END,
        CAST(code AS UNSIGNED),
        case when man_hour_group is NULL then 1
        when man_hour_group ='' then 1 else 0 end,
        CASE
        WHEN man_hour_group REGEXP '^[0-9]' THEN CAST(man_hour_group AS UNSIGNED) -- å¦‚果以数字开头,则按照数字大小排序
        WHEN man_hour_group REGEXP '[0-9]+' THEN CAST(SUBSTRING(man_hour_group, 2)AS UNSIGNED) END -- æå–字母后面的数字部分
        ,id asc
    </select>
    <resultMap id="getInsProductions" type="map">
        <result property="name" column="sample"/>
        <collection property="children" resultMap="itemClass" javaType="List"/>
    </resultMap>
    <resultMap id="itemClass" type="map">
        <result property="name" column="item_class"/>
        <collection property="children" resultMap="item" javaType="List"/>
    </resultMap>
    <resultMap id="item" type="map">
        <result property="name" column="inspection_item"/>
        <collection property="children" resultMap="itemSubClass" javaType="List"/>
    </resultMap>
    <resultMap id="itemSubClass" type="map">
        <id property="id" column="id"/>
        <result property="name" column="subclass"/>
    </resultMap>
    <select id="getInsProduction" resultMap="getInsProductions">
        select distinct id,
                        CASE
                            WHEN INSTR(sample, ',') > 0 THEN
                                SUBSTRING_INDEX(SUBSTRING_INDEX(sample, '","', 1), '"', -1)
                            when sample = '[""]' then '*'
                            ELSE
                                TRIM(BOTH '["]' FROM SUBSTRING_INDEX(REPLACE(sample, '[["', ''), '"]]', 1))
                            END
                                                              as sample,
                        inspection_item,
                        case
                            when inspection_item_subclass is null or inspection_item_subclass = '' then inspection_item
                            else inspection_item_subclass end as subclass,
                        case
                            when inspection_item_class is null or inspection_item_class = '' then inspection_item
                            else inspection_item_class end as item_class
        from structure_item_parameter
    </select>
    <select id="getItemTree" resultMap="itemDto">
        select sto.id sId, sto.specimen_name sName, p.id pId, p.name pName
        from structure_test_object sto
                 left join product p on p.object_id = sto.id
    </select>
    <resultMap id="itemDto" type="com.ruoyi.basic.dto.TestItemDto">
        <result column="sId" property="id"/>
        <result column="sName" property="name"/>
        <collection property="children" resultMap="productDto"/>
    </resultMap>
    <resultMap id="productDto" type="com.ruoyi.basic.dto.ProductDto">
        <result column="pId" property="id"/>
        <result column="pName" property="name"/>
    </resultMap>
</mapper>
basic-server/src/main/resources/mapper/StructureTestMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.basic.mapper.StructureTestObjectMapper">
    <select id="selectTestObjectList" resultType="com.ruoyi.basic.dto.PageTestObjectDto">
        select * from (
        select sto.id,
        sto.specimen_name,
        u1.name create_user_name,
        sto.create_time,
        u2.name update_user_name,
        sto.update_time,
        sto.code,
        sto.laboratory_id,
        GROUP_CONCAT(p.name) product,
        sto.specimen_name_en,
        sto.object_type
        from structure_test_object sto
        left join user u1 on sto.create_user = u1.id
        left join user u2 on sto.update_user = u2.id
        left join product p on p.object_id = sto.id
        left join product_part pp on pp.product_id = p.id
        left join structure_test_object_part stop ON stop.test_object_id = sto.id
        <if test="partNo != null and partNo != ''" >
            where pp.part_no = #{partNo} or stop.part_no = #{partNo}
        </if>
        group by sto.id
        ) a
        <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
            ${ew.customSqlSegment}
        </if>
    </select>
</mapper>
basic-server/src/main/resources/mapper/StructureTestObjectPartMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.ruoyi.basic.mapper.StructureTestObjectPartMapper">
    <select id="selectListByTestObjectId" resultType="com.ruoyi.basic.pojo.StructureTestObjectPart">
        SELECT * from structure_test_object_part pp
        where  pp.test_object_id = #{testObjectId}
    </select>
</mapper>
inspect-server/pom.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>ruoyi</artifactId>
        <groupId>com.ruoyi</groupId>
        <version>3.8.9</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <artifactId>inspect-server</artifactId>
    <properties>
        <maven.compiler.source>8</maven.compiler.source>
        <maven.compiler.target>8</maven.compiler.target>
    </properties>
</project>
inspect-server/src/main/java/com/ruoyi/basic/pojo/InsSample.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,123 @@
package com.ruoyi.basic.pojo;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
 * æ£€éªŒæ ·å“
 * @TableName ins_sample
 */
@TableName(value ="ins_sample")
@Data
public class InsSample implements Serializable {
    /**
     *
     */
    @TableId(type = IdType.AUTO)
    private Integer id;
    /**
     * 1:合格 0:不合格
     */
    private Integer insResult;
    /**
     * å¤–键:ins_order表id
     */
    private Integer insOrderId;
    /**
     * é…å¥—样品型号
     */
    private String joinModel;
    /**
     * é…å¥—样品名称
     */
    private String joinName;
    /**
     * é…å¥—样品数量
     */
    private Integer joinNum;
    /**
     * æ ·å“ç¼–码
     */
    private String sampleCode;
    /**
     * æ£€éªŒå·¥åŽ‚
     */
    private String factory;
    /**
     * å®žéªŒå®¤åç§°
     */
    private String laboratory;
    /**
     * æ ·å“ç±»åž‹
     */
    private String sampleType;
    /**
     * æ ·å“åç§°
     */
    private String sample;
    /**
     * è§„格型号
     */
    private String model;
    /**
     * æ£€éªŒçŠ¶æ€(0:待检验1:检验中 2:已检验3:待复核4:复核未通过5:复核通过)
     */
    private Integer insState;
    /**
     * å¤‡æ³¨
     */
    private String remark;
    private Integer standardMethodListId;
    @ApiModelProperty("样品单位")
    private String unit;
    private Integer cellId;
    @TableField(fill = FieldFill.INSERT)
    private Integer createUser;
    @ApiModelProperty("创建时间")
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Integer updateUser;
    @ApiModelProperty("修改时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;
    private Integer parentId;
    @ApiModelProperty("数量")
    private Integer quantity;
    @ApiModelProperty("特殊标准方法")
    private String specialStandardMethod;
    @TableField(select = false,exist = false)
    private Integer num=1;
}
pom.xml
@@ -43,6 +43,7 @@
        <minio.version>8.4.3</minio.version>
        <okhttp.version>4.9.0</okhttp.version>
        <hutool.version>5.8.18</hutool.version>
        <easyexcel.version>3.3.2</easyexcel.version>
    </properties>
    <!-- ä¾èµ–声明 -->
@@ -226,6 +227,7 @@
                <version>${ruoyi.version}</version>
            </dependency>
            <!-- minio -->
            <dependency>
                <groupId>io.minio</groupId>
@@ -254,6 +256,12 @@
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>easyexcel</artifactId>
            <version>${easyexcel.version}</version>
        </dependency>
        <!--mybatis-plus-->
@@ -306,6 +314,12 @@
            <artifactId>hutool-all</artifactId>
            <version>${hutool.version}</version>
        </dependency>
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>fastjson</artifactId>
            <version>2.0.23</version>
        </dependency>
    </dependencies>
    <modules>
@@ -315,6 +329,8 @@
        <module>ruoyi-quartz</module>
        <module>ruoyi-generator</module>
        <module>ruoyi-common</module>
        <module>basic-server</module>
        <module>inspect-server</module>
    </modules>
    <packaging>pom</packaging>
ruoyi-admin/pom.xml
@@ -43,6 +43,11 @@
            <artifactId>mysql-connector-java</artifactId>
        </dependency>
        <dependency>
            <groupId>com.ruoyi</groupId>
            <artifactId>ruoyi-common</artifactId>
        </dependency>
        <!-- æ ¸å¿ƒæ¨¡å—-->
        <dependency>
            <groupId>com.ruoyi</groupId>
@@ -59,6 +64,20 @@
        <dependency>
            <groupId>com.ruoyi</groupId>
            <artifactId>ruoyi-generator</artifactId>
        </dependency>
        <!--基础模块-->
        <dependency>
            <groupId>com.ruoyi</groupId>
            <artifactId>basic-server</artifactId>
            <version>${ruoyi.version}</version>
        </dependency>
        <!--业务模块-->
        <dependency>
            <groupId>com.ruoyi</groupId>
            <artifactId>inspect-server</artifactId>
            <version>${ruoyi.version}</version>
        </dependency>
    </dependencies>
@@ -80,17 +99,17 @@
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>3.1.0</version>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>3.1.0</version>
                <configuration>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                    <warName>${project.artifactId}</warName>
                </configuration>
           </plugin>
                </configuration>
           </plugin>
        </plugins>
        <finalName>${project.artifactId}</finalName>
    </build>
</project>
</project>
ruoyi-common/pom.xml
@@ -135,6 +135,12 @@
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-text</artifactId>
            <version>1.3</version>
        </dependency>
    </dependencies>
</project>
ruoyi-common/src/main/java/com/ruoyi/common/handler/MybatisHandler.java
@@ -1,6 +1,9 @@
package com.ruoyi.common.handler;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.ServletUtils;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.stereotype.Component;
@@ -10,12 +13,26 @@
public class MybatisHandler implements MetaObjectHandler {
    @Override
    public void insertFill(MetaObject metaObject) {
        this.setFieldValByName("createTime", LocalDateTime.now(), metaObject);
        this.setFieldValByName("updateTime", LocalDateTime.now(), metaObject);
        Integer userId = null;
        try {
            userId = SecurityUtils.getUserId().intValue();
        } catch (Exception ignored) {
        }
        System.out.println("执行插入填充...");
        this.strictInsertFill(metaObject, "createTime", LocalDateTime.class, LocalDateTime.now());
        this.strictInsertFill(metaObject, "updateTime",  LocalDateTime.class, LocalDateTime.now());
        this.strictInsertFill(metaObject, "createUser", Integer.class, userId);
        this.strictInsertFill(metaObject, "updateUser", Integer.class, userId);
    }
    @Override
    public void updateFill(MetaObject metaObject) {
        this.setFieldValByName("updateTime", LocalDateTime.now(), metaObject);
        Integer userId = null;
        try {
            userId = SecurityUtils.getUserId().intValue();
        } catch (Exception ignored) {
        }
        this.strictUpdateFill(metaObject, "updateTime", LocalDateTime.class, LocalDateTime.now()); // èµ·å§‹ç‰ˆæœ¬ 3.3.0(推荐)
        this.strictUpdateFill(metaObject, "updateUser", Integer.class, userId);
    }
}
ruoyi-common/src/main/java/com/ruoyi/common/numgen/LambdaUtils.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,127 @@
/*
 * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * <p>
 * https://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package com.ruoyi.common.numgen;
import com.baomidou.mybatisplus.core.metadata.TableInfo;
import com.baomidou.mybatisplus.core.metadata.TableInfoHelper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.support.ColumnCache;
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
import java.lang.ref.WeakReference;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.ConcurrentHashMap;
import static java.util.Locale.ENGLISH;
/**
 * Lambda è§£æžå·¥å…·ç±»
 *
 * @author HCL, MieMie
 * @since 2018-05-10
 */
public final class LambdaUtils {
    /**
     * å­—段映射
     */
    private static final Map<String, Map<String, ColumnCache>> COLUMN_CACHE_MAP = new ConcurrentHashMap<>();
    /**
     * SerializedLambda ååºåˆ—化缓存
     */
    private static final Map<String, WeakReference<SerializedLambda>> FUNC_CACHE = new ConcurrentHashMap<>();
    /**
     * è§£æž lambda è¡¨è¾¾å¼, è¯¥æ–¹æ³•只是调用了 {@link SerializedLambda#resolve(SFunction)} ä¸­çš„æ–¹æ³•,在此基础上加了缓存。
     * è¯¥ç¼“存可能会在任意不定的时间被清除
     *
     * @param func éœ€è¦è§£æžçš„ lambda å¯¹è±¡
     * @param <T>  ç±»åž‹ï¼Œè¢«è°ƒç”¨çš„ Function å¯¹è±¡çš„目标类型
     * @return è¿”回解析后的结果
     * @see SerializedLambda#resolve(SFunction)
     */
    public static <T> SerializedLambda resolve(SFunction<T, ?> func) {
        Class<?> clazz = func.getClass();
        String canonicalName = clazz.getCanonicalName();
        return Optional.ofNullable(FUNC_CACHE.get(canonicalName))
            .map(WeakReference::get)
            .orElseGet(() -> {
                SerializedLambda lambda = SerializedLambda.resolve(func);
                FUNC_CACHE.put(canonicalName, new WeakReference<>(lambda));
                return lambda;
            });
    }
    /**
     * æ ¼å¼åŒ– key å°†ä¼ å…¥çš„ key å˜æ›´ä¸ºå¤§å†™æ ¼å¼
     *
     * <pre>
     *     Assert.assertEquals("USERID", formatKey("userId"))
     * </pre>
     *
     * @param key key
     * @return å¤§å†™çš„ key
     */
    public static String formatKey(String key) {
        return key.toUpperCase(ENGLISH);
    }
    /**
     * å°†ä¼ å…¥çš„表信息加入缓存
     *
     * @param tableInfo è¡¨ä¿¡æ¯
     */
    public static void installCache(TableInfo tableInfo) {
        COLUMN_CACHE_MAP.put(tableInfo.getEntityType().getName(), createColumnCacheMap(tableInfo));
    }
    /**
     * ç¼“存实体字段 MAP ä¿¡æ¯
     *
     * @param info è¡¨ä¿¡æ¯
     * @return ç¼“å­˜ map
     */
    private static Map<String, ColumnCache> createColumnCacheMap(TableInfo info) {
        Map<String, ColumnCache> map = new HashMap<>();
        String kp = info.getKeyProperty();
        if (StringUtils.isNotBlank(kp)) {
            map.put(formatKey(kp), new ColumnCache(info.getKeyColumn(), info.getKeySqlSelect()));
        }
        info.getFieldList().forEach(i ->
            map.put(formatKey(i.getProperty()), new ColumnCache(i.getColumn(), i.getSqlSelect()))
        );
        return map;
    }
    /**
     * èŽ·å–å®žä½“å¯¹åº”å­—æ®µ MAP
     *
     * @param clazz å®žä½“ç±»
     * @return ç¼“å­˜ map
     */
    public static Map<String, ColumnCache> getColumnMap(Class<?> clazz) {
        return COLUMN_CACHE_MAP.computeIfAbsent(clazz.getName(), key -> {
            TableInfo info = TableInfoHelper.getTableInfo(clazz);
            return info == null ? null : createColumnCacheMap(info);
        });
    }
}
ruoyi-common/src/main/java/com/ruoyi/common/numgen/NumberGenerator.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,146 @@
package com.ruoyi.common.numgen;
import com.baomidou.mybatisplus.core.metadata.TableFieldInfo;
import com.baomidou.mybatisplus.core.metadata.TableInfo;
import com.baomidou.mybatisplus.core.metadata.TableInfoHelper;
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.reflection.property.PropertyNamer;
import org.springframework.stereotype.Service;
import java.util.Optional;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
 * ç¼–号生成器
 *
 * @Author: zhangxy
 * @Date: 2020-09-08 16:31
 */
@Slf4j
@Service
@AllArgsConstructor
public class NumberGenerator<T> {
    private static Pattern NUMBER_PATTERN = Pattern.compile("(.+)\\((\\d+)\\)");
    private NumberGeneratorModelHelper numberGeneratorModelHelper;
    public String getCopyValueOfUniqueField(final String value, SFunction<T, ?> column) {
        if (value == null) {
            return null;
        } else {
            Matcher matcher = NUMBER_PATTERN.matcher(value);
            String oldValue = value;
            int index = 1;
            if (matcher.matches()) {
                oldValue = matcher.group(1);
                index = Integer.valueOf(matcher.group(2)) + 1;
            }
            NumberTableInfo info = initDbInfo(column);
            while (true) {
                String newValue = oldValue + "(" + (index++) + ")";
                boolean exist = numberGeneratorModelHelper.numberExist(newValue, info);
                if (!exist) {
                    return newValue;
                }
            }
        }
    }
    /**
     * ç”Ÿæˆç¼–号
     *
     * @param numOfDigits
     * @param column
     * @return
     */
    public String generateNumber(final int numOfDigits, SFunction<T, ?> column) {
        return generateNumberWithPrefix(numOfDigits, null, column);
    }
    /**
     * ç”Ÿæˆå¸¦å‰ç¼€çš„编号
     *
     * @param numOfDigits
     * @param prefix
     * @param column
     * @return
     */
    public String generateNumberWithPrefix(final int numOfDigits, final String prefix, SFunction<T, ?> column) {
        NumberTableInfo info = initDbInfo(column);
        String generatedNumber = generateNumberWithExtension(info, numOfDigits, prefix, "");
        return prependPrefix(prefix, generatedNumber);
    }
    /**
     * ç”Ÿæˆå¸¦åŽç¼€çš„编号
     *
     * @param numOfDigits
     * @param suffix
     * @param column
     * @return
     */
    public String generateNumberWithSuffix(final int numOfDigits, final String suffix, SFunction<T, ?> column) {
        NumberTableInfo info = initDbInfo(column);
        String generatedNumber = generateNumberWithExtension(info, numOfDigits, "", suffix);
        return appendSuffix(suffix, generatedNumber);
    }
    /**
     * åˆå§‹åŒ–数据库表名、字段名
     *
     * @param column
     * @return
     */
    private NumberTableInfo initDbInfo(SFunction<T, ?> column) {
        SerializedLambda ld = LambdaUtils.resolve(column);
        TableInfo tableInfo = TableInfoHelper.getTableInfo(ld.getImplClass());
        String fieldName = PropertyNamer.methodToProperty(ld.getImplMethodName());
        Optional<TableFieldInfo> op = tableInfo.getFieldList().stream().filter(f -> fieldName.equals(f.getProperty())).findFirst();
        if (!op.isPresent()) {
            throw new RuntimeException("获取数据库字段出错,请检查映射");
        }
        TableFieldInfo fieldInfo = op.get();
        NumberTableInfo info = new NumberTableInfo();
        info.setLogicDelete(tableInfo.isLogicDelete());
        info.setNumberFieldName(fieldInfo.getColumn());
        info.setTableName(tableInfo.getTableName());
        return info;
    }
    private String generateNumberWithExtension(NumberTableInfo numberTableInfo, int numOfDigits, String prefix, String suffix) {
        Long dbMax = numberGeneratorModelHelper.getNumbersProjection(numberTableInfo, prefix, suffix);
        Long greatestNumber = 0L;
        if (dbMax != null) {
            greatestNumber = dbMax;
        }
        return String.format("%0" + numOfDigits + "d", greatestNumber + 1);
    }
    private String prependPrefix(final String prefix, final String generatedNumber) {
        if (prefix == null) {
            return generatedNumber;
        }
        return prefix + generatedNumber;
    }
    private String appendSuffix(final String suffix, final String generatedNumber) {
        if (suffix == null) {
            return generatedNumber;
        }
        return generatedNumber + suffix;
    }
}
ruoyi-common/src/main/java/com/ruoyi/common/numgen/NumberGeneratorModelHelper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,107 @@
/**
 * ***************************************************************************
 * Copyright (c) 2010 Qcadoo Limited
 * Project: Qcadoo Framework
 * Version: 1.4
 * <p>
 * This file is part of Qcadoo.
 * <p>
 * Qcadoo is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published
 * by the Free Software Foundation; either version 3 of the License,
 * or (at your option) any later version.
 * <p>
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty
 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU Affero General Public License for more details.
 * <p>
 * You should have received a copy of the GNU Affero General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 * ***************************************************************************
 */
package com.ruoyi.common.numgen;
import com.google.common.collect.Maps;
import lombok.AllArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.text.StringSubstitutor;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import java.util.Map;
/**
 * @author zhangxy
 */
@AllArgsConstructor
@Service
public class NumberGeneratorModelHelper {
    private JdbcTemplate jdbcTemplate;
    private static final String NUMBER_EXIST_QUERY_TEMPLATE = "select count(*) from ${TABLE_NAME} where ${NUMBER_FIELD}='${VALUE}'";
    private static final String GET_NUMBERS_QUERY_TEMPLATE = "select MAX( CAST( "
            + " coalesce(TRIM(LEADING '0' from ${NUMBER_FIELD}), '0')   "
            + " AS UNSIGNED ) ) "
            + "from ${TABLE_NAME} where 1=1";
    private static final String GET_PREFIX_AWARE_NUMBERS_QUERY_TEMPLATE = "select MAX( CAST( "
            + " TRIM(LEADING '0' from SUBSTRING(${NUMBER_FIELD}, ${NUMBER_STARTS_AT}))  "
            + " AS UNSIGNED ) ) "
            + "from ${TABLE_NAME}  where ${NUMBER_FIELD} like '${PREFIX}%'";
    private static final String GET_SUFFIX_AWARE_NUMBERS_QUERY_TEMPLATE = "select MAX( CAST( "
            + " TRIM(LEADING '0' from SUBSTRING(${NUMBER_FIELD}, 1, POSITION('${SUFFIX}' IN ${NUMBER_FIELD}) - 1)) "
            + " AS UNSIGNED )) "
            + "from ${TABLE_NAME}  where ${NUMBER_FIELD} like '%${SUFFIX}'";
    public boolean numberExist(final String value, final NumberTableInfo numberTableInfo) {
        Map<String, String> placeholderValues = Maps.newHashMap();
        placeholderValues.put("TABLE_NAME", numberTableInfo.getTableName());
        placeholderValues.put("NUMBER_FIELD", numberTableInfo.getNumberFieldName());
        placeholderValues.put("VALUE", value);
        String query = new StringSubstitutor(placeholderValues, "${", "}").replace(NUMBER_EXIST_QUERY_TEMPLATE);
        Long count = jdbcTemplate.queryForObject(query, Long.class);
        return count > 0;
    }
    public Long getNumbersProjection(final NumberTableInfo numberTableInfo, final String prefix, final String suffix) {
        String sqlQuery = buildQuery(numberTableInfo, prefix, suffix);
        return jdbcTemplate.queryForObject(sqlQuery, Long.class);
    }
    private String buildQuery(final NumberTableInfo numberTableInfo,
                              final String prefix, final String suffix) {
        Map<String, String> placeholderValues = Maps.newHashMap();
        placeholderValues.put("TABLE_NAME", numberTableInfo.getTableName());
        placeholderValues.put("NUMBER_FIELD", numberTableInfo.getNumberFieldName());
        String query;
        if (StringUtils.isNotEmpty(prefix)) {
            placeholderValues.put("PREFIX", prefix);
            int prefixLength = StringUtils.length(prefix);
            placeholderValues.put("NUMBER_STARTS_AT", String.valueOf(prefixLength + 1));
            query = GET_PREFIX_AWARE_NUMBERS_QUERY_TEMPLATE;
        } else if (StringUtils.isNotEmpty(suffix)) {
            placeholderValues.put("SUFFIX", suffix);
            query = GET_SUFFIX_AWARE_NUMBERS_QUERY_TEMPLATE;
        } else {
            query = GET_NUMBERS_QUERY_TEMPLATE;
        }
        if(numberTableInfo.isLogicDelete()){
            query += " and active=true";
        }
        StringSubstitutor substitutor = new StringSubstitutor(placeholderValues, "${", "}");
        return substitutor.replace(query);
    }
}
ruoyi-common/src/main/java/com/ruoyi/common/numgen/NumberTableInfo.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,16 @@
package com.ruoyi.common.numgen;
import lombok.Data;
/**
 * @Author: zhangxy
 * @Date: 2020-09-11 16:48
 */
@Data
public class NumberTableInfo {
    private String tableName;
    private String numberFieldName;
    private boolean logicDelete;
}
ruoyi-common/src/main/java/com/ruoyi/common/numgen/SerializedLambda.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,143 @@
/*
 * Copyright (c) 2011-2020, baomidou (jobob@qq.com).
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * <p>
 * https://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package com.ruoyi.common.numgen;
import com.baomidou.mybatisplus.core.toolkit.ClassUtils;
import com.baomidou.mybatisplus.core.toolkit.ExceptionUtils;
import com.baomidou.mybatisplus.core.toolkit.SerializationUtils;
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
import java.io.*;
/**
 * è¿™ä¸ªç±»æ˜¯ä»Ž {@link java.lang.invoke.SerializedLambda} é‡Œé¢ copy è¿‡æ¥çš„,
 * å­—段信息完全一样
 * <p>负责将一个支持序列的 Function åºåˆ—化为 SerializedLambda</p>
 *
 * @author HCL
 * @since 2018/05/10
 */
public class SerializedLambda implements Serializable {
    private static final long serialVersionUID = 8025925345765570181L;
    private Class<?> capturingClass;
    private String functionalInterfaceClass;
    private String functionalInterfaceMethodName;
    private String functionalInterfaceMethodSignature;
    private String implClass;
    private String implMethodName;
    private String implMethodSignature;
    private int implMethodKind;
    private String instantiatedMethodType;
    private Object[] capturedArgs;
    /**
     * é€šè¿‡ååºåˆ—化转换 lambda è¡¨è¾¾å¼ï¼Œè¯¥æ–¹æ³•只能序列化 lambda è¡¨è¾¾å¼ï¼Œä¸èƒ½åºåˆ—化接口实现或者正常非 lambda å†™æ³•的对象
     *
     * @param lambda lambda对象
     * @return è¿”回解析后的 SerializedLambda
     */
    public static SerializedLambda resolve(SFunction<?, ?> lambda) {
        if (!lambda.getClass().isSynthetic()) {
            throw ExceptionUtils.mpe("该方法仅能传入 lambda è¡¨è¾¾å¼äº§ç”Ÿçš„合成类");
        }
        try (ObjectInputStream objIn = new ObjectInputStream(new ByteArrayInputStream(SerializationUtils.serialize(lambda))) {
            @Override
            protected Class<?> resolveClass(ObjectStreamClass objectStreamClass) throws IOException, ClassNotFoundException {
                Class<?> clazz;
                try {
                    clazz = ClassUtils.toClassConfident(objectStreamClass.getName());
                } catch (Exception ex) {
                    clazz = super.resolveClass(objectStreamClass);
                }
                return clazz == java.lang.invoke.SerializedLambda.class ? SerializedLambda.class : clazz;
            }
        }) {
            return (SerializedLambda) objIn.readObject();
        } catch (ClassNotFoundException | IOException e) {
            throw ExceptionUtils.mpe("This is impossible to happen", e);
        }
    }
    /**
     * èŽ·å–æŽ¥å£ class
     *
     * @return è¿”回 class åç§°
     */
    public String getFunctionalInterfaceClassName() {
        return normalizedName(functionalInterfaceClass);
    }
    /**
     * èŽ·å–å®žçŽ°çš„ class
     *
     * @return å®žçŽ°ç±»
     */
    public Class<?> getImplClass() {
        return ClassUtils.toClassConfident(getImplClassName());
    }
    /**
     * èŽ·å– class çš„名称
     *
     * @return ç±»å
     */
    public String getImplClassName() {
        return normalizedName(implClass);
    }
    /**
     * èŽ·å–å®žçŽ°è€…çš„æ–¹æ³•åç§°
     *
     * @return æ–¹æ³•名称
     */
    public String getImplMethodName() {
        return implMethodName;
    }
    /**
     * æ­£å¸¸åŒ–类名称,将类名称中的 / æ›¿æ¢ä¸º .
     *
     * @param name åç§°
     * @return æ­£å¸¸çš„类名
     */
    private String normalizedName(String name) {
        return name.replace('/', '.');
    }
    /**
     * @return èŽ·å–å®žä¾‹åŒ–æ–¹æ³•çš„ç±»åž‹
     */
    public Class<?> getInstantiatedType() {
        String instantiatedTypeName = normalizedName(instantiatedMethodType.substring(2, instantiatedMethodType.indexOf(';')));
        return ClassUtils.toClassConfident(instantiatedTypeName);
    }
    /**
     * @return å­—符串形式
     */
    @Override
    public String toString() {
        String interfaceName = getFunctionalInterfaceClassName();
        String implName = getImplClassName();
        return String.format("%s -> %s::%s",
                interfaceName.substring(interfaceName.lastIndexOf('.') + 1),
                implName.substring(implName.lastIndexOf('.') + 1),
                implMethodName);
    }
}
ruoyi-framework/src/main/java/com/ruoyi/framework/mybatis_config/MyBaseMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,15 @@
package com.ruoyi.framework.mybatis_config;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import java.util.List;
/**
 * è‡ªå®šä¹‰æ·»åŠ mybatis-plus批量添加
 * @param <T>
 */
public interface MyBaseMapper <T> extends BaseMapper<T> {
    int insertBatchSomeColumn(List<T> entityList);
}
ruoyi-framework/src/main/java/com/ruoyi/framework/mybatis_config/MyBatisPlusConfig.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,27 @@
package com.ruoyi.framework.mybatis_config;
import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class MyBatisPlusConfig {
    /**
     * éœ€è¦é…ç½®æ‹¦æˆªå™¨ï¼Œä¸ç„¶åœ¨AddDevice中的total无法获取到
     * @return
     */
    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor(){
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
        // ä¹è§‚锁
        interceptor.addInnerInterceptor(new OptimisticLockerInnerInterceptor());
        // åˆ†é¡µé…ç½®
        interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
        return interceptor;
    }
}
ruoyi-framework/src/main/java/com/ruoyi/framework/mybatis_config/MySqlInjector.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,24 @@
package com.ruoyi.framework.mybatis_config;
import com.baomidou.mybatisplus.core.injector.AbstractMethod;
import com.baomidou.mybatisplus.core.injector.DefaultSqlInjector;
import com.baomidou.mybatisplus.core.metadata.TableInfo;
import com.baomidou.mybatisplus.extension.injector.methods.InsertBatchSomeColumn;
import org.springframework.stereotype.Component;
import java.util.List;
/**
 * æ‰¹é‡æ·»åŠ 
 */
@Component
public class MySqlInjector extends DefaultSqlInjector {
    @Override
    public List<AbstractMethod> getMethodList(Class<?> mapperClass, TableInfo tableInfo) {
        List<AbstractMethod> methodList = super.getMethodList(mapperClass, tableInfo);
        //增加自定义方法,字段注解上不等于FieldFill.DEFAULT的字段才会插入
        methodList.add(new InsertBatchSomeColumn(t->!t.isLogicDelete()));
        return methodList;
    }
}
ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/GlobalExceptionHandler.java
@@ -1,6 +1,8 @@
package com.ruoyi.framework.web.exception;
import javax.servlet.http.HttpServletRequest;
import com.ruoyi.common.exception.DemoModeException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.security.access.AccessDeniedException;
@@ -14,7 +16,6 @@
import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.exception.DemoModeException;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.html.EscapeUtil;
ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysDictTypeMapper.java
@@ -1,18 +1,21 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.common.core.domain.entity.SysDictType;
/**
 * å­—典表 æ•°æ®å±‚
 *
 *
 * @author ruoyi
 */
public interface SysDictTypeMapper
{
    /**
     * æ ¹æ®æ¡ä»¶åˆ†é¡µæŸ¥è¯¢å­—典类型
     *
     *
     * @param dictType å­—典类型信息
     * @return å­—典类型集合信息
     */
@@ -20,14 +23,14 @@
    /**
     * æ ¹æ®æ‰€æœ‰å­—典类型
     *
     *
     * @return å­—典类型集合信息
     */
    public List<SysDictType> selectDictTypeAll();
    /**
     * æ ¹æ®å­—典类型ID查询信息
     *
     *
     * @param dictId å­—典类型ID
     * @return å­—典类型
     */
@@ -35,7 +38,7 @@
    /**
     * æ ¹æ®å­—典类型查询信息
     *
     *
     * @param dictType å­—典类型
     * @return å­—典类型
     */
@@ -43,7 +46,7 @@
    /**
     * é€šè¿‡å­—å…¸ID删除字典信息
     *
     *
     * @param dictId å­—å…¸ID
     * @return ç»“æžœ
     */
@@ -51,7 +54,7 @@
    /**
     * æ‰¹é‡åˆ é™¤å­—典类型信息
     *
     *
     * @param dictIds éœ€è¦åˆ é™¤çš„å­—å…¸ID
     * @return ç»“æžœ
     */
@@ -59,7 +62,7 @@
    /**
     * æ–°å¢žå­—典类型信息
     *
     *
     * @param dictType å­—典类型信息
     * @return ç»“æžœ
     */
@@ -67,7 +70,7 @@
    /**
     * ä¿®æ”¹å­—典类型信息
     *
     *
     * @param dictType å­—典类型信息
     * @return ç»“æžœ
     */
@@ -75,9 +78,11 @@
    /**
     * æ ¡éªŒå­—典类型称是否唯一
     *
     *
     * @param dictType å­—典类型
     * @return ç»“æžœ
     */
    public SysDictType checkDictTypeUnique(String dictType);
    List<SysDictType> selectList(String dictName);
}
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysDictTypeService.java
@@ -6,14 +6,14 @@
/**
 * å­—å…¸ ä¸šåС层
 *
 *
 * @author ruoyi
 */
public interface ISysDictTypeService
{
    /**
     * æ ¹æ®æ¡ä»¶åˆ†é¡µæŸ¥è¯¢å­—典类型
     *
     *
     * @param dictType å­—典类型信息
     * @return å­—典类型集合信息
     */
@@ -21,22 +21,30 @@
    /**
     * æ ¹æ®æ‰€æœ‰å­—典类型
     *
     *
     * @return å­—典类型集合信息
     */
    public List<SysDictType> selectDictTypeAll();
    /**
     * æ ¹æ®å­—典类型查询字典数据
     *
     *
     * @param dictType å­—典类型
     * @return å­—典数据集合信息
     */
    public List<SysDictData> selectDictDataByType(String dictType);
    /**
     * æ ¹æ®å­—典名称查询字典数据
     *
     * @param dictName å­—典名称
     * @return å­—典数据集合信息
     */
    public List<SysDictData> selectDictDataByName(String dictName);
    /**
     * æ ¹æ®å­—典类型ID查询信息
     *
     *
     * @param dictId å­—典类型ID
     * @return å­—典类型
     */
@@ -44,7 +52,7 @@
    /**
     * æ ¹æ®å­—典类型查询信息
     *
     *
     * @param dictType å­—典类型
     * @return å­—典类型
     */
@@ -52,7 +60,7 @@
    /**
     * æ‰¹é‡åˆ é™¤å­—典信息
     *
     *
     * @param dictIds éœ€è¦åˆ é™¤çš„å­—å…¸ID
     */
    public void deleteDictTypeByIds(Long[] dictIds);
@@ -74,7 +82,7 @@
    /**
     * æ–°å¢žä¿å­˜å­—典类型信息
     *
     *
     * @param dictType å­—典类型信息
     * @return ç»“æžœ
     */
@@ -82,7 +90,7 @@
    /**
     * ä¿®æ”¹ä¿å­˜å­—典类型信息
     *
     *
     * @param dictType å­—典类型信息
     * @return ç»“æžœ
     */
@@ -90,7 +98,7 @@
    /**
     * æ ¡éªŒå­—典类型称是否唯一
     *
     *
     * @param dictType å­—典类型
     * @return ç»“æžœ
     */
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java
@@ -5,6 +5,8 @@
import java.util.Map;
import java.util.stream.Collectors;
import javax.annotation.PostConstruct;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -20,7 +22,7 @@
/**
 * å­—å…¸ ä¸šåŠ¡å±‚å¤„ç†
 *
 *
 * @author ruoyi
 */
@Service
@@ -43,7 +45,7 @@
    /**
     * æ ¹æ®æ¡ä»¶åˆ†é¡µæŸ¥è¯¢å­—典类型
     *
     *
     * @param dictType å­—典类型信息
     * @return å­—典类型集合信息
     */
@@ -55,7 +57,7 @@
    /**
     * æ ¹æ®æ‰€æœ‰å­—典类型
     *
     *
     * @return å­—典类型集合信息
     */
    @Override
@@ -66,7 +68,7 @@
    /**
     * æ ¹æ®å­—典类型查询字典数据
     *
     *
     * @param dictType å­—典类型
     * @return å­—典数据集合信息
     */
@@ -88,8 +90,21 @@
    }
    /**
     * æ ¹æ®å­—典名称查询字典数据
     *
     * @param dictName å­—典名称
     * @return å­—典数据集合信息
     */
    @Override
    public List<SysDictData> selectDictDataByName(String dictName)
    {
        List<SysDictType> sysDictTypes = dictTypeMapper.selectList(dictName);
        return selectDictDataByType(sysDictTypes.get(0).getDictType());
    }
    /**
     * æ ¹æ®å­—典类型ID查询信息
     *
     *
     * @param dictId å­—典类型ID
     * @return å­—典类型
     */
@@ -101,7 +116,7 @@
    /**
     * æ ¹æ®å­—典类型查询信息
     *
     *
     * @param dictType å­—典类型
     * @return å­—典类型
     */
@@ -113,7 +128,7 @@
    /**
     * æ‰¹é‡åˆ é™¤å­—典类型信息
     *
     *
     * @param dictIds éœ€è¦åˆ é™¤çš„å­—å…¸ID
     */
    @Override
@@ -167,7 +182,7 @@
    /**
     * æ–°å¢žä¿å­˜å­—典类型信息
     *
     *
     * @param dict å­—典类型信息
     * @return ç»“æžœ
     */
@@ -184,7 +199,7 @@
    /**
     * ä¿®æ”¹ä¿å­˜å­—典类型信息
     *
     *
     * @param dict å­—典类型信息
     * @return ç»“æžœ
     */
@@ -205,7 +220,7 @@
    /**
     * æ ¡éªŒå­—典类型称是否唯一
     *
     *
     * @param dict å­—典类型
     * @return ç»“æžœ
     */
ruoyi-system/src/main/resources/mapper/system/SysDictTypeMapper.xml
@@ -1,105 +1,143 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.SysDictTypeMapper">
    <resultMap type="SysDictType" id="SysDictTypeResult">
        <id property="dictId" column="dict_id"/>
        <result property="dictName" column="dict_name"/>
        <result property="dictType" column="dict_type"/>
        <result property="status" column="status"/>
        <result property="createBy" column="create_by"/>
        <result property="createTime" column="create_time"/>
        <result property="updateBy" column="update_by"/>
        <result property="updateTime" column="update_time"/>
    </resultMap>
    <resultMap type="SysDictType" id="SysDictTypeResult">
        <id     property="dictId"     column="dict_id"     />
        <result property="dictName"   column="dict_name"   />
        <result property="dictType"   column="dict_type"   />
        <result property="status"     column="status"      />
        <result property="createBy"   column="create_by"   />
        <result property="createTime" column="create_time" />
        <result property="updateBy"   column="update_by"   />
        <result property="updateTime" column="update_time" />
    </resultMap>
    <sql id="selectDictTypeVo">
        select dict_id, dict_name, dict_type, status, create_by, create_time, remark
        from sys_dict_type
    <sql id="selectDictTypeVo">
        select dict_id, dict_name, dict_type, status, create_by, create_time, remark
        from sys_dict_type
    </sql>
    <select id="selectDictTypeList" parameterType="SysDictType" resultMap="SysDictTypeResult">
        <include refid="selectDictTypeVo"/>
        <where>
            <if test="dictName != null and dictName != ''">
                AND dict_name like concat('%', #{dictName}, '%')
            </if>
            <if test="status != null and status != ''">
                AND status = #{status}
            </if>
            <if test="dictType != null and dictType != ''">
                AND dict_type like concat('%', #{dictType}, '%')
            </if>
            <if test="params.beginTime != null and params.beginTime != ''"><!-- å¼€å§‹æ—¶é—´æ£€ç´¢ -->
                and date_format(create_time,'%Y%m%d') &gt;= date_format(#{params.beginTime},'%Y%m%d')
            </if>
            <if test="params.endTime != null and params.endTime != ''"><!-- ç»“束时间检索 -->
                and date_format(create_time,'%Y%m%d') &lt;= date_format(#{params.endTime},'%Y%m%d')
            </if>
        </where>
    </select>
    <select id="selectDictTypeAll" resultMap="SysDictTypeResult">
        <include refid="selectDictTypeVo"/>
    </select>
    <select id="selectDictTypeById" parameterType="Long" resultMap="SysDictTypeResult">
        <include refid="selectDictTypeVo"/>
        where dict_id = #{dictId}
    </select>
    <select id="selectDictTypeByType" parameterType="String" resultMap="SysDictTypeResult">
        <include refid="selectDictTypeVo"/>
        where dict_type = #{dictType}
    </select>
    <select id="checkDictTypeUnique" parameterType="String" resultMap="SysDictTypeResult">
        <include refid="selectDictTypeVo"/>
        where dict_type = #{dictType} limit 1
    </select>
    <delete id="deleteDictTypeById" parameterType="Long">
         delete from sys_dict_type where dict_id = #{dictId}
     </delete>
     <delete id="deleteDictTypeByIds" parameterType="Long">
         delete from sys_dict_type where dict_id in
         <foreach collection="array" item="dictId" open="(" separator="," close=")">
             #{dictId}
        </foreach>
     </delete>
    <select id="selectDictTypeList" parameterType="SysDictType" resultMap="SysDictTypeResult">
        <include refid="selectDictTypeVo"/>
        <where>
            <if test="dictName != null and dictName != ''">
                AND dict_name like concat('%', #{dictName}, '%')
            </if>
            <if test="status != null and status != ''">
                AND status = #{status}
            </if>
            <if test="dictType != null and dictType != ''">
                AND dict_type like concat('%', #{dictType}, '%')
            </if>
            <if test="params.beginTime != null and params.beginTime != ''">
                <!-- å¼€å§‹æ—¶é—´æ£€ç´¢ -->
                and date_format(create_time,'%Y%m%d') &gt;= date_format(#{params.beginTime},'%Y%m%d')
            </if>
            <if test="params.endTime != null and params.endTime != ''">
                <!-- ç»“束时间检索 -->
                and date_format(create_time,'%Y%m%d') &lt;= date_format(#{params.endTime},'%Y%m%d')
            </if>
        </where>
    </select>
     <update id="updateDictType" parameterType="SysDictType">
         update sys_dict_type
         <set>
             <if test="dictName != null and dictName != ''">dict_name = #{dictName},</if>
             <if test="dictType != null and dictType != ''">dict_type = #{dictType},</if>
             <if test="status != null">status = #{status},</if>
             <if test="remark != null">remark = #{remark},</if>
             <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
             update_time = sysdate()
         </set>
         where dict_id = #{dictId}
    </update>
     <insert id="insertDictType" parameterType="SysDictType">
         insert into sys_dict_type(
             <if test="dictName != null and dictName != ''">dict_name,</if>
             <if test="dictType != null and dictType != ''">dict_type,</if>
             <if test="status != null">status,</if>
             <if test="remark != null and remark != ''">remark,</if>
             <if test="createBy != null and createBy != ''">create_by,</if>
             create_time
         )values(
             <if test="dictName != null and dictName != ''">#{dictName},</if>
             <if test="dictType != null and dictType != ''">#{dictType},</if>
             <if test="status != null">#{status},</if>
             <if test="remark != null and remark != ''">#{remark},</if>
             <if test="createBy != null and createBy != ''">#{createBy},</if>
             sysdate()
         )
    </insert>
</mapper>
    <select id="selectDictTypeAll" resultMap="SysDictTypeResult">
        <include refid="selectDictTypeVo"/>
    </select>
    <select id="selectDictTypeById" parameterType="Long" resultMap="SysDictTypeResult">
        <include refid="selectDictTypeVo"/>
        where dict_id = #{dictId}
    </select>
    <select id="selectDictTypeByType" parameterType="String" resultMap="SysDictTypeResult">
        <include refid="selectDictTypeVo"/>
        where dict_type = #{dictType}
    </select>
    <select id="checkDictTypeUnique" parameterType="String" resultMap="SysDictTypeResult">
        <include refid="selectDictTypeVo"/>
        where dict_type = #{dictType} limit 1
    </select>
    <delete id="deleteDictTypeById" parameterType="Long">
        delete
        from sys_dict_type
        where dict_id = #{dictId}
    </delete>
    <delete id="deleteDictTypeByIds" parameterType="Long">
        delete from sys_dict_type where dict_id in
        <foreach collection="array" item="dictId" open="(" separator="," close=")">
            #{dictId}
        </foreach>
    </delete>
    <update id="updateDictType" parameterType="SysDictType">
        update sys_dict_type
        <set>
            <if test="dictName != null and dictName != ''">
                dict_name = #{dictName},
            </if>
            <if test="dictType != null and dictType != ''">
                dict_type = #{dictType},
            </if>
            <if test="status != null">
                status = #{status},
            </if>
            <if test="remark != null">
                remark = #{remark},
            </if>
            <if test="updateBy != null and updateBy != ''">
                update_by = #{updateBy},
            </if>
            update_time = sysdate()
        </set>
        where dict_id = #{dictId}
    </update>
    <insert id="insertDictType" parameterType="SysDictType">
        insert into sys_dict_type(
        <if test="dictName != null and dictName != ''">
            dict_name,
        </if>
        <if test="dictType != null and dictType != ''">
            dict_type,
        </if>
        <if test="status != null">
            status,
        </if>
        <if test="remark != null and remark != ''">
            remark,
        </if>
        <if test="createBy != null and createBy != ''">
            create_by,
        </if>
        create_time
        )values(
        <if test="dictName != null and dictName != ''">
            #{dictName},
        </if>
        <if test="dictType != null and dictType != ''">
            #{dictType},
        </if>
        <if test="status != null">
            #{status},
        </if>
        <if test="remark != null and remark != ''">
            #{remark},
        </if>
        <if test="createBy != null and createBy != ''">
            #{createBy},
        </if>
        sysdate()
        )
    </insert>
    <select id="selectList" resultType="com.ruoyi.common.core.domain.entity.SysDictType">
        select *
        from sys_dict_type
        where dict_name = #{dictName}
    </select>
</mapper>