public async Task <IActionResult> GetAfterSaleServicesPageList([FromQuery] GetAfterSaleServiceListRequestDto request) { var afterSaleServiceBiz = new AfterSaleServiceBiz(); request.MerchantGuid = UserID; return(Success(await afterSaleServiceBiz.GetServicePageListAsync(request))); }
public async Task <GetAfterSaleServiceListResponseDto> GetServicePageListAsync(GetAfterSaleServiceListRequestDto requestDto) { var sqlWhere = string.Empty; if (!string.IsNullOrEmpty(requestDto.ServiceNo)) { sqlWhere = "and ass.service_no = @ServiceNo"; } if (requestDto.AfterSaleStatus.HasValue) { sqlWhere = $"{sqlWhere} and ass.`status` = @AfterSaleStatus"; } if (!string.IsNullOrEmpty(requestDto.OrderNo)) { sqlWhere = $"{sqlWhere} and o.order_no = @OrderNo"; } if (requestDto.ApplicationBeginTime.HasValue) { sqlWhere = $"{sqlWhere} and ass.creation_date >= @ApplicationBeginTime"; } if (requestDto.ApplicationEndTime.HasValue) { requestDto.ApplicationEndTime = requestDto.ApplicationEndTime.Value.AddDays(1); sqlWhere = $"{sqlWhere} and ass.creation_date <= @ApplicationEndTime"; } var sql = $@"SELECT ass.service_guid as ServiceGuid, -- 服务单Guid ass.service_no as ServiceNo,-- 服务编号 o.order_no AS OrderNo,-- 订单编号 o.order_status as OrderStatus,-- 订单状态 u.phone, -- 用户手机号码 u.nick_name as NickName,-- 用户昵称 ass.type AS `Type`,-- 售后类型 ass.creation_date as ApplicationTime, -- 申请时间 ass.`status` as AfterSaleStatus -- 退款状态 FROM t_mall_aftersale_service AS ass INNER JOIN t_mall_order as o ON ass.order_guid = o.order_guid AND ass.user_guid = o.user_guid AND ass.merchant_guid = o.merchant_guid INNER JOIN t_utility_user as u ON u.user_guid = ass.user_guid WHERE ass.merchant_guid = @MerchantGuid {sqlWhere} ORDER BY ass.creation_date desc" ; return(await MySqlHelper.QueryByPageAsync <GetAfterSaleServiceListRequestDto, GetAfterSaleServiceListResponseDto, AfterSaleServiceItem>(sql, requestDto)); }