GetList 如何返回指定字段,谢谢。 返回
SqlSugar
老数据
1
2391
悬赏:5 飞吻
public TableModel<Country> GetByContinent(int continent)
{
Expression<Func<Country, bool>> ex = (it => it.Continent==continent);
List<Country> data = sdb.GetList(ex);
TableModel<Country> t = new TableModel<Country>();
t.Code = 0;
t.Data = data;
t.Msg = "成功";
return t;
}
上面查询结果=Select * from Country where Continent=‘’;返回所有符合条件数据
问题:如何只返回指定字段,比如Select A,B,C from Country where Continent=‘’
热忱回答(1)
-
fate stay night VIP0
2018/10/13db.queryable<T>().Select(it=>new{ xx=it.xx,yy=it.yy}).tolist()
0 回复