customer information aspect

This commit is contained in:
Bossanyi Tibor 2020-06-01 09:49:12 +02:00
parent 7ef6f50c3b
commit 070acf4e47
4 changed files with 43 additions and 2 deletions

View File

@ -10,6 +10,8 @@
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
use aitrainer;
-- Struktúra mentése tábla aitrainer. customer
CREATE TABLE IF NOT EXISTS `customer` (
`customer_id` int(11) NOT NULL AUTO_INCREMENT,

View File

@ -12,7 +12,10 @@ import java.time.LocalDateTime
class CustomerInformationController( private val customerInformationRepository: CustomerInformationRepository ) {
@GetMapping("/customer_information")
fun getCustomerInformation(dateTime: String): List<CustomerInformation> =
customerInformationRepository.findByDisplayBeginLessThanAndDisplayEndGreaterThan(dateTime, dateTime )
fun getCustomerInformation(): List<CustomerInformation> {
val dateTime: String = LocalDateTime.now().toString()
return customerInformationRepository.findByDisplayBeginLessThanAndDisplayEndGreaterThan(dateTime, dateTime )
}
}

View File

@ -0,0 +1,35 @@
package com.aitrainer.api.controller
import com.aitrainer.api.ApiApplication
import com.aitrainer.api.repository.ConfigurationRepository
import org.aspectj.lang.annotation.Aspect
import org.aspectj.lang.annotation.Before
import org.aspectj.lang.annotation.Pointcut
import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Component
@Aspect
@Component
@Suppress("unused")
class CustomerInformationControllerAspect {
private val logger = LoggerFactory.getLogger(ApiApplication::class.simpleName)
@Autowired
private lateinit var configurationRepository: ConfigurationRepository
@Autowired
private lateinit var properties: ApplicationProperties
@Suppress("unused")
@Pointcut("execution(* com.aitrainer.api.controller.CustomerInformationController.*())")
fun customerInformationAspect() {
}
@Suppress("unused")
@Before("customerInformationAspect()")
fun dbCheckAop() {
Singleton.checkDBUpdate(configurationRepository, properties)
}
}

View File

@ -15,4 +15,5 @@ spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5InnoDBDial
logging.config=classpath:logback-spring.xml
logging.file=logs
# if the database structure has been changed, increment this version number
application.version=0.0.2