diff --git a/src/main/java/com/example/pladialmserver/equipment/dto/request/UpdateEquipmentReq.java b/src/main/java/com/example/pladialmserver/equipment/dto/request/UpdateEquipmentReq.java index 83fabfab..e8015b7e 100644 --- a/src/main/java/com/example/pladialmserver/equipment/dto/request/UpdateEquipmentReq.java +++ b/src/main/java/com/example/pladialmserver/equipment/dto/request/UpdateEquipmentReq.java @@ -19,9 +19,6 @@ public class UpdateEquipmentReq { private String quantity; @Schema(type = "Long", description = "비품 담당자", example = "1", required = true) private Long register; - @Schema(type = "Long", description = "비품 등록자", example = "1", required = true) - @NotNull(message = "E0003") - private Long userId; @Schema(type = "String", description = "비품 위치", example = "s1350", required = true) @NotBlank(message = "E0003") private String location; diff --git a/src/main/java/com/example/pladialmserver/equipment/service/EquipmentService.java b/src/main/java/com/example/pladialmserver/equipment/service/EquipmentService.java index e1815ee8..468910e4 100644 --- a/src/main/java/com/example/pladialmserver/equipment/service/EquipmentService.java +++ b/src/main/java/com/example/pladialmserver/equipment/service/EquipmentService.java @@ -40,20 +40,15 @@ public void registerEquipment(RegisterEquipmentReq registerEquipmentReq, User us } public Page searchEquipment(String cond, Pageable pageable) { - Page equipments; - - if(StringUtils.hasText(cond)) equipments = equipmentRepository.findByNameContainsAndIsEnable(cond, pageable, true); - else equipments = equipmentRepository.findAll(pageable); + Page equipments = equipmentRepository.findByNameContainsAndIsEnable(cond,pageable,true); return equipments.map(SearchEquipmentRes::toDto); } @Transactional public void updateEquipment(Long equipmentId, UpdateEquipmentReq updateEquipmentReq, User user) { Equipment equipment = equipmentRepository.findByEquipmentIdAndIsEnable(equipmentId, true).orElseThrow(() -> new BaseException(BaseResponseCode.EQUIPMENT_NOT_FOUND)); - - User register = userRepository.findByUserIdAndIsEnable(updateEquipmentReq.getUserId(), true).orElseThrow(() -> new BaseException(BaseResponseCode.USER_NOT_FOUND)); EquipmentCategory updateCategory = extractCategory(updateEquipmentReq.getCategory()); - equipment.toUpdateInfo(updateEquipmentReq, register, updateCategory); + equipment.toUpdateInfo(updateEquipmentReq, user, updateCategory); } private EquipmentCategory extractCategory(String name) {