0924

왕감자·2024년 9월 24일

KB IT's Your Life

목록 보기
175/177

getListExample() : ResponseEntity

//controller
@RestController
@RequestMapping("/api/v1/example")
@Slf4j
public class ExampleController {
    private ExampleService exampleService;

    @Autowired
    public ExampleController(ExampleService exampleService) {
        this.exampleService = exampleService;
    }

    @GetMapping("/list")
    public ResponseEntity<List<ExampleDTO>> getListExample() {
        return ResponseEntity.ok(exampleService.getListExample());
    }
}

getListExample() : List

//service
public interface ExampleService {
    public List<ExampleDTO> getListExample();
}

findAll() : List

//mapper
@Mapper
public interface ExampleMapper {
    List<ExampleVO> findAll();
}

0개의 댓글