字典数据 倒序

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;