feat: 들여쓰기
This commit is contained in:
21
build.gradle
21
build.gradle
@@ -60,30 +60,13 @@ bootJar {
|
|||||||
archiveFileName = 'ROOT.jar'
|
archiveFileName = 'ROOT.jar'
|
||||||
}
|
}
|
||||||
|
|
||||||
// Spotless configuration for code formatting
|
// Spotless configuration for code formatting (2-space indent)
|
||||||
//spotless {
|
|
||||||
// java {
|
|
||||||
// target 'src/**/*.java'
|
|
||||||
// googleJavaFormat('1.19.2').aosp().reflowLongStrings()
|
|
||||||
// indentWithSpaces(2)
|
|
||||||
// trimTrailingWhitespace()
|
|
||||||
// endWithNewline()
|
|
||||||
// importOrder()
|
|
||||||
// removeUnusedImports()
|
|
||||||
// formatAnnotations()
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
|
|
||||||
spotless {
|
spotless {
|
||||||
java {
|
java {
|
||||||
target 'src/**/*.java'
|
target 'src/**/*.java'
|
||||||
indentWithSpaces(2)
|
googleJavaFormat('1.19.2') // Default Google Style = 2 spaces (NO .aosp()!)
|
||||||
trimTrailingWhitespace()
|
trimTrailingWhitespace()
|
||||||
endWithNewline()
|
endWithNewline()
|
||||||
importOrder()
|
|
||||||
removeUnusedImports()
|
|
||||||
formatAnnotations()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,8 +20,7 @@ public class StartupLogger {
|
|||||||
@EventListener(ApplicationReadyEvent.class)
|
@EventListener(ApplicationReadyEvent.class)
|
||||||
public void logStartupInfo() {
|
public void logStartupInfo() {
|
||||||
String[] activeProfiles = environment.getActiveProfiles();
|
String[] activeProfiles = environment.getActiveProfiles();
|
||||||
String profileInfo =
|
String profileInfo = activeProfiles.length > 0 ? String.join(", ", activeProfiles) : "default";
|
||||||
activeProfiles.length > 0 ? String.join(", ", activeProfiles) : "default";
|
|
||||||
|
|
||||||
// Database connection information
|
// Database connection information
|
||||||
String dbUrl = environment.getProperty("spring.datasource.url");
|
String dbUrl = environment.getProperty("spring.datasource.url");
|
||||||
@@ -51,8 +50,7 @@ public class StartupLogger {
|
|||||||
String batchSize =
|
String batchSize =
|
||||||
environment.getProperty("spring.jpa.properties.hibernate.jdbc.batch_size", "N/A");
|
environment.getProperty("spring.jpa.properties.hibernate.jdbc.batch_size", "N/A");
|
||||||
String batchFetchSize =
|
String batchFetchSize =
|
||||||
environment.getProperty(
|
environment.getProperty("spring.jpa.properties.hibernate.default_batch_fetch_size", "N/A");
|
||||||
"spring.jpa.properties.hibernate.default_batch_fetch_size", "N/A");
|
|
||||||
|
|
||||||
String startupMessage =
|
String startupMessage =
|
||||||
String.format(
|
String.format(
|
||||||
|
|||||||
@@ -26,10 +26,7 @@ public class AnimalCoreService
|
|||||||
AnimalEntity getZoo =
|
AnimalEntity getZoo =
|
||||||
animalRepository
|
animalRepository
|
||||||
.getAnimalByUuid(uuid)
|
.getAnimalByUuid(uuid)
|
||||||
.orElseThrow(
|
.orElseThrow(() -> new EntityNotFoundException("Zoo not found with uuid: " + uuid));
|
||||||
() ->
|
|
||||||
new EntityNotFoundException(
|
|
||||||
"Zoo not found with uuid: " + uuid));
|
|
||||||
return getZoo.toDto();
|
return getZoo.toDto();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,12 +39,9 @@ public class AnimalCoreService
|
|||||||
zooRepository
|
zooRepository
|
||||||
.getZooByUid(req.getZooId())
|
.getZooByUid(req.getZooId())
|
||||||
.orElseThrow(
|
.orElseThrow(
|
||||||
() ->
|
() -> new EntityNotFoundException(" not found with id: " + req.getZooId()));
|
||||||
new EntityNotFoundException(
|
|
||||||
"Zoo not found with id: " + req.getZooId()));
|
|
||||||
}
|
}
|
||||||
AnimalEntity entity =
|
AnimalEntity entity = new AnimalEntity(req.getCategory(), req.getSpecies(), req.getName(), zoo);
|
||||||
new AnimalEntity(req.getCategory(), req.getSpecies(), req.getName(), zoo);
|
|
||||||
AnimalEntity saved = animalRepository.save(entity);
|
AnimalEntity saved = animalRepository.save(entity);
|
||||||
return saved.toDto();
|
return saved.toDto();
|
||||||
}
|
}
|
||||||
@@ -55,28 +49,26 @@ public class AnimalCoreService
|
|||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public void remove(Long id) {
|
public void remove(Long id) {
|
||||||
AnimalEntity getZoo =
|
AnimalEntity getAnimal =
|
||||||
animalRepository
|
animalRepository
|
||||||
.getAnimalByUid(id)
|
.getAnimalByUid(id)
|
||||||
.orElseThrow(
|
.orElseThrow(() -> new EntityNotFoundException("getAnimal not found with id: " + id));
|
||||||
() -> new EntityNotFoundException("Zoo not found with id: " + id));
|
getAnimal.deleted();
|
||||||
getZoo.deleted();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AnimalDto.Basic getOneById(Long id) {
|
public AnimalDto.Basic getOneById(Long id) {
|
||||||
AnimalEntity getZoo =
|
AnimalEntity getAnimal =
|
||||||
animalRepository
|
animalRepository
|
||||||
.getAnimalByUid(id)
|
.getAnimalByUid(id)
|
||||||
.orElseThrow(
|
.orElseThrow(() -> new EntityNotFoundException("Zoo not found with id: " + id));
|
||||||
() -> new EntityNotFoundException("Zoo not found with id: " + id));
|
return getAnimal.toDto();
|
||||||
return getZoo.toDto();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<AnimalDto.Basic> search(AnimalDto.SearchReq searchReq) {
|
public Page<AnimalDto.Basic> search(AnimalDto.SearchReq searchReq) {
|
||||||
|
|
||||||
Page<AnimalEntity> zooEntities = animalRepository.listAnimal(searchReq);
|
Page<AnimalEntity> animalEntities = animalRepository.listAnimal(searchReq);
|
||||||
return zooEntities.map(AnimalEntity::toDto);
|
return animalEntities.map(AnimalEntity::toDto);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,10 +22,7 @@ public class ZooCoreService implements BaseCoreService<ZooDto.Detail, Long, ZooD
|
|||||||
ZooEntity zoo =
|
ZooEntity zoo =
|
||||||
zooRepository
|
zooRepository
|
||||||
.getZooByUuid(uuid)
|
.getZooByUuid(uuid)
|
||||||
.orElseThrow(
|
.orElseThrow(() -> new EntityNotFoundException("Zoo not found with uuid: " + uuid));
|
||||||
() ->
|
|
||||||
new EntityNotFoundException(
|
|
||||||
"Zoo not found with uuid: " + uuid));
|
|
||||||
return toDetailDto(zoo);
|
return toDetailDto(zoo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,8 +40,7 @@ public class ZooCoreService implements BaseCoreService<ZooDto.Detail, Long, ZooD
|
|||||||
ZooEntity zoo =
|
ZooEntity zoo =
|
||||||
zooRepository
|
zooRepository
|
||||||
.getZooByUid(id)
|
.getZooByUid(id)
|
||||||
.orElseThrow(
|
.orElseThrow(() -> new EntityNotFoundException("Zoo not found with id: " + id));
|
||||||
() -> new EntityNotFoundException("Zoo not found with id: " + id));
|
|
||||||
zoo.deleted();
|
zoo.deleted();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,8 +49,7 @@ public class ZooCoreService implements BaseCoreService<ZooDto.Detail, Long, ZooD
|
|||||||
ZooEntity zoo =
|
ZooEntity zoo =
|
||||||
zooRepository
|
zooRepository
|
||||||
.getZooByUid(id)
|
.getZooByUid(id)
|
||||||
.orElseThrow(
|
.orElseThrow(() -> new EntityNotFoundException("Zoo not found with id: " + id));
|
||||||
() -> new EntityNotFoundException("Zoo not found with id: " + id));
|
|
||||||
return toDetailDto(zoo);
|
return toDetailDto(zoo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,10 +36,7 @@ public class AnimalRepositoryImpl extends QuerydslRepositorySupport
|
|||||||
QAnimalEntity animal = QAnimalEntity.animalEntity;
|
QAnimalEntity animal = QAnimalEntity.animalEntity;
|
||||||
|
|
||||||
return Optional.ofNullable(
|
return Optional.ofNullable(
|
||||||
queryFactory
|
queryFactory.selectFrom(animal).where(animal.uuid.eq(UUID.fromString(uuid))).fetchFirst());
|
||||||
.selectFrom(animal)
|
|
||||||
.where(animal.uuid.eq(UUID.fromString(uuid)))
|
|
||||||
.fetchFirst());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -39,7 +39,8 @@ public class ZooRepositoryImpl implements ZooRepositoryCustom {
|
|||||||
long total = query.fetchCount();
|
long total = query.fetchCount();
|
||||||
|
|
||||||
List<ZooEntity> content =
|
List<ZooEntity> content =
|
||||||
query.offset(pageable.getOffset())
|
query
|
||||||
|
.offset(pageable.getOffset())
|
||||||
.limit(pageable.getPageSize())
|
.limit(pageable.getPageSize())
|
||||||
.orderBy(qZoo.createdDate.desc())
|
.orderBy(qZoo.createdDate.desc())
|
||||||
.fetch();
|
.fetch();
|
||||||
@@ -59,10 +60,7 @@ public class ZooRepositoryImpl implements ZooRepositoryCustom {
|
|||||||
@Override
|
@Override
|
||||||
public Optional<ZooEntity> getZooByUid(Long uid) {
|
public Optional<ZooEntity> getZooByUid(Long uid) {
|
||||||
return Optional.ofNullable(
|
return Optional.ofNullable(
|
||||||
queryFactory
|
queryFactory.selectFrom(qZoo).where(qZoo.uid.eq(uid), qZoo.isDeleted.eq(false)).fetchOne());
|
||||||
.selectFrom(qZoo)
|
|
||||||
.where(qZoo.uid.eq(uid), qZoo.isDeleted.eq(false))
|
|
||||||
.fetchOne());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -29,8 +29,7 @@ public class AnimalDto {
|
|||||||
@Getter
|
@Getter
|
||||||
public static class Basic {
|
public static class Basic {
|
||||||
|
|
||||||
@JsonIgnore
|
@JsonIgnore private Long id;
|
||||||
private Long id;
|
|
||||||
private String uuid;
|
private String uuid;
|
||||||
private Category category;
|
private Category category;
|
||||||
private Species species;
|
private Species species;
|
||||||
@@ -120,9 +119,7 @@ public class AnimalDto {
|
|||||||
String[] sortParams = sort.split(",");
|
String[] sortParams = sort.split(",");
|
||||||
String property = sortParams[0];
|
String property = sortParams[0];
|
||||||
Sort.Direction direction =
|
Sort.Direction direction =
|
||||||
sortParams.length > 1
|
sortParams.length > 1 ? Sort.Direction.fromString(sortParams[1]) : Sort.Direction.ASC;
|
||||||
? Sort.Direction.fromString(sortParams[1])
|
|
||||||
: Sort.Direction.ASC;
|
|
||||||
return PageRequest.of(page, size, Sort.by(direction, property));
|
return PageRequest.of(page, size, Sort.by(direction, property));
|
||||||
}
|
}
|
||||||
return PageRequest.of(page, size);
|
return PageRequest.of(page, size);
|
||||||
|
|||||||
@@ -27,8 +27,7 @@ public class ZooDto {
|
|||||||
@Getter
|
@Getter
|
||||||
public static class Basic {
|
public static class Basic {
|
||||||
|
|
||||||
@JsonIgnore
|
@JsonIgnore private Long id;
|
||||||
private Long id;
|
|
||||||
private String uuid;
|
private String uuid;
|
||||||
private String name;
|
private String name;
|
||||||
private String location;
|
private String location;
|
||||||
@@ -103,9 +102,7 @@ public class ZooDto {
|
|||||||
String[] sortParams = sort.split(",");
|
String[] sortParams = sort.split(",");
|
||||||
String property = sortParams[0];
|
String property = sortParams[0];
|
||||||
Sort.Direction direction =
|
Sort.Direction direction =
|
||||||
sortParams.length > 1
|
sortParams.length > 1 ? Sort.Direction.fromString(sortParams[1]) : Sort.Direction.ASC;
|
||||||
? Sort.Direction.fromString(sortParams[1])
|
|
||||||
: Sort.Direction.ASC;
|
|
||||||
return PageRequest.of(page, size, Sort.by(direction, property));
|
return PageRequest.of(page, size, Sort.by(direction, property));
|
||||||
}
|
}
|
||||||
return PageRequest.of(page, size);
|
return PageRequest.of(page, size);
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
@Service
|
@Service
|
||||||
@Transactional(readOnly = true)
|
@Transactional(readOnly = true)
|
||||||
public class ZooService {
|
public class ZooService {
|
||||||
|
|
||||||
private final ZooCoreService zooCoreService;
|
private final ZooCoreService zooCoreService;
|
||||||
|
|
||||||
// 동물원의 UUID로 id조회
|
// 동물원의 UUID로 id조회
|
||||||
|
|||||||
Reference in New Issue
Block a user