refactor(vo): 重构VO对象结构,统一字段命名和接口实现
重构所有VO对象,统一字段命名规范,移除冗余字段,优化接口实现 新增Voable接口用于VO对象转换 调整BaseViewModel和ProjectBasedViewModel接口定义 更新相关服务和控制器以适应VO对象变更
This commit is contained in:
@@ -6,6 +6,7 @@ import java.time.LocalDateTime;
|
||||
import java.util.Objects;
|
||||
|
||||
import com.ecep.contract.util.HibernateProxyUtils;
|
||||
import com.ecep.contract.vo.ContractItemVo;
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
@@ -28,7 +29,8 @@ import lombok.ToString;
|
||||
@Entity
|
||||
@Table(name = "CONTRACT_ITEM")
|
||||
@ToString
|
||||
public class ContractItem implements IdentityEntity, ContractBasedEntity, BasedEntity, Serializable {
|
||||
public class ContractItem
|
||||
implements IdentityEntity, ContractBasedEntity, BasedEntity, Serializable, Voable<ContractItemVo> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@@ -162,4 +164,37 @@ public class ContractItem implements IdentityEntity, ContractBasedEntity, BasedE
|
||||
public final int hashCode() {
|
||||
return HibernateProxyUtils.hashCode(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ContractItemVo toVo() {
|
||||
ContractItemVo vo = new ContractItemVo();
|
||||
vo.setId(id);
|
||||
if (contract != null) {
|
||||
vo.setContractId(contract.getId());
|
||||
}
|
||||
vo.setRefId(refId);
|
||||
vo.setItemCode(itemCode);
|
||||
vo.setTitle(title);
|
||||
vo.setSpecification(specification);
|
||||
vo.setUnit(unit);
|
||||
if (inventory != null) {
|
||||
vo.setInventoryId(inventory.getId());
|
||||
}
|
||||
vo.setExclusiveTaxPrice(exclusiveTaxPrice);
|
||||
vo.setTaxRate(taxRate);
|
||||
vo.setTaxPrice(taxPrice);
|
||||
vo.setQuantity(quantity);
|
||||
vo.setCreateDate(createDate);
|
||||
vo.setUpdateDate(updateDate);
|
||||
vo.setStartDate(startDate);
|
||||
vo.setEndDate(endDate);
|
||||
if (creator != null) {
|
||||
vo.setCreatorId(creator.getId());
|
||||
}
|
||||
if (updater != null) {
|
||||
vo.setUpdaterId(updater.getId());
|
||||
}
|
||||
vo.setRemark(remark);
|
||||
return vo;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user