如何能将如下代码里的判断用lambda表达式代替,主要是我图里框起来的部分,万分感谢
//获取当前登录用户授权的行政区划编码
List<string> AreaCodeList = area.GetUserDistrictCode(AreaCode);
if (string.IsNullOrEmpty(queryJson))
{
return this.BaseRepository("ground_report", "MySql").FindList(a => true, pagination).ToList();
}
else
{
Expression<Func<Grw_MonitorPointEntity, bool>> exp = a => true;
if (HydGeoUnit1 != "") exp = exp.And(a => a.HydGeoUnit1.Contains(HydGeoUnit1));
if (HydGeoUnit2 != "") exp = exp.And(a => a.HydGeoUnit2.Contains(HydGeoUnit2));
if (InputValue != "") exp = exp.And(a => a.MonitorPointID.Contains(InputValue));
exp = exp.And(a => a.Year == Year);
if (AreaCode != "00")//非全国
{
if (AreaCodeList != null)//授权的行政区划List不为空
{
if (AreaCodeList[0] != "000000")//非最高级别
{
if (AreaCodeList.Count > 1)
{
//不知道咋写
}
else
{
exp = exp.And(a => a.AreaCode.StartsWith(AreaCodeList[0].Substring(0, AreaCode.Length)));
}
}
}
}
}