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