Expression<Func<YlyShoufeiNrEntity, bool>> where = this.ListFilter(param);
SqlServerExpressionContext expContext = new SqlServerExpressionContext();
expContext.Resolve(where, ResolveExpressType.WhereSingle);
var value = expContext.Result.GetString();//( [id] = @id0 )
var pars = expContext.Parameters;// @id:11
//server=139.129.117.214,3334;uid=sa;pwd=sa@123;database=yisha-yly
SqlSugarClient db = new SqlSugarClient(new ConnectionConfig()
{
ConnectionString = "Data Source=139.129.117.214,3334;Initial Catalog=yisha-yly;User ID=sa;Password=sa@123;",//必填, 数据库连接字符串
DbType =SqlSugar.DbType.SqlServer, //必填, 数据库类型
IsAutoCloseConnection = true, //默认false, 时候知道关闭数据库连接, 设置为true无需使用using或者Close操作
InitKeyType = InitKeyType.SystemTable //默认SystemTable, 字段信息读取, 如:该属性是不是主键,是不是标识列等等信息
});
string sql = @"select d.xingming as hlryName,d.fangjianhao,d.fangjianmingcheng,* from YlyShoufeiNr a left join
(select c.fangjianhao,c.fangjianmingcheng,b.* from YlyHulirenyuan b left join YlyFangjian c on b.fangjianid=c.Id ) d on a.hlryId=d.Id where " + value;
List<YlyShoufeiNrEntity> list = db.SqlQueryable<YlyShoufeiNrEntity>(sql).AddParameters(pars.ToArray()).ToList();