/// <summary> /// 设置查询列和分页参数执行查询,并且将结果集转成dynamic /// </summary> /// <param name="sqlable"></param> /// <param name="fileds">查询列</param> /// <param name="orderByFiled">Order By字段,可以多个</param> /// <param name="pageIndex">页码</param> /// <param name="pageSize">每页显示数量</param> /// <param name="whereObj">SQL参数,例如:new{id=1,name="张三"}</param> /// <returns></returns> public static dynamic SelectToPageDynamic(this Sqlable sqlable, string fileds, string orderByFiled, int pageIndex, int pageSize, object whereObj = null) { return(JsonConverter.ConvertJson(SelectToPageJson(sqlable, fileds, orderByFiled, pageIndex, pageSize, whereObj))); }
/// <summary> /// 设置查询列执行查询,并且将结果集转成dynamic /// </summary> /// <param name="sqlable"></param> /// <param name="fileds">查询列</param> /// <param name="whereObj">SQL参数,例如:new{id=1,name="张三"}</param> /// <returns></returns> public static dynamic SelectToDynamic(this Sqlable sqlable, string fileds, object whereObj = null) { return(JsonConverter.ConvertJson(SelectToJson(sqlable, fileds, whereObj))); }
/// <summary> /// 设置查询列和分页参数执行查询,并且将结果集转成json /// </summary> /// <param name="sqlable"></param> /// <param name="fileds">查询列</param> /// <param name="orderByFiled">Order By字段,可以多个</param> /// <param name="pageIndex">页码</param> /// <param name="pageSize">每页显示数量</param> /// <param name="whereObj">SQL参数,例如:new{id=1,name="张三"}</param> /// <returns></returns> public static string SelectToPageJson(this Sqlable sqlable, string fileds, string orderByFiled, int pageIndex, int pageSize, object whereObj = null) { return(JsonConverter.DataTableToJson(SelectToPageTable(sqlable, fileds, orderByFiled, pageIndex, pageSize, whereObj), sqlable.DB.SerializerDateFormat)); }
/// <summary> /// 设置查询列执行查询,并且将结果集转成json /// </summary> /// <param name="sqlable"></param> /// <param name="fileds">查询列</param> /// <param name="whereObj">SQL参数,例如:new{id=1,name="张三"}</param> /// <returns></returns> public static string SelectToJson(this Sqlable sqlable, string fileds, object whereObj = null) { return(JsonConverter.DataTableToJson(SelectToDataTable(sqlable, fileds, whereObj), sqlable.DB.SerializerDateFormat)); }