zss
2023-07-26 f330903e12d38af89d61f16c96856924d241a0f2
inspection-server/src/main/java/com/yuanchu/limslaboratory/service/impl/InspectionMaterialListServiceImpl.java
@@ -37,13 +37,18 @@
    ProductMapper productMapper;
    @Resource
    InspectionProductListService inspectionProductListService;
    @Resource
    InspectionProductListMapper inspectionProductListMapper;
    //查询检验单里面的物料信息
    @Override
    public List<InspectionMaterialList> selectInspectionMaterialListByInsId(String insId) {
        return inspectionMaterialListMapper.selectInspectionMaterialListByInsId(insId);
    }
    //添加检验单中的检验样品
    @Override
    @Transactional(rollbackFor = Exception.class)
    public InspectionMaterialList addInspectionMaterialList(InspectionMaterialList inspectionMaterialList,String userId) {
@@ -62,6 +67,7 @@
                    .setUserId(Integer.parseInt(userId));
            list1.add(inspectionProductList);
        });
        //添加检验项目
        int judge2 = inspectionProductListMapper.addInspectionProductList(list1);
        return judge>0&&judge2>0?inspectionMaterialList:null;
    }
@@ -75,19 +81,16 @@
        list.setState(0);
        list.setId(inspectionMaterialListId);
        int judge1 = inspectionMaterialListMapper.updateById(list);
        //删除样品检验项目
        UpdateWrapper<InspectionProductList> wrapper = new UpdateWrapper<>();
        wrapper.eq("inspection_material_list_id", inspectionMaterialListId).set("state", 0);
        int judge2 = inspectionProductListMapper.update(new InspectionProductList(), wrapper);
        //根据样品id删除检验样品中的检验项目
        int judge2 = inspectionProductListService.delInspectionProductList(inspectionMaterialListId);
        return judge1>0&&judge2>0;
    }
    //修改样品信息
    //根据样品id修改样品信息
    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean updateInspectionMaterialList( Integer inspectionMaterialListId,InspectionMaterialList inspectionMaterialList) {
        LambdaUpdateWrapper<InspectionMaterialList> updateWrapper = new LambdaUpdateWrapper<>();
        //根据样品id查询
        updateWrapper.eq(InspectionMaterialList::getId,inspectionMaterialListId);
        int judge = inspectionMaterialListMapper.update(inspectionMaterialList, updateWrapper);
        return judge>0;