当前位置 : 主页 > 网络编程 > net编程 >

SqlSugar 语句

来源:互联网 收集:自由互联 发布时间:2023-09-06
字典数据 倒序 ListDictionaries list = Db.QueryableDictionaries().In(x = x.TypeId, typeidss) .OrderBy(s=s.Sort, OrderByType.Desc) //倒序 .Where(x=x.Del==true) .ToList(); 效果: SqlSugar多表查询 ListZyOrder list = Db.QueryableZ

字典数据 倒序

List<Dictionaries> list = Db.Queryable<Dictionaries>().In(x => x.TypeId, typeidss)

.OrderBy(s=>s.Sort, OrderByType.Desc) //倒序

.Where(x=>x.Del==true)

.ToList();

效果:

SqlSugar  语句_倒序


SqlSugar多表查询

List<ZyOrder> list = Db.Queryable<ZyOrder, User, Warehouse, Dictionaries, Channel, ZyPackage>((x, u, w, d, c, z) => new object[]
{

JoinType.Left,x.UserId==u.Id,
JoinType.Left,x.WareHouseId==w.Id,
JoinType.Left,x.State==d.Value&&d.TypeId==14,
JoinType.Left,x.ChannelId==c.Id,
JoinType.Left,x.Id==z.ZyOrderId,
})

.Where(x => x.Del == true)
.Where(x => x.ServiceNumber == ServiceNumber)
.Select((x, u, w, d, c, z) => new ZyOrder
{
Id = x.Id,
UserId = u.Id,
UserName = u.UserName,
ArrivalNumber = z.ArrivalNumber,
WareHouseId = w.Id,
WareHouseIdName = w.Name,
ChannelId = c.Id,
ChannelIdName = c.Name,
Del = x.Del,
Creationtime = x.Creationtime,
CustomerNo = x.CustomerNo,
Number = x.Number,
ServiceNumber = x.ServiceNumber,
IsHeXiao = x.IsHeXiao,
})
.OrderBy(x => x.Id, OrderByType.Desc)
.ToList();
return list;
上一篇:【Unity开发小技巧】AudioManager声音管理器
下一篇:没有了
网友评论