做读者档案、联系方式、借阅资格功能

This commit is contained in:
Zzzz
2026-04-27 20:32:46 +08:00
parent 78c649b6d1
commit eff118e6fa
25 changed files with 1997 additions and 5 deletions
@@ -0,0 +1,105 @@
package com.mzh.library.entity;
import java.time.LocalDateTime;
public class Reader {
private long id;
private String identifier;
private Long userId;
private String username;
private String fullName;
private String phone;
private String email;
private ReaderStatus status;
private int maxBorrowCount;
private LocalDateTime createdAt;
private LocalDateTime updatedAt;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getIdentifier() {
return identifier;
}
public void setIdentifier(String identifier) {
this.identifier = identifier;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getFullName() {
return fullName;
}
public void setFullName(String fullName) {
this.fullName = fullName;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public ReaderStatus getStatus() {
return status;
}
public void setStatus(ReaderStatus status) {
this.status = status;
}
public int getMaxBorrowCount() {
return maxBorrowCount;
}
public void setMaxBorrowCount(int maxBorrowCount) {
this.maxBorrowCount = maxBorrowCount;
}
public LocalDateTime getCreatedAt() {
return createdAt;
}
public void setCreatedAt(LocalDateTime createdAt) {
this.createdAt = createdAt;
}
public LocalDateTime getUpdatedAt() {
return updatedAt;
}
public void setUpdatedAt(LocalDateTime updatedAt) {
this.updatedAt = updatedAt;
}
}
@@ -0,0 +1,54 @@
package com.mzh.library.entity;
public class ReaderSearchCriteria {
private String identifier;
private String name;
private String contact;
private String statusCode;
public ReaderSearchCriteria() {
}
public ReaderSearchCriteria(String identifier, String name, String contact, String statusCode) {
this.identifier = trim(identifier);
this.name = trim(name);
this.contact = trim(contact);
this.statusCode = trim(statusCode);
}
public String getIdentifier() {
return identifier;
}
public void setIdentifier(String identifier) {
this.identifier = trim(identifier);
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = trim(name);
}
public String getContact() {
return contact;
}
public void setContact(String contact) {
this.contact = trim(contact);
}
public String getStatusCode() {
return statusCode;
}
public void setStatusCode(String statusCode) {
this.statusCode = trim(statusCode);
}
private String trim(String value) {
return value == null ? "" : value.trim();
}
}
@@ -0,0 +1,40 @@
package com.mzh.library.entity;
import java.util.Locale;
public enum ReaderStatus {
ACTIVE("active", "Active"),
SUSPENDED("suspended", "Suspended"),
INACTIVE("inactive", "Inactive");
private final String code;
private final String displayName;
ReaderStatus(String code, String displayName) {
this.code = code;
this.displayName = displayName;
}
public String getCode() {
return code;
}
public String getDisplayName() {
return displayName;
}
public static ReaderStatus fromCode(String code) {
if (code == null || code.trim().isEmpty()) {
throw new IllegalArgumentException("Reader status is required");
}
String normalized = code.trim().toLowerCase(Locale.ROOT);
for (ReaderStatus status : values()) {
if (status.code.equals(normalized)) {
return status;
}
}
throw new IllegalArgumentException("Unsupported reader status: " + code);
}
}