jwt 미적용으로 수정, spotlessApply 적용

This commit is contained in:
2025-12-04 10:20:34 +09:00
parent 44ad02f4fe
commit 345794ce69
13 changed files with 217 additions and 180 deletions

View File

@@ -103,8 +103,7 @@ public class CommonCodeDto {
ZonedDateTime updatedDttm,
String props1,
String props2,
String props3
) {
String props3) {
this.id = id;
this.code = code;
this.description = description;

View File

@@ -291,7 +291,7 @@ public class GlobalExceptionHandler {
@ResponseStatus(HttpStatus.CONFLICT)
@ExceptionHandler(DuplicateKeyException.class)
public ApiResponseDto<String> handlerDuplicateKeyException(
DuplicateKeyException e, HttpServletRequest request) {
DuplicateKeyException e, HttpServletRequest request) {
log.warn("[DuplicateKeyException] resource :{} ", e.getMessage());
String codeName = "DUPLICATE_DATA";

View File

@@ -11,7 +11,6 @@ import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.web.SecurityFilterChain;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
@Configuration
@EnableWebSecurity
@@ -23,24 +22,30 @@ public class SecurityConfig {
@Bean
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
http.csrf(csrf -> csrf.disable())
.sessionManagement(sm -> sm.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
.formLogin(form -> form.disable())
.httpBasic(basic -> basic.disable())
.logout(logout -> logout.disable())
// 🔥 여기서 우리가 만든 CustomAuthenticationProvider 하나만 등록
.authenticationProvider(customAuthenticationProvider)
.authorizeHttpRequests(
auth ->
auth.requestMatchers(
"/api/auth/signin",
"/api/auth/refresh",
"/swagger-ui/**",
"/v3/api-docs/**")
.permitAll()
.anyRequest()
.authenticated())
.addFilterBefore(jwtAuthenticationFilter, UsernamePasswordAuthenticationFilter.class);
http.csrf(csrf -> csrf.disable()) // CSRF 보안 기능 비활성화
.sessionManagement(
sm ->
sm.sessionCreationPolicy(
SessionCreationPolicy.STATELESS)) // 서버 세션 만들지 않음 요청은 JWT 인증
.formLogin(form -> form.disable()) // react에서 로그인 요청 관리
.httpBasic(basic -> basic.disable()) // 기본 basic 인증 비활성화 JWT 인증사용
.logout(logout -> logout.disable()) // 기본 로그아웃 비활성화 JWT는 서버 상태가 없으므로 로그아웃 처리 필요 없음
.authenticationProvider(
customAuthenticationProvider) // 로그인 패스워드 비교방식 스프링 기본 Provider 사용안함 커스텀 사용
.authorizeHttpRequests(auth -> auth.anyRequest().permitAll());
// auth.requestMatchers(
// "/api/auth/signin",
// "/api/auth/refresh",
// "/swagger-ui/**",
// "/v3/api-docs/**") // 로그인 없이 접근가능 url
// .permitAll()
// .anyRequest()
// .authenticated())
// .addFilterBefore(
// jwtAuthenticationFilter,
// UsernamePasswordAuthenticationFilter
// .class) // 요청 들어오면 먼저 JWT 토큰 검사 후 security context 에 사용자 정보 저장.
;
return http.build();
}

View File

@@ -28,7 +28,7 @@ public class GeoJsonDataService {
/** GeoJSON 파일들을 데이터베이스에 저장 */
public List<Long> processGeoJsonFiles(
Map<String, String> geoJsonContents, String archiveFileName) {
Map<String, String> geoJsonContents, String archiveFileName) {
List<Long> savedIds = new ArrayList<>();
log.info("GeoJSON 파일 처리 시작: {} ({}개 파일)", archiveFileName, geoJsonContents.size());
@@ -54,10 +54,10 @@ public class GeoJsonDataService {
}
log.info(
"GeoJSON 파일 처리 완료: {} (성공: {}개, 전체: {}개)",
archiveFileName,
savedIds.size(),
geoJsonContents.size());
"GeoJSON 파일 처리 완료: {} (성공: {}개, 전체: {}개)",
archiveFileName,
savedIds.size(),
geoJsonContents.size());
return savedIds;
}
@@ -65,7 +65,7 @@ public class GeoJsonDataService {
/** 개별 파일을 별도 트랜잭션으로 처리 */
@Transactional
public Long processGeoJsonFileWithTransaction(
String fileName, String geoJsonContent, String archiveFileName) {
String fileName, String geoJsonContent, String archiveFileName) {
try {
Long savedId = processGeoJsonFile(fileName, geoJsonContent, archiveFileName);
if (savedId != null && isLearningModelResult(fileName, geoJsonContent)) {
@@ -88,7 +88,7 @@ public class GeoJsonDataService {
// 파일이 이미 처리되었는지 확인
String dataPath = generateDataPath(archiveFileName, fileName);
Optional<MapSheetLearnDataEntity> existingData =
mapSheetLearnDataRepository.findByDataPath(dataPath);
mapSheetLearnDataRepository.findByDataPath(dataPath);
if (existingData.isPresent()) {
log.warn("이미 처리된 파일입니다: {}", dataPath);
@@ -97,7 +97,7 @@ public class GeoJsonDataService {
// 새 엔티티 생성 및 저장
MapSheetLearnDataEntity entity =
createMapSheetLearnDataEntity(fileName, geoJsonContent, archiveFileName, geoJsonNode);
createMapSheetLearnDataEntity(fileName, geoJsonContent, archiveFileName, geoJsonNode);
MapSheetLearnDataEntity savedEntity = mapSheetLearnDataRepository.save(entity);
return savedEntity.getId();
@@ -122,7 +122,7 @@ public class GeoJsonDataService {
/** MapSheetLearnDataEntity 생성 */
private MapSheetLearnDataEntity createMapSheetLearnDataEntity(
String fileName, String geoJsonContent, String archiveFileName, JsonNode geoJsonNode) {
String fileName, String geoJsonContent, String archiveFileName, JsonNode geoJsonNode) {
MapSheetLearnDataEntity entity = new MapSheetLearnDataEntity();
@@ -287,8 +287,8 @@ public class GeoJsonDataService {
JsonNode properties = firstFeature.get("properties");
// 학습 모델 특화 필드 확인
return properties.has("cd_prob")
|| properties.has("class")
|| (properties.has("before") && properties.has("after"));
|| properties.has("class")
|| (properties.has("before") && properties.has("after"));
}
}
}
@@ -301,7 +301,7 @@ public class GeoJsonDataService {
/** 학습 모델 결과의 geometry 데이터 처리 - 최적화된 배치 처리 */
public void processLearningModelGeometryOptimized(
Long dataUid, String geoJsonContent, String fileName) {
Long dataUid, String geoJsonContent, String fileName) {
try {
log.info("학습 모델 geometry 데이터 처리 시작: {} (dataUid: {})", fileName, dataUid);
@@ -309,7 +309,7 @@ public class GeoJsonDataService {
// 메타데이터 추출
String mapSheetName =
rootNode.has("name") ? rootNode.get("name").asText() : fileName.replace(".geojson", "");
rootNode.has("name") ? rootNode.get("name").asText() : fileName.replace(".geojson", "");
// 파일명에서 연도 및 지도번호 추출 (캠코_2021_2022_35813023)
String[] parts = mapSheetName.split("_");
@@ -347,7 +347,7 @@ public class GeoJsonDataService {
try {
JsonNode feature = features.get(j);
MapSheetLearnDataGeomEntity geomEntity =
createGeometryEntity(feature, dataUid, beforeYear, afterYear, mapSheetNum);
createGeometryEntity(feature, dataUid, beforeYear, afterYear, mapSheetNum);
if (geomEntity != null) {
batch.add(geomEntity);
}
@@ -400,7 +400,7 @@ public class GeoJsonDataService {
/** 개별 feature에서 geometry entity 생성 */
private MapSheetLearnDataGeomEntity createGeometryEntity(
JsonNode feature, Long dataUid, String beforeYear, String afterYear, String mapSheetNum) {
JsonNode feature, Long dataUid, String beforeYear, String afterYear, String mapSheetNum) {
JsonNode properties = feature.get("properties");
JsonNode geometry = feature.get("geometry");

View File

@@ -69,25 +69,23 @@ public class MapSheetMngApiController {
@Operation(summary = "파일목록 조회", description = "파일목록 조회")
@ApiResponses(
value = {
@ApiResponse(
responseCode = "200",
description = "조회 성공",
content =
@Content(
mediaType = "application/json",
schema = @Schema(implementation = CommonCodeDto.Basic.class))),
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
})
value = {
@ApiResponse(
responseCode = "200",
description = "조회 성공",
content =
@Content(
mediaType = "application/json",
schema = @Schema(implementation = CommonCodeDto.Basic.class))),
@ApiResponse(responseCode = "404", description = "코드를 찾을 수 없음", content = @Content),
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
})
@PostMapping("/file-all-list")
public ApiResponseDto<FilesDto> getAllFiles(@RequestBody SrchFilesDto srchDto) {
return ApiResponseDto.createOK(mapSheetMngService.getFilesDepthAll(srchDto));
}
/**
* 오류데이터 목록 조회
*

View File

@@ -24,15 +24,24 @@ public class FileDto {
@AllArgsConstructor
public static class SrchFilesDto {
@Schema(description = "디렉토리경로", example = "/data")
@NotNull private String dirPath;
@NotNull
private String dirPath;
@Schema(description = "전체(*), cpg,dbf,geojson등", example = "*")
@NotNull private String extension;
@NotNull
private String extension;
@Schema(description = "파일명(name), 최종수정일(date)", example = "name")
@NotNull private String sortType;
@NotNull
private String sortType;
@Schema(description = "파일시작위치", example = "1")
@NotNull private Integer startPos;
@NotNull
private Integer startPos;
@Schema(description = "파일종료위치", example = "100")
@NotNull private Integer endPos;
@NotNull
private Integer endPos;
}
@Schema(name = "FolderDto", description = "폴더 정보")
@@ -48,14 +57,14 @@ public class FileDto {
private final Boolean isValid;
public FolderDto(
String folderNm,
String parentFolderNm,
String parentPath,
String fullPath,
int depth,
long childCnt,
String lastModified,
Boolean isValid) {
String folderNm,
String parentFolderNm,
String parentPath,
String fullPath,
int depth,
long childCnt,
String lastModified,
Boolean isValid) {
this.folderNm = folderNm;
this.parentFolderNm = parentFolderNm;
this.parentPath = parentPath;
@@ -75,7 +84,8 @@ public class FileDto {
private final int folderErrTotCnt;
private final List<FolderDto> folders;
public FoldersDto(String dirPath, int folderTotCnt, int folderErrTotCnt, List<FolderDto> folders) {
public FoldersDto(
String dirPath, int folderTotCnt, int folderErrTotCnt, List<FolderDto> folders) {
this.dirPath = dirPath;
this.folderTotCnt = folderTotCnt;
@@ -84,8 +94,6 @@ public class FileDto {
}
}
@Schema(name = "File Basic", description = "파일 기본 정보")
@Getter
public static class Basic {
@@ -99,7 +107,13 @@ public class FileDto {
private final String lastModified;
public Basic(
String fileNm, String parentFolderNm, String parentPath, String fullPath, String extension, long fileSize, String lastModified) {
String fileNm,
String parentFolderNm,
String parentPath,
String fullPath,
String extension,
long fileSize,
String lastModified) {
this.fileNm = fileNm;
this.parentFolderNm = parentFolderNm;
this.parentPath = parentPath;

View File

@@ -40,7 +40,6 @@ public class MapSheetMngService {
private final MapSheetMngCoreService mapSheetMngCoreService;
public FoldersDto getFolderAll(SrchFoldersDto srchDto) {
Path startPath = Paths.get(srchDto.getDirPath());
@@ -70,8 +69,9 @@ public class MapSheetMngService {
String parentPath = path.getParent().toString();
String fullPath = path.toAbsolutePath().toString();
boolean isValid = !NameValidator.containsKorean(folderNm) &&
!NameValidator.containsWhitespaceRegex(folderNm);
boolean isValid =
!NameValidator.containsKorean(folderNm)
&& !NameValidator.containsWhitespaceRegex(folderNm);
File directory = new File(fullPath);
File[] childFolders = directory.listFiles(File::isDirectory);
@@ -91,15 +91,14 @@ public class MapSheetMngService {
}
return new FolderDto(
folderNm,
parentFolderNm,
parentPath,
fullPath,
depth,
childCnt,
lastModified,
isValid
);
folderNm,
parentFolderNm,
parentPath,
fullPath,
depth,
childCnt,
lastModified,
isValid);
})
.collect(Collectors.toList());
@@ -110,15 +109,18 @@ public class MapSheetMngService {
.reversed());
folderTotCnt = folderDtoList.size();
folderErrTotCnt = (int)folderDtoList.stream()
.filter(dto -> dto.getIsValid().toString().equals("false") )
.count();
folderErrTotCnt =
(int)
folderDtoList.stream()
.filter(dto -> dto.getIsValid().toString().equals("false"))
.count();
} catch (IOException e) {
throw new RuntimeException(e);
}
// FoldersDto foldersDto = new FoldersDto(dirPath, folderTotCnt, folderErrTotCnt, folderDtoList);
// FoldersDto foldersDto = new FoldersDto(dirPath, folderTotCnt, folderErrTotCnt,
// folderDtoList);
return new FoldersDto(dirPath, folderTotCnt, folderErrTotCnt, folderDtoList);
}
@@ -167,7 +169,9 @@ public class MapSheetMngService {
long fileSize = file.length();
String lastModified = dttmFormat.format(new Date(file.lastModified()));
files.add(new FileDto.Basic(fileName, parentFolderNm, parentPath, fullPath, ext, fileSize, lastModified));
files.add(
new FileDto.Basic(
fileName, parentFolderNm, parentPath, fullPath, ext, fileSize, lastModified));
fileTotCnt = fileTotCnt + 1;
fileTotSize = fileTotSize + fileSize;
@@ -182,15 +186,13 @@ public class MapSheetMngService {
return filesDto;
}
public FilesDto getFilesDepthAll(SrchFilesDto srchDto) {
int maxDepth = 20;
Path startPath = Paths.get(srchDto.getDirPath());
String dirPath = srchDto.getDirPath();
String extension = srchDto.getExtension();
String sortType = srchDto.getSortType();
String sortType = srchDto.getSortType();
Set<String> targetExtensions = createExtensionSet(extension);
@@ -203,37 +205,36 @@ public class MapSheetMngService {
try (Stream<Path> stream = Files.walk(startPath, maxDepth)) {
fileDtoList =
stream
.filter(Files::isRegularFile)
.filter(p -> extension == null ||
extension.equals("") ||
extension.equals("*") ||
targetExtensions.contains(extractExtension(p))
)
.sorted(getFileComparator(sortType))
.map(
path -> {
stream
.filter(Files::isRegularFile)
.filter(
p ->
extension == null
|| extension.equals("")
|| extension.equals("*")
|| targetExtensions.contains(extractExtension(p)))
.sorted(getFileComparator(sortType))
.map(
path -> {
int depth = path.getNameCount();
int depth = path.getNameCount();
String fileNm = path.getFileName().toString();
String ext = FilenameUtils.getExtension(fileNm);
String parentFolderNm = path.getParent().getFileName().toString();
String parentPath = path.getParent().toString();
String fullPath = path.toAbsolutePath().toString();
String fileNm = path.getFileName().toString();
String ext = FilenameUtils.getExtension(fileNm);
String parentFolderNm = path.getParent().getFileName().toString();
String parentPath = path.getParent().toString();
String fullPath = path.toAbsolutePath().toString();
File file = new File(fullPath);
long fileSize = file.length();
String lastModified = dttmFormat.format(new Date(file.lastModified()));
File file = new File(fullPath);
long fileSize = file.length();
String lastModified = dttmFormat.format(new Date(file.lastModified()));
return new FileDto.Basic(fileNm, parentFolderNm, parentPath, fullPath, ext, fileSize, lastModified);
})
.collect(Collectors.toList());
return new FileDto.Basic(
fileNm, parentFolderNm, parentPath, fullPath, ext, fileSize, lastModified);
})
.collect(Collectors.toList());
fileTotCnt = fileDtoList.size();
fileTotSize = fileDtoList.stream()
.mapToLong(FileDto.Basic::getFileSize)
.sum();
fileTotSize = fileDtoList.stream().mapToLong(FileDto.Basic::getFileSize).sum();
/*
if( sort.equals("name")) {
@@ -267,10 +268,10 @@ public class MapSheetMngService {
// "java, class" -> ["java", " class"] -> [".java", ".class"]
return Arrays.stream(extensionString.split(","))
.map(ext -> ext.trim())
.filter(ext -> !ext.isEmpty())
.map(ext -> "." + ext.toLowerCase())
.collect(Collectors.toSet());
.map(ext -> ext.trim())
.filter(ext -> !ext.isEmpty())
.map(ext -> "." + ext.toLowerCase())
.collect(Collectors.toSet());
}
public String extractExtension(Path path) {
@@ -278,7 +279,7 @@ public class MapSheetMngService {
int lastDotIndex = filename.lastIndexOf('.');
// 확장자가 없거나 파일명이 .으로 끝나는 경우
if (lastDotIndex == -1 || lastDotIndex == filename.length() - 1 ) {
if (lastDotIndex == -1 || lastDotIndex == filename.length() - 1) {
return ""; // 빈 문자열 반환
}
@@ -286,24 +287,21 @@ public class MapSheetMngService {
return filename.substring(lastDotIndex).toLowerCase();
}
public Comparator<Path> getFileComparator(String sortType) {
// 파일 이름 비교 기본 Comparator (대소문자 무시)
Comparator<Path> nameComparator = Comparator.comparing(
path -> path.getFileName().toString(),
CASE_INSENSITIVE_ORDER
);
Comparator<Path> nameComparator =
Comparator.comparing(path -> path.getFileName().toString(), CASE_INSENSITIVE_ORDER);
Comparator<Path> dateComparator = Comparator.comparing(
path -> {
try {
return Files.getLastModifiedTime(path);
} catch (IOException e) {
return FileTime.fromMillis(0);
}
}
);
Comparator<Path> dateComparator =
Comparator.comparing(
path -> {
try {
return Files.getLastModifiedTime(path);
} catch (IOException e) {
return FileTime.fromMillis(0);
}
});
if ("name desc".equalsIgnoreCase(sortType)) {
return nameComparator.reversed();
@@ -316,8 +314,6 @@ public class MapSheetMngService {
}
}
public Page<MapSheetMngDto.ErrorDataDto> findMapSheetErrorList(
MapSheetMngDto.@Valid searchReq searchReq) {
return mapSheetMngCoreService.findMapSheetErrorList(searchReq);

View File

@@ -35,21 +35,36 @@ public class CommonCodeCoreService
new EntityNotFoundException(
"parent id 를 찾을 수 없습니다. id : " + req.getParentId()));
Long existsCount = commonCodeRepository.findByParentIdCodeExists(req.getParentId(), req.getCode());
Long existsCount =
commonCodeRepository.findByParentIdCodeExists(req.getParentId(), req.getCode());
if (existsCount > 0) {
throw new DuplicateKeyException("이미 등록되어 있습니다.");
}
CommonCodeEntity entity =
new CommonCodeEntity(
req.getCode(), req.getName(), req.getDescription(), req.getOrder(), req.isUsed(), req.getProps1(), req.getProps2(), req.getProps3());
req.getCode(),
req.getName(),
req.getDescription(),
req.getOrder(),
req.isUsed(),
req.getProps1(),
req.getProps2(),
req.getProps3());
entity.addParent(parentCommonCodeEntity);
return commonCodeRepository.save(entity).toDto();
}
CommonCodeEntity entity =
new CommonCodeEntity(
req.getCode(), req.getName(), req.getDescription(), req.getOrder(), req.isUsed(), req.getProps1(), req.getProps2(), req.getProps3());
req.getCode(),
req.getName(),
req.getDescription(),
req.getOrder(),
req.isUsed(),
req.getProps1(),
req.getProps2(),
req.getProps3());
return commonCodeRepository.save(entity).toDto();
}
@@ -60,7 +75,8 @@ public class CommonCodeCoreService
.orElseThrow(() -> new EntityNotFoundException("common code 를 찾을 수 없습니다. id : " + id));
Long parentId = found.getParent() == null ? null : found.getParent().getId();
Long existsCount = commonCodeRepository.findByParentIdCodeExiststoUpdate(id, parentId, req.getCode());
Long existsCount =
commonCodeRepository.findByParentIdCodeExiststoUpdate(id, parentId, req.getCode());
if (existsCount > 0) {
throw new DuplicateKeyException("이미 등록되어 있습니다.");
}
@@ -76,8 +92,7 @@ public class CommonCodeCoreService
found.getDeleted(),
req.getProps1(),
req.getProps2(),
req.getProps3()
);
req.getProps3());
return commonCodeRepository.save(entity).toDto();
}

View File

@@ -74,7 +74,14 @@ public class CommonCodeEntity extends CommonDateEntity {
private String props3;
public CommonCodeEntity(
String code, String name, String description, Integer order, Boolean used, String props1, String props2, String props3) {
String code,
String name,
String description,
Integer order,
Boolean used,
String props1,
String props2,
String props3) {
this.code = code;
this.name = name;
this.description = description;
@@ -86,7 +93,16 @@ public class CommonCodeEntity extends CommonDateEntity {
}
public CommonCodeEntity(
Long id, String code, String name, String description, Integer order, Boolean used, Boolean deleted, String props1, String props2, String props3) {
Long id,
String code,
String name,
String description,
Integer order,
Boolean used,
Boolean deleted,
String props1,
String props2,
String props3) {
this.id = id;
this.code = code;
this.name = name;
@@ -101,20 +117,19 @@ public class CommonCodeEntity extends CommonDateEntity {
public CommonCodeDto.Basic toDto() {
return new CommonCodeDto.Basic(
this.id,
this.code,
this.description,
this.name,
this.order,
this.used,
this.deleted,
this.children.stream().map(CommonCodeEntity::toDto).toList(),
super.getCreatedDate(),
super.getModifiedDate(),
this.props1,
this.props2,
this.props3
);
this.id,
this.code,
this.description,
this.name,
this.order,
this.used,
this.deleted,
this.children.stream().map(CommonCodeEntity::toDto).toList(),
super.getCreatedDate(),
super.getModifiedDate(),
this.props1,
this.props2,
this.props3);
}
public void addParent(CommonCodeEntity parent) {

View File

@@ -25,9 +25,9 @@ public class MapSheetLearnDataEntity {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "tb_map_sheet_learn_data_id_gen")
@SequenceGenerator(
name = "tb_map_sheet_learn_data_id_gen",
sequenceName = "tb_map_sheet_learn_data_data_uid",
allocationSize = 1)
name = "tb_map_sheet_learn_data_id_gen",
sequenceName = "tb_map_sheet_learn_data_data_uid",
allocationSize = 1)
@Column(name = "data_uid", nullable = false)
private Long id;

View File

@@ -21,12 +21,12 @@ public class MapSheetLearnDataGeomEntity {
@Id
@GeneratedValue(
strategy = GenerationType.SEQUENCE,
generator = "tb_map_sheet_learn_data_geom_id_gen")
strategy = GenerationType.SEQUENCE,
generator = "tb_map_sheet_learn_data_geom_id_gen")
@SequenceGenerator(
name = "tb_map_sheet_learn_data_geom_id_gen",
sequenceName = "tb_map_sheet_learn_data_geom_geom_uid",
allocationSize = 1)
name = "tb_map_sheet_learn_data_geom_id_gen",
sequenceName = "tb_map_sheet_learn_data_geom_geom_uid",
allocationSize = 1)
@Column(name = "geo_uid", nullable = false)
private Long id;

View File

@@ -3,7 +3,6 @@ package com.kamco.cd.kamcoback.postgres.repository.code;
import com.kamco.cd.kamcoback.code.dto.CommonCodeDto;
import com.kamco.cd.kamcoback.postgres.entity.CommonCodeEntity;
import jakarta.validation.constraints.NotEmpty;
import java.util.List;
import java.util.Optional;

View File

@@ -99,26 +99,22 @@ public class CommonCodeRepositoryImpl implements CommonCodeRepositoryCustom {
@Override
public Long findByParentIdCodeExists(Long parentId, String code) {
return queryFactory
.select(commonCodeEntity.code.count())
.from(commonCodeEntity)
.where(
commonCodeEntity.parent.id.eq(parentId),
commonCodeEntity.code.eq(code)
)
.fetchOne();
.select(commonCodeEntity.code.count())
.from(commonCodeEntity)
.where(commonCodeEntity.parent.id.eq(parentId), commonCodeEntity.code.eq(code))
.fetchOne();
}
@Override
public Long findByParentIdCodeExiststoUpdate(Long id, Long parentId, String code) {
return queryFactory
.select(commonCodeEntity.code.count())
.from(commonCodeEntity)
.where(
commonCodeEntity.parent.id.eq(parentId),
commonCodeEntity.code.eq(code),
commonCodeEntity.id.ne(id)
)
.fetchOne();
.select(commonCodeEntity.code.count())
.from(commonCodeEntity)
.where(
commonCodeEntity.parent.id.eq(parentId),
commonCodeEntity.code.eq(code),
commonCodeEntity.id.ne(id))
.fetchOne();
}
private List<CommonCodeEntity> findAllByIds(Set<Long> ids) {