Commit 6fb2e418 by Rex Zhou

userid long type

parent 200232b8
......@@ -38,9 +38,9 @@ public class UserController {
@RequestMapping(method = POST, value = "/register")
public ResponseEntity<?> addUser(@RequestBody User user, UriComponentsBuilder ucBuilder) {
User existUser = this.userService.findByUserId(user.getUserId()) ;
User existUser = this.userService.findByUserId(user.getUserId().toString()) ;
if (existUser != null) {
throw new UserAlreadyExistException(user.getUserId(), "Username already exists");
throw new UserAlreadyExistException(user.getUserId().toString(), "Username already exists");
}
User new_user = this.userService.register(user);
HttpHeaders headers = new HttpHeaders();
......
......@@ -53,7 +53,7 @@ public class UserRepositoryImpl implements UserRepository {
this.userRepository.save(user);
return user;
} else {
throw new UserAlreadyExistException(user.getUserId(), "Username already exists");
throw new UserAlreadyExistException(user.getUserId().toString(), "Username already exists");
}
}
......
......@@ -48,7 +48,7 @@ public class UserServiceImpl implements UserService {
this.userRepository.save(user);
return user;
} else {
throw new UserAlreadyExistException(user.getUserId(), "Username already exists");
throw new UserAlreadyExistException(user.getUserId().toString(), "Username already exists");
}
}
......
......@@ -10,7 +10,7 @@ import javax.persistence.Entity;
@ Entity
public class Admin extends User {
public Admin(String userId, String password, String firstName, String lastName, String email, boolean isAdmin) {
public Admin(Long userId, String password, String firstName, String lastName, String email, boolean isAdmin) {
super(userId, password, firstName, lastName, email, true);
}
}
......@@ -9,7 +9,7 @@ import javax.persistence.Entity;
@Entity
public class Buyer extends User {
public Buyer(String userId, String password, String firstName, String lastName, String email, boolean isAdmin) {
public Buyer(Long userId, String password, String firstName, String lastName, String email, boolean isAdmin) {
super(userId, password, firstName, lastName, email, false);
}
}
......@@ -8,7 +8,7 @@ import javax.persistence.Entity;
@Entity
public class Seller extends User {
public Seller(String userId, String password, String firstName, String lastName, String email, boolean isAdmin) {
public Seller(Long userId, String password, String firstName, String lastName, String email, boolean isAdmin) {
super(userId, password, firstName, lastName, email, false);
}
}
......@@ -19,9 +19,10 @@ public class User {
@Id
@Column(name = "USER_ID")
@GenericGenerator(strategy = "uuid2", name = "uuid")
@GeneratedValue(generator = "uuid")
private String userId;
// @GenericGenerator(strategy = "uuid2", name = "uuid")
// @GeneratedValue(generator = "uuid")
@GeneratedValue
private Long userId;
@Column(name = "PASSWORD", nullable = false)
private String password;
......@@ -40,7 +41,7 @@ public class User {
public User() {}
public User(String userId, String password, String firstName, String lastName, String email, boolean isAdmin)
public User(Long userId, String password, String firstName, String lastName, String email, boolean isAdmin)
{
this.userId = userId;
this.password = password;
......@@ -51,11 +52,11 @@ public class User {
}
public String getUserId() {
public Long getUserId() {
return userId;
}
public void setId(String userId) {
public void setId(Long userId) {
this.userId = userId;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment