333
This commit is contained in:
parent
6c20bc438e
commit
2a6d268488
|
|
@ -1,6 +1,7 @@
|
|||
using AutoMapper;
|
||||
|
||||
using CoreCms.Net.IServices;
|
||||
using CoreCms.Net.Model.Entities;
|
||||
using CoreCms.Net.Model.ViewModels.SQ;
|
||||
|
||||
using Kdbndp.KingbaseTypes;
|
||||
|
|
@ -60,7 +61,7 @@ namespace CoreCms.Net.Services.SQ
|
|||
/// <param name="_coreCmsUserBlacklistServices"></param>
|
||||
/// <param name="_mapper"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<bool> LoadSQReservationParticipantsApiDto(this List<SQReservationsBaseDto> list, int userId, SqlSugarScope _dbBase, ICoreCmsUserBlacklistServices _coreCmsUserBlacklistServices, IMapper _mapper)
|
||||
public static async Task<bool> LoadSQReservationParticipantsApiDto(this List<SQReservationsBaseDto> list, int userId, SqlSugarScope _dbBase, ICoreCmsUserBlacklistServices _coreCmsUserBlacklistServices, List<SQRooms> rooms, IMapper _mapper)
|
||||
{
|
||||
var rIds = list.Select(it => it.id).ToList();
|
||||
if (rIds != null && rIds.Count > 0)
|
||||
|
|
@ -89,6 +90,11 @@ namespace CoreCms.Net.Services.SQ
|
|||
{
|
||||
var temp = participants.Where(it => it.reservation_id == item.id).OrderBy(it => it.role).ThenBy(it => it.status).ToList();
|
||||
var dto = _mapper.Map<List<SQReservationParticipantsApiDto>>(temp);
|
||||
var room = rooms.Find(it => it.id == item.room_id);
|
||||
if (room != null)
|
||||
{
|
||||
item.room_name = $"{room.name} {room.price_per_hour.ToString("#.##")}/小时";
|
||||
}
|
||||
item.Participants = dto;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,9 +93,10 @@ public class SQController : ControllerBase
|
|||
var list = await _dbBase.Ado.SqlQueryAsync<SQReservationsMyDto>($"select r.*,p.id pid, p.status pstatus,p.join_time, p.quit_time ,p.is_refund from SQReservationParticipants p inner join SQReservations r on p.reservation_id=r.id where p.user_id={userId} and p.role={type} order by p.id desc OFFSET {(index - 1) * size} ROWS FETCH NEXT {size} ROWS ONLY");
|
||||
if (list != null && list.Count > 0)
|
||||
{
|
||||
var roomList = await _SQRoomsServices.GetRoomList();
|
||||
// 转为基类列表
|
||||
var baseList = list.Cast<SQReservationsBaseDto>().ToList();
|
||||
await baseList.LoadSQReservationParticipantsApiDto(userId, _dbBase, _coreCmsUserBlacklistServices, _mapper);
|
||||
await baseList.LoadSQReservationParticipantsApiDto(userId, _dbBase, _coreCmsUserBlacklistServices, roomList, _mapper);
|
||||
}
|
||||
return new WebApiDto()
|
||||
{
|
||||
|
|
@ -117,9 +118,10 @@ public class SQController : ControllerBase
|
|||
var list = await _dbBase.Ado.SqlQueryAsync<SQReservationsApiDto>($"select top 3 r.* from SQReservations r left join SQReservationParticipants p on r.id=p.reservation_id where r.status<2 and p.user_id={userId} and p.status=0 order by r.start_time ");
|
||||
if (list != null && list.Count > 0)
|
||||
{
|
||||
var roomList = await _SQRoomsServices.GetRoomList();
|
||||
// 转为基类列表
|
||||
var baseList = list.Cast<SQReservationsBaseDto>().ToList();
|
||||
await baseList.LoadSQReservationParticipantsApiDto(userId, _dbBase, _coreCmsUserBlacklistServices, _mapper);
|
||||
await baseList.LoadSQReservationParticipantsApiDto(userId, _dbBase, _coreCmsUserBlacklistServices, roomList, _mapper);
|
||||
}
|
||||
return new WebApiDto()
|
||||
{
|
||||
|
|
@ -149,7 +151,7 @@ public class SQController : ControllerBase
|
|||
{
|
||||
// 转为基类列表
|
||||
var baseList = pageList.Cast<SQReservationsBaseDto>().ToList();
|
||||
await baseList.LoadSQReservationParticipantsApiDto(userId, _dbBase, _coreCmsUserBlacklistServices, _mapper);
|
||||
await baseList.LoadSQReservationParticipantsApiDto(userId, _dbBase, _coreCmsUserBlacklistServices, roomList, _mapper);
|
||||
}
|
||||
return new WebApiDto()
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user