|
@@ -311,8 +311,8 @@ namespace Hotline.Api.Controllers
|
|
|
var (total, items) = await _enforcementOrdersRepository.Queryable()
|
|
|
.Includes(x => x.Order)
|
|
|
.Where(d => d.Order.Id != null)
|
|
|
- .Where(d => d.Order.CreationTime >= dto.StartDate && d.Order.CreationTime <= dto.EndDate)
|
|
|
- .WhereIF(!string.IsNullOrEmpty(dto.EventTypeId), d => d.EventTypeId == dto.EventTypeId)
|
|
|
+ .Where(d => d.Order.CreationTime >= dto.StartDate && d.Order.CreationTime <= dto.EndDate && d.EventTypeId != null)
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(dto.EventTypeId), d => d.EventTypeId.StartsWith(dto.EventTypeId))
|
|
|
.WhereIF(!string.IsNullOrEmpty(dto.AreaCode), d => d.Order.AreaCode == dto.AreaCode)
|
|
|
.OrderByDescending(d => d.CreationTime)
|
|
|
.ToPagedListAsync(dto, HttpContext.RequestAborted);
|
|
@@ -563,7 +563,10 @@ namespace Hotline.Api.Controllers
|
|
|
var list = await _enforcementOrdersRepository.Queryable()
|
|
|
.LeftJoin<OrderVisit>((x, o) => x.Id == o.OrderId)
|
|
|
.LeftJoin<OrderVisitDetail>((x, o, p) => o.Id == p.VisitId)
|
|
|
- .Where((x, o, p) => o.VisitTime >= StartDate && o.VisitTime <= EndDate && p.VisitTarget == EVisitTarget.Org && o.VisitState == EVisitState.Visited && !string.IsNullOrEmpty(p.VisitOrgCode))
|
|
|
+ .Where((x, o, p) => o.VisitTime >= StartDate && o.VisitTime <= EndDate && p.VisitTarget == EVisitTarget.Org)
|
|
|
+ .Where((x, o, p) => o.VisitState == EVisitState.Visited && !string.IsNullOrEmpty(p.VisitOrgCode))
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(OrgCode) && OrgCode == "001", (x, o, p) => p.VisitOrgCode == OrgCode)
|
|
|
+ .WhereIF(!string.IsNullOrEmpty(OrgCode) && OrgCode != "001", (x, o, p) => p.VisitOrgCode.StartsWith(OrgCode))
|
|
|
.GroupBy((x, o, p) => new
|
|
|
{
|
|
|
VisitOrgCode = p.VisitOrgCode.Substring(SqlFunc.MappingColumn<int>("0"), SqlFunc.MappingColumn<int>("6"))
|