com.iqiny.silly.spring.spel.field.SillyMasterValuesField Maven / Gradle / Ivy
/*
* Copyright iqiny.com
*
* https://gitee.com/iqiny/silly
*
* project name:silly-spring
* project description:top silly project pom.xml file
*/
package com.iqiny.silly.spring.spel.field;
import com.iqiny.silly.common.util.StringUtils;
import com.iqiny.silly.core.base.core.SillyMaster;
import com.iqiny.silly.core.config.SillyConfigUtil;
import com.iqiny.silly.core.config.property.valuesfield.SillyPropertyValuesField;
import com.iqiny.silly.core.savehandle.SillyNodeSourceData;
import org.springframework.stereotype.Component;
/**
* 主表对象
*/
@Component
public class SillyMasterValuesField implements SillyPropertyValuesField {
public static final String NAME = "master";
@Override
public String fieldName() {
return NAME;
}
@Override
public Object value(SillyNodeSourceData data) {
SillyMaster master = data.getMaster();
if (master != null) {
return master;
}
String masterId = data.masterId();
if (StringUtils.isNotEmpty(masterId)) {
String category = data.getCategory();
master = SillyConfigUtil.getSillyConfig(category).getSillyReadService().getMaster(masterId);
}
return master;
}
}