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

package ru.edu.penzgtu.lab;

import io.swagger.v3.oas.annotations.OpenAPIDefinition;
import io.swagger.v3.oas.annotations.info.Contact;
import io.swagger.v3.oas.annotations.info.Info;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@OpenAPIDefinition(
       info = @Info(
             title = “PenzGTU Java Lab API”,
             description = “API for managing graphic cards and vendors”, version = “1.0.0”,
             contact = @Contact(
                   name = “name”,
                   email = “email”
             )
       )
)

@SpringBootApplication
public class LabApplication {

    public static void main(String[] args) {
       SpringApplication.run(LabApplication.class, args);
    }
}


### Vendor.java

package ru.edu.penzgtu.lab.entity;

import jakarta.validation.constraints.NotNull;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import jakarta.persistence.;
import java.util.List;

@Entity
@Table(name = “vendors”)
@Getter
@Setter
@NoArgsConstructor
@EqualsAndHashCode
public class Vendor {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = “id”)
    private Long id;

    @NotNull
    @Column(name = “name”)
    private String name;

    @ManyToMany(cascade = CascadeType.ALL)
    @JoinTable(
      name = “vendors_graphic_cards”,
      joinColumns = @JoinColumn(name = “vendor_id”, referencedColumnName = “id”),
      inverseJoinColumns = @JoinColumn(name = “graphic_card_id”, referencedColumnName = “id”)
    )
    private List<GraphicCard> graphicCards;
}


### GraphicCard.java

package ru.edu.penzgtu.lab.entity;

import jakarta.persistence.;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.util.List;

@Entity
@Table(name = “graphic_cards”)
@Getter
@Setter
@NoArgsConstructor
@EqualsAndHashCode
public class GraphicCard {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = “id”)
    private Long id;

    @Column(name = “name”)
    private String name;

    @ManyToMany(mappedBy = “graphicCards”)
    private List<Vendor> vendors;
}


### VendorRepository.java

package ru.edu.penzgtu.lab.repo;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import ru.edu.penzgtu.lab.entity.Vendor;

@Repository
public interface VendorRepository extends JpaRepository<Vendor, Long> {
    Vendor findByName(String name);
}


### GraphicCardRepository.java

package ru.edu.penzgtu.lab.repo;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import ru.edu.penzgtu.lab.entity.GraphicCard;

@Repository
public interface GraphicCardRepository extends JpaRepository<GraphicCard, Long> {
    GraphicCard findByName(String name);
}


### 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);
    }
}