// 设置默认排序字段
this.KSQL_SEQ = " A.FBillNumber, C.FCreateDate ";
if (filter.FilterParameter.SortRows.Count > 0)
{// 过滤界面设置了排序字段,以过滤界面的排序为准
// 过滤界面的排序字段Key未包含表别名,如果直接拼接SQL中,会出错;
// 因此,需要想办法,把排序字段替换为表别名
List<string> sortFields = new List<string>();
foreach(var sortRow in filter.FilterParameter.SortRows)
{
// 排序
string desc = (sortRow.SortType == Kingdee.BOS.Core.CommonFilter.Enu_SortType.DESC) ?
" DESC " : " ASC ";
if (sortRow.SortField.Key == "F_ZX_PROGRESS")
{
sortFields.Add("C.F_ZX_PROGRESS" + desc);
}
else if (sortRow.SortField.Key == "物料编码字段Key")
{
sortFields.Add("D.FNumber" + desc);
}
}
this.KSQL_SEQ = string.Join(",", sortFields);
this.KSQL_SEQ = " A.FBillNumber, C.FCreateDate ";
if (filter.FilterParameter.SortRows.Count > 0)
{// 过滤界面设置了排序字段,以过滤界面的排序为准
// 过滤界面的排序字段Key未包含表别名,如果直接拼接SQL中,会出错;
// 因此,需要想办法,把排序字段替换为表别名
List<string> sortFields = new List<string>();
foreach(var sortRow in filter.FilterParameter.SortRows)
{
// 排序
string desc = (sortRow.SortType == Kingdee.BOS.Core.CommonFilter.Enu_SortType.DESC) ?
" DESC " : " ASC ";
if (sortRow.SortField.Key == "F_ZX_PROGRESS")
{
sortFields.Add("C.F_ZX_PROGRESS" + desc);
}
else if (sortRow.SortField.Key == "物料编码字段Key")
{
sortFields.Add("D.FNumber" + desc);
}
}
this.KSQL_SEQ = string.Join(",", sortFields);
}
本文转自51GT51CTO博客,原文链接:http://blog.51cto.com/yataigp/1961583 ,如需转载请自行联系原作者