public virtual EITransactionList GetByPage(List<TransactionStatus> status ,PagingInfo pi = null)
{
//枚举转int
List<int> iStatus = new List<int>();
status.ForEach(e => { iStatus.Add((int)e); });
var f = QueryFactory.Instance;
var t = f.Table<EITransaction>();//实体表
var q = f.Query(
//selection: t.Star(),//selection不写查询所有列
from: t,//要查询的实体的表
where: t.Column(EITransaction.StatusProperty).In(iStatus),//where 条件,
orderBy: new List<IOrderBy> {//排序
f.OrderBy(t.Column(EITransaction.TransDateProperty), OrderDirection.Descending),
f.OrderBy(t.Column(EITransaction.StatusProperty),OrderDirection.Descending)
}
);
return (EITransactionList)this.QueryData(q, pi);
}
rafy在用linq查询,,解决问题时,总是报错,因为在取值对比时,取的是枚举的名称,而数据库存的是值.sqltree直接用枚举也有同样问题.
解决这个问题,就像上边的代码一样,将枚举转成int.再去In就可以了.