Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,14 @@ public ResponseEntity<ApiResponse<MaterialResponseDTO>> updateMaterial(
return ApiResponse.success(SuccessStatus.OK,materialService.updateMaterial(id, materialRequestDTO));
}

@Operation(summary = "자재 상세조회", description = "자재 ID로 상세 정보를 조회합니다.")
@GetMapping("/{materialId}")
public ResponseEntity<ApiResponse<MaterialResponseDTO>> getMaterialById(@PathVariable("materialId") Long id) {
MaterialResponseDTO materialResponse = materialService.getMaterialById(id);

return ApiResponse.success(SuccessStatus.MATERIAL_GET_SUCCESS, materialResponse);
}

@Operation(summary = "자재 삭제", description = "자재를 삭제합니다.")
@DeleteMapping("/{materialId}")
public ResponseEntity<ApiResponse<Void>> deleteMaterial(@PathVariable("materialId") Long id) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,4 +306,13 @@ public String generateNextMaterialCode(Long categoryId) {

return String.format("%s-%04d", category.getCode(), nextSeq);
}

// 자재 상세조회
@Transactional(readOnly = true)
public MaterialResponseDTO getMaterialById(Long materialId) {
Material material = materialRepository.findById(materialId)
.orElseThrow(() -> new NotFoundException(ErrorStatus.MATERIAL_NOT_FOUND));

return new MaterialResponseDTO(material);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,14 @@ public ResponseEntity<ApiResponse<PartListResponseDTO>> updatePart(
return ApiResponse.success(SuccessStatus.PART_UPDATE_SUCCESS, partResponse);
}

@Operation(summary = "부품 상세조회", description = "부품 ID로 상세 정보 조회")
@GetMapping("/{partId}")
public ResponseEntity<ApiResponse<PartListResponseDTO>> getPartById(@PathVariable Long partId) {
PartListResponseDTO partResponse = partService.getPartById(partId);

return ApiResponse.success(SuccessStatus.PART_GET_SUCCESS, partResponse);
}

// @Operation(summary = "부품 삭제", description = "부품 삭제")
// @DeleteMapping("/{partId}")
// public ResponseEntity<ApiResponse<Void>> deletePart(@PathVariable Long partId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,16 @@ public Long getProcessCostByPartId(Long partId) {
return process != null ? process.getTotalProcessCost() : 0L;
}


// 부품 상세조회
@Transactional(readOnly = true)
public PartListResponseDTO getPartById(Long partId) {
Part part = partRepository.findById(partId)
.orElseThrow(() -> new NotFoundException(ErrorStatus.PART_NOT_FOUND));

return new PartListResponseDTO(part);
}

/**
* 모든 Part의 standard_total_cost 재계산
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public enum SuccessStatus {
PART_LIST_SUCCESS(HttpStatus.OK, "부품 목록 조회 성공"),
PART_CREATE_SUCCESS(HttpStatus.OK, "부품 생성 성공"),
PART_UPDATE_SUCCESS(HttpStatus.OK, "부품 수정 성공"),
PART_GET_SUCCESS(HttpStatus.OK, "부품 상세 조회 성공"),
PART_DELETE_SUCCESS(HttpStatus.OK, "부품 삭제 성공"),
PART_SEARCH_SUCCESS(HttpStatus.OK, "부품 검색 성공"),
PART_DETAIL_SUCCESS(HttpStatus.OK, "부품 상세 조회 성공"),
Expand All @@ -34,6 +35,7 @@ public enum SuccessStatus {

MATERIAL_LIST_SUCCESS(HttpStatus.OK, "자재 목록 조회 성공"),
ITEM_LIST_SUCCESS(HttpStatus.OK, "자재/부품 전체 조회 성공"),
MATERIAL_GET_SUCCESS(HttpStatus.OK, "자재 상세 조회 성공"),

;

Expand Down