refactor(vo): 重构VO类及相关模型,添加Voable接口实现
feat(constant): 添加WebSocket错误码常量 docs(model): 为模型类添加注释 fix(service): 修复ProductUsageService缓存键问题 refactor(converter): 重构字符串转换器,移除EntityStringConverter依赖 feat(tab): 添加ComboBoxUtils工具类,优化下拉框初始化 style: 移除无用导入和字段
This commit is contained in:
@@ -2,19 +2,17 @@ package com.ecep.contract.converter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ecep.contract.service.ContractGroupService;
|
||||
import javafx.util.StringConverter;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import com.ecep.contract.vo.ContractGroupVo;
|
||||
|
||||
public class ContractGroupStringConverter extends EntityStringConverter<ContractGroupVo> {
|
||||
public class ContractGroupStringConverter extends StringConverter<ContractGroupVo> {
|
||||
private ContractGroupService service;
|
||||
|
||||
private List<ContractGroupVo> dataset;
|
||||
|
||||
public ContractGroupStringConverter() {
|
||||
}
|
||||
|
||||
public ContractGroupStringConverter(List<ContractGroupVo> dataset) {
|
||||
this.dataset = dataset;
|
||||
public ContractGroupStringConverter(ContractGroupService contractGroupService) {
|
||||
this.service = contractGroupService;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -22,32 +20,14 @@ public class ContractGroupStringConverter extends EntityStringConverter<Contract
|
||||
if (group == null) {
|
||||
return "All";
|
||||
}
|
||||
return group.getName();
|
||||
return group.getCode() + " " + group.getName() + " " + group.getTitle();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ContractGroupVo fromString(String string) {
|
||||
if (dataset == null) {
|
||||
return null;
|
||||
}
|
||||
if (!StringUtils.hasText(string)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
for (ContractGroupVo group : dataset) {
|
||||
if (group == null) {
|
||||
continue;
|
||||
}
|
||||
if (toString(group).equals(string)) {
|
||||
return group;
|
||||
}
|
||||
if (group.getCode().equals(string)) {
|
||||
return group;
|
||||
}
|
||||
if (group.getName().contains(string)) {
|
||||
return group;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return service.findByCode(string);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user