From e8461e26eb4554189e27ca9f48803eedae6711d3 Mon Sep 17 00:00:00 2001 From: T-Midnight Date: Wed, 10 Apr 2019 10:09:41 +0400 Subject: [PATCH] #42 fix birthDate and degree to User --- src/main/java/ru/ulstu/user/model/User.java | 10 +++++----- src/main/java/ru/ulstu/user/model/UserDto.java | 10 ++++------ .../resources/db/changelog-20190404_000000-schema.xml | 2 +- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/main/java/ru/ulstu/user/model/User.java b/src/main/java/ru/ulstu/user/model/User.java index 40f1f45..974ca82 100644 --- a/src/main/java/ru/ulstu/user/model/User.java +++ b/src/main/java/ru/ulstu/user/model/User.java @@ -85,9 +85,9 @@ public class User extends BaseEntity { @BatchSize(size = 20) private Set roles; - @Size(max = 4) - @Column(name = "birth_year", length = 4) - private Integer birthYear; + @Column(name = "birth_year") + @Temporal(TemporalType.TIMESTAMP) + private Date birthYear; public enum UserDegree { CANDIDATE("Кандидат технических наук"), @@ -211,11 +211,11 @@ public class User extends BaseEntity { this.patronymic = patronymic; } - public Integer getBirthYear() { + public Date getBirthYear() { return birthYear; } - public void setBirthYear(Integer birthYear) { + public void setBirthYear(Date birthYear) { this.birthYear = birthYear; } diff --git a/src/main/java/ru/ulstu/user/model/UserDto.java b/src/main/java/ru/ulstu/user/model/UserDto.java index dadfe99..8157b63 100644 --- a/src/main/java/ru/ulstu/user/model/UserDto.java +++ b/src/main/java/ru/ulstu/user/model/UserDto.java @@ -15,6 +15,7 @@ import ru.ulstu.user.controller.UserController; import javax.validation.constraints.Pattern; import javax.validation.constraints.Size; import java.util.Collection; +import java.util.Date; import java.util.LinkedHashSet; import java.util.Objects; import java.util.Set; @@ -70,11 +71,8 @@ public class UserDto implements OdinDto { @Size(min = Constants.MIN_PASSWORD_LENGTH, max = 50) private String passwordConfirm; - @OdinCaption("Год рождения") - @Size(max = 4) - private Integer birthYear; + private Date birthYear; - @OdinCaption("Ученая степень") private User.UserDegree degree; public UserDto() { @@ -172,11 +170,11 @@ public class UserDto implements OdinDto { return passwordConfirm; } - public Integer getBirthYear() { + public Date getBirthYear() { return birthYear; } - public void setBirthYear(Integer birthYear) { + public void setBirthYear(Date birthYear) { this.birthYear = birthYear; } diff --git a/src/main/resources/db/changelog-20190404_000000-schema.xml b/src/main/resources/db/changelog-20190404_000000-schema.xml index 251905c..a92a99d 100644 --- a/src/main/resources/db/changelog-20190404_000000-schema.xml +++ b/src/main/resources/db/changelog-20190404_000000-schema.xml @@ -4,7 +4,7 @@ xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd"> - +