класс юзер репозиторий и сущность

This commit is contained in:
ekallin 2024-03-18 12:11:38 +04:00
parent fa6fbd2323
commit fe92621f14
2 changed files with 76 additions and 0 deletions

View File

@ -0,0 +1,65 @@
package com.example.backend.users.model;
import java.util.Objects;
import com.example.backend.core.model.BaseEntity;
public class UserEntity extends BaseEntity {
private String username;
private String password;
private boolean isAdmin;
public UserEntity() {
}
public UserEntity(Integer id, String username, String password, boolean isAdmin) {
super(id);
this.username = username;
this.password = password;
this.isAdmin = isAdmin;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public boolean getIsAdmin() {
return isAdmin;
}
public void setIsAdmin(boolean isAdmin) {
this.isAdmin = isAdmin;
}
@Override
public int hashCode() {
return Objects.hash(id, username, password, isAdmin);
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null || getClass() != obj.getClass())
return false;
final UserEntity other = (UserEntity) obj;
return Objects.equals(other.getId(), id) &&
Objects.equals(other.getUsername(), username) &&
Objects.equals(other.getIsAdmin(), isAdmin) &&
Objects.equals(other.getPassword(), password);
}
}

View File

@ -0,0 +1,11 @@
package com.example.backend.users.repository;
import org.springframework.stereotype.Repository;
import com.example.backend.core.repository.MapRepository;
import com.example.backend.users.model.UserEntity;
@Repository
public class UserRepository extends MapRepository<UserEntity> {
}