#42 fix birthDate and degree to User

This commit is contained in:
T-Midnight 2019-04-10 10:09:41 +04:00
parent 51c755ac07
commit e8461e26eb
3 changed files with 10 additions and 12 deletions

View File

@ -85,9 +85,9 @@ public class User extends BaseEntity {
@BatchSize(size = 20)
private Set<UserRole> 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;
}

View File

@ -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;
}

View File

@ -4,7 +4,7 @@
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
<changeSet author="tanya" id="20190404_000000-1">
<addColumn tableName="users">
<column name="birth_year" type="integer"></column>
<column name="birth_year" type="timestamp"></column>
</addColumn>
<addColumn tableName="users">
<column name="degree" type="varchar(255)"></column>