25 lines
685 B
Java
25 lines
685 B
Java
package com.example.nto.service;
|
|
import com.example.nto.entity.Place;
|
|
import com.example.nto.repository.PlaceRepository;
|
|
import jakarta.annotation.PostConstruct;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
@Service
|
|
public class PlaceServise {
|
|
private final PlaceRepository placeRepository;
|
|
public PlaceServise(PlaceRepository placeRepository) {
|
|
this.placeRepository = placeRepository;
|
|
}
|
|
|
|
@PostConstruct
|
|
public void Places() {
|
|
if(placeRepository.count() == 0) {
|
|
placeRepository.save(new Place(1,"K-19"));
|
|
placeRepository.save(new Place(2,"M-16"));
|
|
placeRepository.save(new Place(3,"T-1"));
|
|
}
|
|
}
|
|
|
|
}
|
|
|