fix 补充注释,接口兼容设备
This commit is contained in:
@@ -14,6 +14,11 @@ public class BusinessPlaceShiftResponse
|
||||
/// </summary>
|
||||
public string BusinessPlaceCustomCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 营业点
|
||||
/// </summary>
|
||||
public string BusinessPlace { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 代号
|
||||
/// </summary>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Dlhis.Basic.BusinessShift.Request;
|
||||
using Dlhis.Basic.BusinessPlace.Response;
|
||||
using Dlhis.Basic.BusinessShift.Request;
|
||||
using Dlhis.Basic.BusinessShift.Response;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
|
||||
@@ -10,5 +11,5 @@ public interface IBusinessPlaceShiftService : IScopeDependency
|
||||
|
||||
Task SaveAsync(BusinessPlaceShiftSaveRequest request);
|
||||
|
||||
Task<List<BusinessPlaceShiftResponse>> GetShiftsByPlaceCustomCodeAsync(string placeCustomCode);
|
||||
Task<BusinessPlaceWithShiftResponse> GetShiftsByPlaceCustomCodeAsync(string placeCustomCode);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Dlhis.Basic.BusinessShift.Request;
|
||||
using Dlhis.Basic.BusinessPlace.Response;
|
||||
using Dlhis.Basic.BusinessShift.Request;
|
||||
using Dlhis.Basic.BusinessShift.Response;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
@@ -29,6 +30,7 @@ public class BusinessPlaceShiftService : IBusinessPlaceShiftService
|
||||
Id = shift.Id,
|
||||
BusinessPlaceCode = place.Code,
|
||||
BusinessPlaceCustomCode = place.CustomCode,
|
||||
BusinessPlace = place.Name,
|
||||
Code = shift.Code,
|
||||
CustomCode = shift.CustomCode,
|
||||
Name = shift.Name,
|
||||
@@ -66,24 +68,36 @@ public class BusinessPlaceShiftService : IBusinessPlaceShiftService
|
||||
}
|
||||
|
||||
|
||||
public async Task<List<BusinessPlaceShiftResponse>> GetShiftsByPlaceCustomCodeAsync(string placeCustomCode)
|
||||
public async Task<BusinessPlaceWithShiftResponse> GetShiftsByPlaceCustomCodeAsync(string placeCustomCode)
|
||||
{
|
||||
return await _dbContext.Queryable<CanteenBusinessShiftEntity>()
|
||||
.LeftJoin<CanteenBusinessPlaceEntity>((shift, place) => shift.BusinessPlaceCode == place.Code)
|
||||
.Where((shift, place) => place.CustomCode == placeCustomCode)
|
||||
.OrderBy((shift, place) => shift.Start)
|
||||
.Select((shift, place) => new BusinessPlaceShiftResponse
|
||||
{
|
||||
Id = shift.Id,
|
||||
BusinessPlaceCode = place.Code,
|
||||
BusinessPlaceCustomCode = place.CustomCode,
|
||||
Code = shift.Code,
|
||||
CustomCode = shift.CustomCode,
|
||||
Name = shift.Name,
|
||||
Start = shift.Start,
|
||||
End = shift.End
|
||||
})
|
||||
.ToListAsync();
|
||||
var place = await _dbContext.Queryable<CanteenBusinessPlaceEntity>().Where(x => x.CustomCode == placeCustomCode).FirstAsync();
|
||||
if (place == null)
|
||||
{
|
||||
return new BusinessPlaceWithShiftResponse()
|
||||
{
|
||||
Shifts = new List<BusinessPlaceShiftResponse>()
|
||||
};
|
||||
}
|
||||
var shifts = await _dbContext.Queryable<CanteenBusinessShiftEntity>().Where(x => x.BusinessPlaceCode == place.Code).ToListAsync();
|
||||
|
||||
return new BusinessPlaceWithShiftResponse
|
||||
{
|
||||
CustomCode = placeCustomCode,
|
||||
Name = place.Name,
|
||||
Shifts = shifts.Select(shift => new BusinessPlaceShiftResponse
|
||||
{
|
||||
Id = shift.Id,
|
||||
BusinessPlaceCode = place.Code,
|
||||
BusinessPlaceCustomCode = place.CustomCode,
|
||||
BusinessPlace = place.Name,
|
||||
Code = shift.Code,
|
||||
CustomCode = shift.CustomCode,
|
||||
Name = shift.Name,
|
||||
Start = shift.Start,
|
||||
End = shift.End
|
||||
})
|
||||
.ToList()
|
||||
};
|
||||
}
|
||||
|
||||
//*********************************************** help methods ***************************************************//
|
||||
|
||||
Reference in New Issue
Block a user