【发布时间】:2018-03-21 21:02:24
【问题描述】:
我使用 jhipster-jdl.jh 文件在 jhipster 中创建了一个实体,如下所示:
entity EmployeeLeave{
appliedDate LocalDate required,
fromDate LocalDate required,
toDate LocalDate required,
status String
}
从这些字段中,我希望将应用日期作为数据库(MySql)中的今天日期。 我在 jhipster 代码中从 Angular 方面尝试过这个,但没有一个有帮助。
有没有什么办法可以让在为employeeLeave 创建记录时,applyDate 总是等于今天的日期。 最好我想要Angular方面的解决方案。也欢迎其他解决方案。
技术:
数据库:Mysql, 弹簧靴, 角4, 吉普斯特。
【问题讨论】:
-
您可以在创建数据库表时应用默认值
-
如果你使用
hibernate你可以使用@PrePersist注解。
标签: java mysql angular spring-boot jhipster