重构所有VO对象,统一字段命名规范,移除冗余字段,优化接口实现 新增Voable接口用于VO对象转换 调整BaseViewModel和ProjectBasedViewModel接口定义 更新相关服务和控制器以适应VO对象变更
89 lines
2.7 KiB
Java
89 lines
2.7 KiB
Java
package com.ecep.contract.vm;
|
|
|
|
import java.time.LocalDate;
|
|
import java.util.Objects;
|
|
|
|
import com.ecep.contract.CompanyCustomerFileType;
|
|
import com.ecep.contract.vo.CompanyCustomerFileVo;
|
|
|
|
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<CompanyCustomerFileVo> {
|
|
|
|
public static CompanyCustomerFileViewModel from(CompanyCustomerFileVo companyCustomerFile) {
|
|
CompanyCustomerFileViewModel model = new CompanyCustomerFileViewModel();
|
|
model.update(companyCustomerFile);
|
|
return model;
|
|
}
|
|
|
|
/**
|
|
* CompanyCustomer
|
|
*/
|
|
@ToString.Exclude
|
|
private SimpleObjectProperty<Integer> 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(CompanyCustomerFileVo 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(CompanyCustomerFileVo 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;
|
|
}
|
|
}
|