get Real Customers: fix findByActive
This commit is contained in:
parent
c2b2a68ce6
commit
b5a8727d60
@ -2,10 +2,27 @@ package com.aitrainer.api
|
||||
|
||||
import org.springframework.boot.SpringApplication
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder
|
||||
import org.springframework.web.bind.annotation.RequestMapping
|
||||
import org.springframework.web.bind.annotation.RestController
|
||||
|
||||
|
||||
@SpringBootApplication
|
||||
@RestController
|
||||
class ApiApplication
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
SpringApplication.run(ApiApplication::class.java, *args)
|
||||
}
|
||||
@Override
|
||||
fun configure(application: SpringApplicationBuilder): SpringApplicationBuilder {
|
||||
return application.sources(ApiApplication::class.java)
|
||||
}
|
||||
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
SpringApplication.run(ApiApplication::class.java, *args)
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping( "/")
|
||||
fun hello(): String {
|
||||
return "Hello Aitrainer API";
|
||||
}
|
||||
|
@ -27,8 +27,8 @@ class CustomerController ( private val customerRepository: CustomerRepository )
|
||||
|
||||
|
||||
@GetMapping("/customers/real")
|
||||
fun getRealCustomers(active: String): List<Customer> =
|
||||
customerRepository.findRealCustomers(active)
|
||||
fun getRealCustomers(active: String): List<Customer> =
|
||||
customerRepository.findByActive(active)
|
||||
|
||||
|
||||
@PutMapping("/customers/{id}")
|
||||
|
@ -5,6 +5,6 @@ import org.springframework.data.jpa.repository.Query
|
||||
import org.springframework.data.repository.query.Param
|
||||
|
||||
interface CustomerService {
|
||||
@Query("FROM customer WHERE active = :active")
|
||||
fun findRealCustomers(@Param("active") active: String): List<Customer>
|
||||
@Query("FROM customer WHERE active = :active ")
|
||||
fun findByActive(@Param("active") active: String? ): List<Customer>
|
||||
}
|
Loading…
Reference in New Issue
Block a user