拆分模块
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
package com.ecep.contract.vm;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.Objects;
|
||||
|
||||
import com.ecep.contract.CompanyCustomerFileType;
|
||||
import com.ecep.contract.model.CompanyCustomer;
|
||||
import com.ecep.contract.model.CompanyCustomerFile;
|
||||
|
||||
import javafx.beans.property.SimpleBooleanProperty;
|
||||
import javafx.beans.property.SimpleObjectProperty;
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ToString
|
||||
public class CompanyCustomerFileViewModel extends IdentityViewModel<CompanyCustomerFile> {
|
||||
|
||||
public static CompanyCustomerFileViewModel from(CompanyCustomerFile companyCustomerFile) {
|
||||
CompanyCustomerFileViewModel model = new CompanyCustomerFileViewModel();
|
||||
model.update(companyCustomerFile);
|
||||
return model;
|
||||
}
|
||||
|
||||
@ToString.Exclude
|
||||
private SimpleObjectProperty<CompanyCustomer> customer = new SimpleObjectProperty<>();
|
||||
|
||||
private SimpleObjectProperty<CompanyCustomerFileType> type = new SimpleObjectProperty<>();
|
||||
|
||||
private SimpleStringProperty filePath = new SimpleStringProperty();
|
||||
|
||||
private SimpleStringProperty editFilePath = new SimpleStringProperty();
|
||||
|
||||
private SimpleObjectProperty<LocalDate> signDate = new SimpleObjectProperty<>();
|
||||
|
||||
@ToString.Exclude
|
||||
private SimpleBooleanProperty valid = new SimpleBooleanProperty(this, "valid", false);
|
||||
|
||||
|
||||
@Override
|
||||
protected void updateFrom(CompanyCustomerFile v) {
|
||||
super.updateFrom(v);
|
||||
getCustomer().set(v.getCustomer());
|
||||
getType().set(v.getType());
|
||||
getFilePath().set(v.getFilePath());
|
||||
getEditFilePath().set(v.getEditFilePath());
|
||||
|
||||
getSignDate().set(v.getSignDate());
|
||||
getValid().set(v.isValid());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean copyTo(CompanyCustomerFile v) {
|
||||
boolean modified = super.copyTo(v);
|
||||
if (!Objects.equals(customer.get(), v.getCustomer())) {
|
||||
v.setCustomer(customer.get());
|
||||
modified = true;
|
||||
}
|
||||
if (!Objects.equals(type.get(), v.getType())) {
|
||||
v.setType(type.get());
|
||||
modified = true;
|
||||
}
|
||||
|
||||
if (!Objects.equals(filePath.get(), v.getFilePath())) {
|
||||
v.setFilePath(filePath.get());
|
||||
modified = true;
|
||||
}
|
||||
if (!Objects.equals(editFilePath.get(), v.getEditFilePath())) {
|
||||
v.setEditFilePath(editFilePath.get());
|
||||
modified = true;
|
||||
}
|
||||
if (!Objects.equals(signDate.get(), v.getSignDate())) {
|
||||
v.setSignDate(signDate.get());
|
||||
modified = true;
|
||||
}
|
||||
if (!Objects.equals(valid.get(), v.isValid())) {
|
||||
v.setValid(valid.get());
|
||||
modified = true;
|
||||
}
|
||||
return modified;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user