Win
This commit is contained in:
25
src/main/java/com/example/nto/service/PlaceServise.java
Normal file
25
src/main/java/com/example/nto/service/PlaceServise.java
Normal file
@@ -0,0 +1,25 @@
|
||||
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"));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user