19 lines
678 B
Kotlin
19 lines
678 B
Kotlin
package com.chantha.jdbc.controller
|
|
|
|
import com.chantha.jdbc.jpa.model.Product
|
|
import com.chantha.jdbc.jpa.model.view.ProductWithOrderDetail
|
|
import com.chantha.jdbc.jpa.repo.ProductRepo
|
|
import com.chantha.jdbc.jpa.service.product.ProductService
|
|
import org.springframework.beans.factory.annotation.Autowired
|
|
import org.springframework.web.bind.annotation.GetMapping
|
|
import org.springframework.web.bind.annotation.RestController
|
|
|
|
@RestController
|
|
public class ProductController @Autowired constructor(private val productService: ProductService) {
|
|
|
|
@GetMapping("/product")
|
|
fun product():List<ProductWithOrderDetail>{
|
|
return productService.fetchAllProducts()
|
|
}
|
|
|
|
} |