refactor(vo): 重构VO对象结构,统一字段命名和接口实现

重构所有VO对象,统一字段命名规范,移除冗余字段,优化接口实现
新增Voable接口用于VO对象转换
调整BaseViewModel和ProjectBasedViewModel接口定义
更新相关服务和控制器以适应VO对象变更
This commit is contained in:
2025-09-21 17:47:52 +08:00
parent 07c3f39a95
commit 039d753bab
408 changed files with 6602 additions and 4800 deletions

View File

@@ -9,6 +9,7 @@ import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import java.util.function.Function;
import com.ecep.contract.util.ParamUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeansException;
@@ -48,7 +49,7 @@ import javafx.util.converter.NumberStringConverter;
/**
* 实体管理器皮肤
* 提供了实体管理器的基本功能,如查询、新增、删除、修改、分页等
*
*
* @param <T> Entity 的类型
* @param <TV> Entity 对应的ViewModel
* @param <SKIN> Skin 的类型
@@ -284,13 +285,13 @@ public abstract class AbstEntityManagerSkin<T extends IdentityEntity, TV extends
/**
* 处理单元格编辑事件
*
*
* @param <K>
* @param event
* @param propGetter
*/
protected <K> void acceptCellEditEvent(TableColumn.CellEditEvent<TV, K> event,
Function<TV, Property<K>> propGetter) {
Function<TV, Property<K>> propGetter) {
TV row = event.getRowValue();
Property<K> property = propGetter.apply(row);
property.setValue(event.getNewValue());
@@ -350,7 +351,7 @@ public abstract class AbstEntityManagerSkin<T extends IdentityEntity, TV extends
/**
* 加载行数据
*
*
* @param row
* @return
*/
@@ -364,7 +365,7 @@ public abstract class AbstEntityManagerSkin<T extends IdentityEntity, TV extends
/**
* 删除行数据
*
*
* @param entity
*/
public void deleteRowData(T entity) {
@@ -377,7 +378,7 @@ public abstract class AbstEntityManagerSkin<T extends IdentityEntity, TV extends
/**
* 保存行数据
*
*
* @param entity
* @return
*/
@@ -452,7 +453,7 @@ public abstract class AbstEntityManagerSkin<T extends IdentityEntity, TV extends
/**
* 更新表格数据
*
*
* @param models
*/
protected void updateTableDataSet(List<TV> models) {
@@ -482,14 +483,14 @@ public abstract class AbstEntityManagerSkin<T extends IdentityEntity, TV extends
/**
* 加载表格数据
*
*
* @return
*/
protected List<TV> loadTableData() {
Map<String, Object> params = getSpecification();
ParamUtils.Builder params = getSpecification();
ViewModelService<T, TV> service = getViewModelService();
long timeMillis = System.currentTimeMillis();
Page<T> page = service.findAll(params, getPageable());
Page<T> page = service.findAll(params == null ? null : params.build(), getPageable());
long timeCost = System.currentTimeMillis() - timeMillis;
if (logger.isDebugEnabled()) {
logger.debug("load table data cost: {} ms", timeCost);
@@ -501,15 +502,16 @@ public abstract class AbstEntityManagerSkin<T extends IdentityEntity, TV extends
return page.map(service::from).toList();
}
/**
* 异步加载表格数据
*
*
* @param queryService
* @param future
*/
private void asyncLoadTableData(QueryService<T, TV> queryService, CompletableFuture<Void> future) {
queryService.asyncFindAll(getSpecification(), getPageable()).whenComplete((result, ex) -> {
ParamUtils.Builder params = getSpecification();
queryService.asyncFindAll(params == null ? null : params.build(), getPageable()).whenComplete((result, ex) -> {
if (ex != null) {
future.completeExceptionally(ex);
return;
@@ -522,7 +524,7 @@ public abstract class AbstEntityManagerSkin<T extends IdentityEntity, TV extends
/**
* 获取ViewModelService
*
*
* @return
*/
protected ViewModelService<T, TV> getViewModelService() {
@@ -535,10 +537,10 @@ public abstract class AbstEntityManagerSkin<T extends IdentityEntity, TV extends
/**
* 获取查询条件
*
*
* @return
*/
public Map<String, Object> getSpecification() {
public ParamUtils.Builder getSpecification() {
TextField field = controller.searchKeyField;
if (field != null) {
return getViewModelService().getSpecification(field.getText());
@@ -548,11 +550,11 @@ public abstract class AbstEntityManagerSkin<T extends IdentityEntity, TV extends
/**
* 获取查询条件
*
*
* @param searchText
* @return
*/
protected Map<String, Object> getSpecification(String searchText) {
protected ParamUtils.Builder getSpecification(String searchText) {
return getViewModelService().getSpecification(searchText);
}
@@ -566,7 +568,7 @@ public abstract class AbstEntityManagerSkin<T extends IdentityEntity, TV extends
/**
* 更新页脚
*
*
* @param page
*/
protected void updateFooter(Page<T> page) {
@@ -581,7 +583,7 @@ public abstract class AbstEntityManagerSkin<T extends IdentityEntity, TV extends
/**
* 获取表格排序
*
*
* @return
*/
public List<Sort.Order> getTableOrders() {
@@ -590,7 +592,7 @@ public abstract class AbstEntityManagerSkin<T extends IdentityEntity, TV extends
/**
* 获取表格排序
*
*
* @return
*/
public Sort getSortByTable() {
@@ -602,7 +604,7 @@ public abstract class AbstEntityManagerSkin<T extends IdentityEntity, TV extends
/**
* 获取分页参数
*
*
* @return
*/
public Pageable getPageable() {
@@ -612,7 +614,7 @@ public abstract class AbstEntityManagerSkin<T extends IdentityEntity, TV extends
/**
* 显示在当前窗口为父窗口的新窗口
*
*
* @param <Controller> 控制器类型
* @param clz 控制器类
* @param model 数据