use of com.dtstack.taier.dao.domain.DsFormField in project Taier by DTStack.
the class DsFormFieldService method findTemplateByTypeVersion.
/**
* 根据数据库类型和版本查找表单模版
* @param param
* @return
*/
public DsFormTemplateVo findTemplateByTypeVersion(DsTypeVersionParam param) {
DsFormTemplateVo returnVo = new DsFormTemplateVo();
String typeVersion = param.getDataType();
if (Strings.isNotBlank(param.getDataVersion())) {
typeVersion = param.getDataType() + "-" + param.getDataVersion();
}
List<DsFormField> formFieldList = this.list(Wrappers.<DsFormField>query().eq("type_version", typeVersion).or().eq("type_version", COMMON));
List<DsFormFieldVo> formFieldVos = new ArrayList<>();
for (DsFormField dsFormField : formFieldList) {
DsFormFieldVo dsFormFieldVo = new DsFormFieldVo();
BeanUtils.copyProperties(dsFormField, dsFormFieldVo);
if (StringUtils.isNotBlank(dsFormField.getOptions())) {
List<Map> optionList = JSON.parseArray(dsFormField.getOptions(), Map.class);
dsFormFieldVo.setOptions(optionList);
}
formFieldVos.add(dsFormFieldVo);
}
returnVo.setDataType(param.getDataType());
returnVo.setDataVersion(param.getDataVersion());
returnVo.setFromFieldVoList(formFieldVos);
return returnVo;
}
use of com.dtstack.taier.dao.domain.DsFormField in project Taier by DTStack.
the class DatasourceService method getDataSourceLinkInfo.
/**
* 根据数据源版本获取对应的连接信息
* @param dataType
* @param dataVersion
* @param dataJson
* @return
*/
public String getDataSourceLinkInfo(String dataType, String dataVersion, JSONObject dataJson) {
List<DsFormField> linkFieldList = formFieldService.findLinkFieldByTypeVersion(dataType, dataVersion);
if (CollectionUtils.isEmpty(linkFieldList)) {
return null;
}
JSONObject linkJson = new JSONObject();
for (DsFormField dsFormField : linkFieldList) {
String value = JsonUtils.getStrFromJson(dataJson, dsFormField.getName());
if (Strings.isNotBlank(value)) {
linkJson.put(dsFormField.getName(), value);
}
}
return linkJson.toJSONString();
}
Aggregations