qcast-api/src/main/java/com/interplug/qcast/biz/commCode/CommCodeController.java
2024-10-21 15:30:51 +09:00

45 lines
1.5 KiB
Java

package com.interplug.qcast.biz.commCode;
import com.interplug.qcast.biz.commCode.dto.CodeReq;
import com.interplug.qcast.biz.commCode.dto.CommCodeApiResponse;
import com.interplug.qcast.biz.commCode.dto.CommCodeRes;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import java.util.List;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
@Slf4j
@RestController
@RequestMapping("/api/commcode")
@RequiredArgsConstructor
@Tag(name = "CommCodeController", description = "공통코드 관련 API")
public class CommCodeController {
private final CommCodeService commCodeService;
@Operation(description = "공통코드 정보를 등록/수정 한다.(동기화)")
@PutMapping("/qc-comm-update")
@ResponseStatus(HttpStatus.OK)
public CommCodeApiResponse setQcCommCdYn(@RequestBody CodeReq codeReq) {
CommCodeApiResponse codeResponse = new CommCodeApiResponse();
int resultCnt = commCodeService.setCommHUpdate(codeReq);
if (resultCnt > 0) codeResponse.setCode("200");
else codeResponse.setCode("500");
return codeResponse;
}
/**
* QCast에서 사용하는 공통코드를 조회 한다.
*
* @return
*/
@Operation(description = "QCast에서 사용하는 공통코드를 조회 한다.")
@GetMapping("/qc-comm-code")
public List<CommCodeRes> selectQcastCommCode() {
return commCodeService.selectQcastCommCode();
}
}