JsonFormat

This commit is contained in:
2025-11-18 14:15:52 +09:00
parent af4fe2b2ed
commit a63b4c33f3
6 changed files with 47 additions and 27 deletions

View File

@@ -22,15 +22,15 @@ public class CommonCodeCoreService implements BaseCoreService<CommonCodeDto.Bas
private final CommonCodeRepository commonCodeRepository;
public CommonCodeDto.Basic save(CommonCodeDto.AddReq req) {
CommonCodeEntity code = null;
// if (req.getZooUuid() != null) {
// zoo =
// zooRepository
// .getZooByUuid(req.getZooUuid())
// .orElseThrow(
// () ->
// new EntityNotFoundException("Zoo not found with uuid: " + req.getZooUuid()));
// }
if(req.getParentId() != null){
CommonCodeEntity parentCommonCodeEntity = commonCodeRepository.findById(req.getParentId())
.orElseThrow(() -> new EntityNotFoundException("parent id 를 찾을 수 없습니다. id : " + req.getParentId()));
CommonCodeEntity entity = new CommonCodeEntity(req.getCode(), req.getName(), req.getDescription(), req.getOrder(), req.isUsed());
entity.addParent(parentCommonCodeEntity);
return commonCodeRepository.save(entity).toDto();
}
CommonCodeEntity entity = new CommonCodeEntity(req.getCode(), req.getName(), req.getDescription(), req.getOrder(), req.isUsed());
CommonCodeEntity saved = commonCodeRepository.save(entity);
return saved.toDto();

View File

@@ -80,6 +80,10 @@ public class CommonCodeEntity extends CommonDateEntity {
this.deleted,
this.parent,
super.getCreatedDate(),
super.getModifiedDate());
super.getModifiedDate());
}
public void addParent(CommonCodeEntity parent) {
this.parent = parent;
}
}