공통코드 추가

This commit is contained in:
2025-11-18 11:35:28 +09:00
parent 1657045f6d
commit 725cad510e
9 changed files with 319 additions and 2 deletions

View File

@@ -0,0 +1,52 @@
package com.kamco.cd.kamcoback.code;
import com.kamco.cd.kamcoback.code.dto.CommonCodeDto;
import com.kamco.cd.kamcoback.code.service.CommonCodeService;
import com.kamco.cd.kamcoback.config.api.ApiResponseDto;
import com.kamco.cd.kamcoback.zoo.dto.AnimalDto;
import com.kamco.cd.kamcoback.zoo.dto.ZooDto;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@Tag(name = "공통코드 관리", description = "공통코드 관리 API")
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/code")
public class CommonCodeApiController {
private final CommonCodeService commonCodeService;
@Operation(summary = "저장", description = "공통코드를 저장 합니다.")
@ApiResponses(
value = {
@ApiResponse(responseCode = "201", description = "공통코드 저장 성공", content =
@Content(
mediaType = "application/json",
schema = @Schema(implementation = Long.class))),
@ApiResponse(responseCode = "400", description = "잘못된 요청 데이터", content = @Content),
@ApiResponse(responseCode = "500", description = "서버 오류", content = @Content)
})
@PostMapping
public ApiResponseDto<Long> save(
@io.swagger.v3.oas.annotations.parameters.RequestBody(
description = "공통코드 생성 요청 정보",
required = true,
content =
@Content(
mediaType = "application/json",
schema = @Schema(implementation = CommonCodeDto.AddReq.class)))
@RequestBody
CommonCodeDto.AddReq req) {
Long id = commonCodeService.save(req);
return ApiResponseDto.createOK(id);
}
}