refactor(service): 实现VoableService接口以统一VO与实体映射逻辑

refactor(model): 重构实体类与VO类的字段映射关系
style: 调整代码格式与注释
fix: 修复部分字段映射错误
This commit is contained in:
2025-09-26 12:31:08 +08:00
parent 045a1e9eed
commit 42a8f9ab30
67 changed files with 2277 additions and 610 deletions

View File

@@ -1,17 +1,17 @@
package com.ecep.contract;
import com.ecep.contract.ds.MyRepository;
import com.ecep.contract.model.Contract;
import com.ecep.contract.util.SpecificationUtils;
import com.fasterxml.jackson.databind.JsonNode;
import org.springframework.cache.annotation.Cacheable;
import java.util.List;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.util.StringUtils;
import java.util.List;
import com.ecep.contract.constant.ServiceConstant;
import com.ecep.contract.ds.MyRepository;
import com.ecep.contract.util.SpecificationUtils;
import com.fasterxml.jackson.databind.JsonNode;
public abstract class EntityService<T, ID> {
@@ -19,7 +19,6 @@ public abstract class EntityService<T, ID> {
public abstract T createNewEntity();
public long count() {
return getRepository().count();
}
@@ -36,14 +35,13 @@ public abstract class EntityService<T, ID> {
public Page<T> findAll(JsonNode paramsNode, Pageable pageable) {
Specification<T> spec = null;
if (paramsNode.has("searchText")) {
spec = getSpecification(paramsNode.get("searchText").asText());
if (paramsNode.has(ServiceConstant.KEY_SEARCH_TEXT)) {
spec = getSpecification(paramsNode.get(ServiceConstant.KEY_SEARCH_TEXT).asText());
}
spec = SpecificationUtils.and(spec, buildParameterSpecification(paramsNode));
return findAll(spec, pageable);
}
public Page<T> findAll(Specification<T> spec, Pageable pageable) {
return getRepository().findAll(spec, pageable);
}