fix sql生成结构

This commit is contained in:
2024-08-27 17:11:18 +08:00
parent 1e855c3ec9
commit 482a07ac08

View File

@@ -80,11 +80,11 @@ public class GainfoService : IGainfoService
ISugarQueryable<GainfoPageResponse> queryable = request.IsSearchAll
? _gainfoStore.Queryable(request.Status)
.LeftJoin<DepartmentEntity>((gainfo, department) => gainfo.DepartmentNo == department.No)
.LeftJoin<BasicTypeEntity>((gainfo, department, type) => type.Code == SqlFunc.ToString(gainfo.CardType) && type.Type == "timeperiod")
.WhereIF(request.DepartmentSelections?.Any() == true, where)
.WhereIF(request.DepartmentSelections?.Any() == false, gainfo => factories.Contains(gainfo.Factory) ||
SqlFunc.Subqueryable<BusinessTripEntity>().Where(p => p.Code == gainfo.Code && factories.Contains(p.Destination) && SqlFunc.DateIsSame(p.BeginDate, today)).Any())
.LeftJoin<DepartmentEntity>((gainfo, department) => gainfo.DepartmentNo == department.No)
.LeftJoin<BasicTypeEntity>((gainfo, department, type) => type.Code == SqlFunc.ToString(gainfo.CardType) && type.Type == "timeperiod")
.WhereIF(request.Search.IsPresent(), gainfo =>
gainfo.Name.Contains(request.Search)
|| gainfo.Code == request.Search