forked from p85126437/datagear
修改数据集保存时设置SQL结果列标签有时导致保存报错的BUG
This commit is contained in:
parent
b4ac624620
commit
53ab1b53d7
|
@ -38,6 +38,8 @@ public class SqlDataSetEntity extends SqlDataSet implements CreateUserEntity<Str
|
|||
/** 权限 */
|
||||
private int dataPermission = PERMISSION_NOT_LOADED;
|
||||
|
||||
private transient String _propertyLabelsText;
|
||||
|
||||
public SqlDataSetEntity()
|
||||
{
|
||||
super();
|
||||
|
@ -111,19 +113,25 @@ public class SqlDataSetEntity extends SqlDataSet implements CreateUserEntity<Str
|
|||
this.dataPermission = dataPermission;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setProperties(List<DataSetProperty> properties)
|
||||
{
|
||||
super.setProperties(properties);
|
||||
|
||||
if(this._propertyLabelsText != null)
|
||||
setPropertyLabelsText(properties, this._propertyLabelsText);
|
||||
}
|
||||
|
||||
public void setPropertyLabelsText(String text)
|
||||
{
|
||||
String[] labels = DataSetProperty.splitLabels(text, PROPERTY_LABELS_SPLITTER);
|
||||
|
||||
if (labels == null || labels.length == 0)
|
||||
return;
|
||||
|
||||
List<DataSetProperty> properties = getProperties();
|
||||
|
||||
for (int i = 0; i < properties.size(); i++)
|
||||
|
||||
if(properties == null || properties.isEmpty())
|
||||
this._propertyLabelsText = text;
|
||||
else
|
||||
{
|
||||
if (i < labels.length)
|
||||
properties.get(i).setLabel(labels[i]);
|
||||
this._propertyLabelsText = null;
|
||||
setPropertyLabelsText(properties, text);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -131,4 +139,18 @@ public class SqlDataSetEntity extends SqlDataSet implements CreateUserEntity<Str
|
|||
{
|
||||
return DataSetProperty.concatLabels(getProperties(), PROPERTY_LABELS_SPLITTER);
|
||||
}
|
||||
|
||||
protected void setPropertyLabelsText(List<DataSetProperty> properties, String text)
|
||||
{
|
||||
String[] labels = DataSetProperty.splitLabels(text, PROPERTY_LABELS_SPLITTER);
|
||||
|
||||
if (labels == null || labels.length == 0)
|
||||
return;
|
||||
|
||||
for (int i = 0; i < Math.min(labels.length, properties.size()); i++)
|
||||
{
|
||||
if (i < labels.length)
|
||||
properties.get(i).setLabel(labels[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue