feat(客户评估): 实现客户评估表单的搜索和显示功能
添加客户评估表单文件的搜索功能,支持按公司ID和搜索文本查询 新增CompanyCustomerEvaluationFormFileStringConverter用于文件显示转换 优化自动完成功能,支持自定义搜索逻辑 移除不必要的文件路径属性绑定 重构客户评估表单窗口控制器继承结构
This commit is contained in:
@@ -2,6 +2,7 @@ package com.ecep.contract.ds.customer.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import jakarta.persistence.criteria.Path;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -58,9 +59,14 @@ public class CompanyCustomerEvaluationFormFileService
|
||||
return null;
|
||||
}
|
||||
return (root, query, builder) -> {
|
||||
var customerFile = root.get("customerFile");
|
||||
return builder.or(
|
||||
builder.like(root.get("catalog"), "%" + searchText + "%"),
|
||||
builder.like(root.get("level"), "%" + searchText + "%"));
|
||||
builder.like(root.get("level"), "%" + searchText + "%"),
|
||||
builder.and(
|
||||
customerFile.isNotNull(),
|
||||
builder.like(customerFile.get("filePath"), "%" + searchText + "%")
|
||||
));
|
||||
};
|
||||
}
|
||||
|
||||
@@ -82,7 +88,7 @@ public class CompanyCustomerEvaluationFormFileService
|
||||
|
||||
@Override
|
||||
public Page<CompanyCustomerEvaluationFormFile> findAll(Specification<CompanyCustomerEvaluationFormFile> spec,
|
||||
Pageable pageable) {
|
||||
Pageable pageable) {
|
||||
return repository.findAll(spec, pageable);
|
||||
}
|
||||
|
||||
@@ -94,10 +100,12 @@ public class CompanyCustomerEvaluationFormFileService
|
||||
}
|
||||
|
||||
if (paramsNode.has("customer")) {
|
||||
CompanyCustomer customer = new CompanyCustomer();
|
||||
customer.setId(paramsNode.get("customer").asInt());
|
||||
spec = SpecificationUtils.and(spec,
|
||||
(root, query, builder) -> builder.equal(root.get("customerFile").get("customer"), customer));
|
||||
(root, query, builder) -> builder.equal(root.get("customerFile").get("customer").get("id"), paramsNode.get("customer").asInt()));
|
||||
}
|
||||
if (paramsNode.has("company")) {
|
||||
spec = SpecificationUtils.and(spec,
|
||||
(root, query, builder) -> builder.equal(root.get("customerFile").get("customer").get("company").get("id"), paramsNode.get("company").asInt()));
|
||||
}
|
||||
|
||||
spec = SpecificationUtils.andParam(spec, paramsNode, "customerFile");
|
||||
@@ -108,7 +116,7 @@ public class CompanyCustomerEvaluationFormFileService
|
||||
|
||||
/**
|
||||
* 根据客户查询所有评估表文件
|
||||
*
|
||||
*
|
||||
* @param customer 客户实体
|
||||
* @return 评估表文件列表
|
||||
*/
|
||||
@@ -118,7 +126,7 @@ public class CompanyCustomerEvaluationFormFileService
|
||||
|
||||
/**
|
||||
* 根据客户ID和文件类型查询评估表文件
|
||||
*
|
||||
*
|
||||
* @param companyCustomerId 客户ID
|
||||
* @param type 文件类型
|
||||
* @return 评估表文件列表
|
||||
@@ -129,7 +137,7 @@ public class CompanyCustomerEvaluationFormFileService
|
||||
|
||||
/**
|
||||
* 根据客户文件查询评估表文件
|
||||
*
|
||||
*
|
||||
* @param customerFile 客户文件实体
|
||||
* @return 评估表文件列表
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user