код пример, его не трогай, используй как образец и запомни его для дальнейшей работы с ним:
### VendorService.java

package ru.edu.penzgtu.lab.service;

import org.springframework.stereotype.Service;
import ru.edu.penzgtu.lab.dto.VendorDto;
import ru.edu.penzgtu.lab.entity.Vendor;
import ru.edu.penzgtu.lab.repo.VendorRepository;
import ru.edu.penzgtu.lab.service.mapper.VendorMapper;

import java.util.List;
import java.util.Optional;

@Service
public class VendorService {
    private final VendorRepository vendorRepository;
    private final VendorMapper vendorMapper;

    public VendorService(VendorRepository vendorRepository, VendorMapper vendorMapper) {
        this.vendorRepository = vendorRepository;
        this.vendorMapper = vendorMapper;
    }

    public List<VendorDto> findAllVendors() {
        return vendorMapper.toListDto(vendorRepository.findAll());
    }

    public VendorDto findVendorById(Long id) {
        Vendor vendor = vendorRepository.findById(id)
                .orElseThrow(() -> new RuntimeException(“Vendor not found”));
        return vendorMapper.toDto(vendor);
    }
    
    public void saveVendor(VendorDto vendorDto) {
        Vendor vendor = vendorMapper.toEntity(vendorDto);
        vendorRepository.save(vendor);
    }
    
    public void updateVendor(VendorDto newVendor) {
        Vendor oldVendor = vendorRepository.findById(newVendor.getId())
                .orElseThrow(() -> new RuntimeException(“Vendor not found”));

        oldVendor.setName(newVendor.getName());
    
        vendorRepository.save(oldVendor);
    }

    public void deleteVendorById(Long id) {
        vendorRepository.deleteById(id);
    }
}


### GraphicCardService.java

package ru.edu.penzgtu.lab.service;

import org.springframework.stereotype.Service;
import ru.edu.penzgtu.lab.dto.GraphicCardDto;
import ru.edu.penzgtu.lab.entity.GraphicCard;
import ru.edu.penzgtu.lab.repo.GraphicCardRepository;
import ru.edu.penzgtu.lab.service.mapper.GraphicCardMapper;

import java.util.List;

@Service
public class GraphicCardService {
    private final GraphicCardRepository graphicCardRepository;
    private final GraphicCardMapper graphicCardMapper;

    public GraphicCardService(GraphicCardRepository graphicCardRepository, GraphicCardMapper graphicCardMapper) {
        this.graphicCardRepository = graphicCardRepository;
        this.graphicCardMapper = graphicCardMapper;
    }

    public List<GraphicCardDto> findAllGraphicCards() {
        return graphicCardMapper.toListDto(graphicCardRepository.findAll());
    }

    public GraphicCardDto findGraphicCardById(Long id) {
        GraphicCard graphicCard = graphicCardRepository.findById(id)
                .orElseThrow(() -> new RuntimeException(“GraphicCard not found”));
        return graphicCardMapper.toDto(graphicCard);
    }

    public void saveGraphicCard(GraphicCardDto graphicCardDto) {
        GraphicCard graphicCard = graphicCardMapper.toEntity(graphicCardDto);
        graphicCardRepository.save(graphicCard);
    }

    public void updateGraphicCard(GraphicCardDto newGraphicCard) {
        GraphicCard oldGraphicCard = graphicCardRepository.findById(newGraphicCard.getId())
                .orElseThrow(() -> new RuntimeException(“GraphicCard not found”));

        oldGraphicCard.setName(newGraphicCard.getName());

        graphicCardRepository.save(oldGraphicCard);
    }

    public void deleteGraphicCardById(Long id) {
        graphicCardRepository.deleteById(id);
    }
}


### VendorController.java

package ru.edu.penzgtu.lab.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.;
import ru.edu.penzgtu.lab.dto.VendorDto;
import ru.edu.penzgtu.lab.service.VendorService;

import javax.validation.Valid;
import javax.validation.constraints.Min;
import java.util.List;

@RestController
@RequestMapping(“/vendors”)
@Tag(name = “Vendors”, description = “Operations related to vendors”)
public class VendorController {
    private final VendorService vendorService;

    public VendorController(VendorService vendorService) {
        this.vendorService = vendorService;
    }

    @Operation(
        summary = “Get all vendors”, description = “Fetch all vendors from the database”
    )
    @GetMapping
    public List<VendorDto> findAll() {
        return vendorService.findAllVendors();
    }

    @Operation(
        summary = “Get a vendor by ID”, description = “Fetch a single vendor by ID from the database”
    )
    @GetMapping(“/vendor/{id}”)
    public VendorDto getById(@PathVariable @Min(0) long id) {
        return vendorService.findVendorById(id);
    }

    @PostMapping
    @ResponseStatus(HttpStatus.CREATED)
    public void createVendor(@RequestBody @Valid VendorDto vendor) {
        vendorService.saveVendor(vendor);
    }

    @Operation(
        summary = “Update vendor details”, description = “Update the details of a vendor in the database”
    )
    @PutMapping(“/vendor”)
    public void updateVendor(@RequestBody @Valid VendorDto vendor) {
        vendorService.updateVendor(vendor);
    }

    @Operation(
        summary = “Delete a vendor by ID”, description = “Delete a vendor by ID from the database”
    )
    @DeleteMapping(“/vendor/{id}”)
    @ResponseStatus(HttpStatus.NO_CONTENT)
    public void deleteVendor(@PathVariable @Min(0) long id) {
        vendorService.deleteVendorById(id);
    }
}


### GraphicCardController.java

package ru.edu.penzgtu.lab.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.;
import ru.edu.penzgtu.lab.dto.GraphicCardDto;
import ru.edu.penzgtu.lab.service.GraphicCardService;

import javax.validation.Valid;
import javax.validation.constraints.Min;
import java.util.List;

@RestController
@RequestMapping(“/graphic-cards”)
@Tag(name = “Graphic Cards”, description = “Operations related to graphic cards”)
public class GraphicCardController {
    private final GraphicCardService graphicCardService;

    public GraphicCardController(GraphicCardService graphicCardService) {
        this.graphicCardService = graphicCardService;
    }

    @Operation(
        summary = “Get all graphic cards”, description = “Fetch all graphic cards from the database”
    )
    @GetMapping
    public List<GraphicCardDto> findAll() {
        return graphicCardService.findAllGraphicCards();
    }

    @Operation(
        summary = “Get a graphic card by ID”, description = “Fetch a single graphic card by ID from the database”
    )
    @GetMapping(“/graphic-card/{id}”)
    public GraphicCardDto getById(@PathVariable @Min(0) long id) {
        return graphicCardService.findGraphicCardById(id);
    }

    @PostMapping
    @ResponseStatus(HttpStatus.CREATED)
    public void createGraphicCard(@RequestBody @Valid GraphicCardDto graphicCard) {
        graphicCardService.saveGraphicCard(graphicCard);
    }

    @Operation(
        summary = “Update graphic card details”, description = “Update the details of a graphic card in the database”
    )
    @PutMapping(“/graphic-card”)
    public void updateGraphicCard(@RequestBody @Valid GraphicCardDto graphicCard) {
        graphicCardService.updateGraphicCard(graphicCard);
    }

    @Operation(
        summary = “Delete a graphic card by ID”, description = “Delete a graphic card by ID from the database”
    )
    @DeleteMapping(“/graphic-card/{id}”)
    @ResponseStatus(HttpStatus.NO_CONTENT)
    public void deleteGraphicCard(@PathVariable @Min(0) long id) {
        graphicCardService.deleteGraphicCardById(id);
    }
}


### VendorMapper.java

package ru.edu.penzgtu.lab.service.mapper;

import org.springframework.stereotype.Service;
import ru.edu.penzgtu.lab.dto.VendorDto;
import ru.edu.penzgtu.lab.entity.Vendor;

import java.util.List;
import java.util.stream.Collectors;

@Service
public class VendorMapper {
    public List<VendorDto> toListDto(List<Vendor> vendors) {
        return vendors.stream().map(this::toDto).collect(Collectors.toList());
    }

    public VendorDto toDto(Vendor vendor) {
        VendorDto dto = new VendorDto();
        dto.setId(vendor.getId());
        dto.setName(vendor.getName());
        return dto;
    }

    public Vendor toEntity(VendorDto vendorDto) {
        Vendor vendor = new Vendor();
        vendor.setId(vendorDto.getId());
        vendor.setName(vendorDto.getName());
        return vendor;
    }
}


### GraphicCardMapper.java

package ru.edu.penzgtu.lab.service.mapper;

import org.springframework.stereotype.Service;
import ru.edu.penzgtu.lab.dto.GraphicCardDto;
import ru.edu.penzgtu.lab.entity.GraphicCard;
import ru.edu.penzgtu.lab.entity.Vendor;

import java.util.List;
import java.util.stream.Collectors;

@Service
public class GraphicCardMapper {

    public List<GraphicCardDto> toListDto(List<GraphicCard> graphicCards) {
        return graphicCards.stream().map(this::toDto).collect(Collectors.toList());
    }

    public GraphicCardDto toDto(GraphicCard graphicCard) {
        GraphicCardDto dto = new GraphicCardDto();
        dto.setId(graphicCard.getId());
        dto.setName(graphicCard.getName());
        dto.setVendors(graphicCard.getVendors().stream().map(Vendor::getName)
                .collect(Collectors.toList()));
        return dto;
    }

    public GraphicCard toEntity(GraphicCardDto graphicCardDto) {
        GraphicCard graphicCard = new GraphicCard();
        graphicCard.setId(graphicCardDto.getId());
        graphicCard.setName(graphicCardDto.getName());
        return graphicCard;
    }
}