All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.gitee.qdbp.filling.biz.BaseEntityDataFillFieldValueService Maven / Gradle / Ivy

package com.gitee.qdbp.filling.biz;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import com.gitee.qdbp.able.beans.KeyString;

/**
 * 实体数据填充单一类型处理基础实现类
* options多个字段以逗号分隔, 默认的填充字段为源字段去掉Id/Code后缀, 加上Name
* -- createUser,updateUser
* -- 等于createUser-createUserName,updateUser-updateUserName
* 也可以自定义转换关系
* -- creatorId-createUser,updatorId-updateUser
* * @author zhaohuihua * @version 20210113 */ public abstract class BaseEntityDataFillFieldValueService extends BaseEntityDataFillFieldValueBasic { /** 查找目标值 (key=sourceValue, value=targetValue) **/ protected abstract Map findTargetValueMaps(Collection sourceValues); @Override public void fillFieldValue(Iterable> list, String option) { List options = parseOptions(option); // # 收集需要填充的信息 // key=sourceValue Map> sourceMaps = collectFillInfos(list, options); if (sourceMaps == null || sourceMaps.isEmpty()) { return; } // # 根据sourceValue查询targetValue List sourceValues = new ArrayList<>(sourceMaps.keySet()); // 复制副本以防修改 // key=sourceValue, value=targetValue Map targetMaps = findTargetValueMaps(sourceValues); if (targetMaps == null || targetMaps.isEmpty()) { return; } // # 将targetValue填充至originalData fillValueToOriginalData(sourceMaps, targetMaps); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy