refactor(vo): 重构VO对象结构,统一字段命名和接口实现
重构所有VO对象,统一字段命名规范,移除冗余字段,优化接口实现 新增Voable接口用于VO对象转换 调整BaseViewModel和ProjectBasedViewModel接口定义 更新相关服务和控制器以适应VO对象变更
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
package com.ecep.contract.converter;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.ecep.contract.service.CompanyCustomerService;
|
||||
import com.ecep.contract.vo.CompanyCustomerVo;
|
||||
|
||||
import jakarta.annotation.PostConstruct;
|
||||
|
||||
@Lazy
|
||||
@Component
|
||||
public class CompanyCustomerStringConverter extends EntityStringConverter<CompanyCustomerVo> {
|
||||
@Lazy
|
||||
@Autowired
|
||||
private CompanyCustomerService service;
|
||||
|
||||
public CompanyCustomerStringConverter() {
|
||||
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
private void init() {
|
||||
setInitialized(customer -> service.findById(customer.getId()));
|
||||
setSuggestion(service::search);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -4,14 +4,14 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.ecep.contract.model.Company;
|
||||
import com.ecep.contract.service.CompanyService;
|
||||
import com.ecep.contract.vo.CompanyVo;
|
||||
|
||||
import jakarta.annotation.PostConstruct;
|
||||
|
||||
@Lazy
|
||||
@Component
|
||||
public class CompanyStringConverter extends EntityStringConverter<Company> {
|
||||
public class CompanyStringConverter extends EntityStringConverter<CompanyVo> {
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.ecep.contract.converter;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.ecep.contract.service.CompanyVendorService;
|
||||
import com.ecep.contract.vo.CompanyVendorVo;
|
||||
|
||||
import jakarta.annotation.PostConstruct;
|
||||
|
||||
@Lazy
|
||||
@Component
|
||||
public class CompanyVendorStringConverter extends EntityStringConverter<CompanyVendorVo> {
|
||||
@Lazy
|
||||
@Autowired
|
||||
private CompanyVendorService service;
|
||||
|
||||
public CompanyVendorStringConverter() {
|
||||
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
private void init() {
|
||||
setInitialized(vendor -> service.findById(vendor.getId()));
|
||||
setSuggestion(service::search);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -4,28 +4,29 @@ import java.util.List;
|
||||
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import com.ecep.contract.model.ContractGroup;
|
||||
import com.ecep.contract.vo.ContractGroupVo;
|
||||
|
||||
import javafx.util.StringConverter;
|
||||
public class ContractGroupStringConverter extends EntityStringConverter<ContractGroupVo> {
|
||||
|
||||
public class ContractGroupStringConverter extends EntityStringConverter<ContractGroup> {
|
||||
|
||||
private List<ContractGroup> dataset;
|
||||
private List<ContractGroupVo> dataset;
|
||||
|
||||
public ContractGroupStringConverter() {
|
||||
}
|
||||
|
||||
public ContractGroupStringConverter(List<ContractGroup> dataset) {
|
||||
public ContractGroupStringConverter(List<ContractGroupVo> dataset) {
|
||||
this.dataset = dataset;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(ContractGroup group) {
|
||||
return group == null ? "All" : ContractGroup.toString(group);
|
||||
public String toString(ContractGroupVo group) {
|
||||
if (group == null) {
|
||||
return "All";
|
||||
}
|
||||
return group.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ContractGroup fromString(String string) {
|
||||
public ContractGroupVo fromString(String string) {
|
||||
if (dataset == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -33,11 +34,11 @@ public class ContractGroupStringConverter extends EntityStringConverter<Contract
|
||||
return null;
|
||||
}
|
||||
|
||||
for (ContractGroup group : dataset) {
|
||||
for (ContractGroupVo group : dataset) {
|
||||
if (group == null) {
|
||||
continue;
|
||||
}
|
||||
if (ContractGroup.toString(group).equals(string)) {
|
||||
if (toString(group).equals(string)) {
|
||||
return group;
|
||||
}
|
||||
if (group.getCode().equals(string)) {
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
package com.ecep.contract.converter;
|
||||
|
||||
import com.ecep.contract.model.Contract;
|
||||
import com.ecep.contract.service.ContractService;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.ecep.contract.service.ContractService;
|
||||
import com.ecep.contract.vo.ContractVo;
|
||||
|
||||
import jakarta.annotation.PostConstruct;
|
||||
|
||||
@Lazy
|
||||
@Component
|
||||
public class ContractStringConverter extends EntityStringConverter<Contract> {
|
||||
public class ContractStringConverter extends EntityStringConverter<ContractVo> {
|
||||
@Lazy
|
||||
@Autowired
|
||||
ContractService service;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.ecep.contract.converter;
|
||||
|
||||
import com.ecep.contract.model.ContractType;
|
||||
import com.ecep.contract.service.ContractTypeService;
|
||||
import com.ecep.contract.vo.ContractTypeVo;
|
||||
|
||||
public class ContractTypeStringConverter extends EntityStringConverter<ContractType> {
|
||||
public class ContractTypeStringConverter extends EntityStringConverter<ContractTypeVo> {
|
||||
ContractTypeService contractTypeService;
|
||||
|
||||
public ContractTypeStringConverter(ContractTypeService contractTypeService) {
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.ecep.contract.converter;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.ecep.contract.service.DepartmentService;
|
||||
import com.ecep.contract.vo.DepartmentVo;
|
||||
|
||||
import jakarta.annotation.PostConstruct;
|
||||
|
||||
@Lazy
|
||||
@Component
|
||||
public class DepartmentStringConverter extends EntityStringConverter<DepartmentVo> {
|
||||
@Lazy
|
||||
@Autowired
|
||||
private DepartmentService service;
|
||||
|
||||
public DepartmentStringConverter() {
|
||||
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
private void init() {
|
||||
setInitialized(department -> service.findById(department.getId()));
|
||||
setSuggestion(service::search);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -4,14 +4,14 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.ecep.contract.model.Employee;
|
||||
import com.ecep.contract.service.EmployeeService;
|
||||
import com.ecep.contract.vo.EmployeeVo;
|
||||
|
||||
import jakarta.annotation.PostConstruct;
|
||||
|
||||
@Lazy
|
||||
@Component
|
||||
public class EmployeeStringConverter extends EntityStringConverter<Employee> {
|
||||
public class EmployeeStringConverter extends EntityStringConverter<EmployeeVo> {
|
||||
@Lazy
|
||||
@Autowired
|
||||
private EmployeeService service;
|
||||
@@ -22,7 +22,7 @@ public class EmployeeStringConverter extends EntityStringConverter<Employee> {
|
||||
|
||||
@PostConstruct
|
||||
private void init() {
|
||||
setInitialized(project -> service.findById(project.getId()));
|
||||
setInitialized(employee -> service.findById(employee.getId()));
|
||||
setSuggestion(service::search);
|
||||
setFromString(service::findByName);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.ecep.contract.converter;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.ecep.contract.service.ProductTypeService;
|
||||
import com.ecep.contract.vo.ProductTypeVo;
|
||||
|
||||
import jakarta.annotation.PostConstruct;
|
||||
|
||||
@Lazy
|
||||
@Component
|
||||
public class ProductTypeStringConverter extends EntityStringConverter<ProductTypeVo> {
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ProductTypeService service;
|
||||
|
||||
public ProductTypeStringConverter() {
|
||||
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
private void init() {
|
||||
setInitialized(type -> service.findById(type.getId()));
|
||||
setSuggestion(service::search);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.ecep.contract.converter;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.ecep.contract.service.ProductUsageService;
|
||||
import com.ecep.contract.vo.ProductUsageVo;
|
||||
|
||||
import jakarta.annotation.PostConstruct;
|
||||
|
||||
@Lazy
|
||||
@Component
|
||||
public class ProductUsageStringConverter extends EntityStringConverter<ProductUsageVo> {
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ProductUsageService service;
|
||||
|
||||
public ProductUsageStringConverter() {
|
||||
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
private void init() {
|
||||
setInitialized(usage -> service.findById(usage.getId()));
|
||||
setSuggestion(service::search);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.ecep.contract.converter;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.ecep.contract.service.ProjectIndustryService;
|
||||
import com.ecep.contract.vo.ProjectIndustryVo;
|
||||
|
||||
import jakarta.annotation.PostConstruct;
|
||||
|
||||
@Lazy
|
||||
@Component
|
||||
public class ProjectIndustryStringConverter extends EntityStringConverter<ProjectIndustryVo> {
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ProjectIndustryService service;
|
||||
|
||||
public ProjectIndustryStringConverter() {
|
||||
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
private void init() {
|
||||
setInitialized(industry -> service.findById(industry.getId()));
|
||||
setSuggestion(service::search);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.ecep.contract.converter;
|
||||
|
||||
import com.ecep.contract.model.Project;
|
||||
import com.ecep.contract.service.ProjectService;
|
||||
import com.ecep.contract.vo.ProjectVo;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
@@ -9,7 +9,7 @@ import org.springframework.stereotype.Component;
|
||||
|
||||
@Lazy
|
||||
@Component
|
||||
public class ProjectStringConverter extends EntityStringConverter<Project> {
|
||||
public class ProjectStringConverter extends EntityStringConverter<ProjectVo> {
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.ecep.contract.converter;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.ecep.contract.service.VendorGroupService;
|
||||
import com.ecep.contract.vo.VendorGroupVo;
|
||||
|
||||
import jakarta.annotation.PostConstruct;
|
||||
|
||||
@Lazy
|
||||
@Component
|
||||
public class VendorGroupStringConverter extends EntityStringConverter<VendorGroupVo> {
|
||||
@Lazy
|
||||
@Autowired
|
||||
private VendorGroupService service;
|
||||
|
||||
public VendorGroupStringConverter() {
|
||||
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
private void init() {
|
||||
setInitialized(group -> service.findById(group.getId()));
|
||||
setSuggestion(service::search);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user