XiaoRuby
2023-07-26 cdaff9ab0d1b676e3b429171d6de0887c98f488c
inspection-server/src/main/java/com/yuanchu/limslaboratory/service/impl/InspectionMaterialListServiceImpl.java
@@ -53,7 +53,6 @@
        list.forEach(a-> {
            InspectionProductList inspectionProductList = new InspectionProductList();
            inspectionProductList.setName(a.getName())
                    .setMethod(a.getMethod())
                    .setUnit(a.getUnit())
                    .setRequired(a.getRequired())
                    .setInternal(a.getInternal())
@@ -66,23 +65,28 @@
        return judge>0&&judge2>0?inspectionMaterialList:null;
    }
    //根据样品id删除检验样品
    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean delInspectionMaterialListByInsId(int inspectionMaterialListId) {
        //删除检验样品
        InspectionMaterialList list = new InspectionMaterialList();
        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);
        return judge1>0&&judge2>0;
    }
    //修改样品信息
    @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;