| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- package com.its.op.controller.database;
- import com.its.op.model.dto.IfscDto;
- import com.its.op.model.dto.IfscLinkRltnDto;
- import com.its.op.model.entity.Ifsc;
- import com.its.op.model.entity.IfscLinkRltn;
- import com.its.op.service.database.TbIfscService;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiOperation;
- import lombok.RequiredArgsConstructor;
- import lombok.extern.slf4j.Slf4j;
- import org.springframework.http.HttpStatus;
- import org.springframework.http.ResponseEntity;
- import org.springframework.web.bind.annotation.*;
- import java.util.ArrayList;
- import java.util.List;
- @Slf4j
- @RequiredArgsConstructor
- @RestController
- @RequestMapping("/api/database/tb-ifsc")
- @Api(tags = "09.기초데이터관리-03.서비스링크", description="서비스링크")
- public class TbIfscController {
- private final TbIfscService service;
- @ApiOperation(value = "전체조회(TB_IFSC)", response = IfscDto.IfscInfo.class)
- @GetMapping(value = "", produces = {"application/json; charset=utf8"})
- public ResponseEntity<List<IfscDto.IfscInfo>> findAll() {
- List<Ifsc> data = this.service.findAll();
- List<IfscDto.IfscInfo> result = new ArrayList<>();
- for (Ifsc obj: data) {
- result.add(new IfscDto.IfscInfo(obj));
- }
- return new ResponseEntity<>(result, HttpStatus.OK);
- }
- @ApiOperation(value = "개별조회(TB_IFSC)", response = IfscDto.IfscInfo.class)
- @GetMapping(value = "/{id}", produces = {"application/json; charset=utf8"})
- public ResponseEntity<IfscDto.IfscInfo> findById(@PathVariable final Long id) {
- Ifsc obj = this.service.findById(id);
- if (obj != null) {
- return new ResponseEntity<>(new IfscDto.IfscInfo(obj), HttpStatus.OK);
- }
- return new ResponseEntity<>(null, HttpStatus.NOT_FOUND);//NO_CONTENT);
- }
- @ApiOperation(value = "구간명변경(TB_IFSC)", response = IfscDto.IfscInfo.class)
- @PutMapping(value = "/{id}", produces = {"application/json; charset=utf8"})
- public ResponseEntity<IfscDto.IfscInfo> updateNameById(@PathVariable final Long id, @RequestBody final IfscDto.IfscNameUpdateReq req) {
- Ifsc obj = this.service.updateNameById(id, req);
- if (obj != null) {
- return new ResponseEntity<>(new IfscDto.IfscInfo(obj), HttpStatus.OK);
- }
- return new ResponseEntity<>(null, HttpStatus.NOT_FOUND);//NO_CONTENT);
- }
- @ApiOperation(value = "개별구성정보조회(TB_IFSC_LINK_RLTN)", response = IfscLinkRltnDto.IfscLinkRltnInfo.class)
- @GetMapping(value = "/rltn/{id}", produces = {"application/json; charset=utf8"})
- public ResponseEntity<List<IfscLinkRltnDto.IfscLinkRltnInfo>> findLinkRltnById(@PathVariable final Long id) {
- List<IfscLinkRltn> objs = this.service.findLinkRltnById(id);
- if (objs != null) {
- List<IfscLinkRltnDto.IfscLinkRltnInfo> result = new ArrayList<>();
- for (IfscLinkRltn obj : objs) {
- result.add(new IfscLinkRltnDto.IfscLinkRltnInfo(obj));
- }
- return new ResponseEntity<>(result, HttpStatus.OK);
- }
- return new ResponseEntity<>(null, HttpStatus.NOT_FOUND);//NO_CONTENT);
- }
- @ApiOperation(value = "개별구성정보변경/생성(TB_IFSC_LINK_RLTN)", response = IfscDto.IfscInfo.class)
- @PutMapping(value = "/rltn/{id}", produces = {"application/json; charset=utf8"})
- public ResponseEntity<List<IfscLinkRltnDto.IfscLinkRltnUpdateReq>> updateRltn(
- @PathVariable final Long id,
- @RequestBody final List<IfscLinkRltnDto.IfscLinkRltnUpdateReq> req) {
- List<IfscLinkRltnDto.IfscLinkRltnUpdateReq> obj = this.service.updateRltn(id, req);
- if (obj != null) {
- return new ResponseEntity<>(obj, HttpStatus.OK);
- }
- return new ResponseEntity<>(null, HttpStatus.NOT_FOUND);//NO_CONTENT);
- }
- }
|