|
@@ -157,10 +157,33 @@ namespace GxPress.Repository.Implement
|
|
|
{
|
|
|
return await _repository.ExistsAsync(query);
|
|
|
}
|
|
|
-
|
|
|
- public Task<IEnumerable<MissiveReadListResult>> GetMissiveReadListAsync(MissiveReadListRequest request)
|
|
|
+ /// <summary>
|
|
|
+ /// 站内信未读
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="request"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task<IEnumerable<MissiveReadListResult>> GetMissiveReadListAsync(MissiveReadListRequest request)
|
|
|
{
|
|
|
- throw new NotImplementedException();
|
|
|
+ var query = new SqlKata.Query("tede_addressee");
|
|
|
+ query.Join("tede_user as b", "b.Id", "tede_addressee.UserId");
|
|
|
+ query.Where("tede_addressee.SourceId", request.MissiveId);
|
|
|
+ if (request.ReadType > 0)
|
|
|
+ query.Where("tede_addressee.IsRead", request.ReadType == 1);
|
|
|
+ //
|
|
|
+ var departmentNameQuery = new SqlKata.Query("tede_department");
|
|
|
+ var departmentIdsQuery = new SqlKata.Query("tede_department_user");
|
|
|
+ departmentIdsQuery.WhereColumns("tede_department_user.userId", "=", "tede_addressee.UserId");
|
|
|
+ departmentIdsQuery.Select("DepartmentId");
|
|
|
+ departmentNameQuery.WhereIn(nameof(Entity.Department.Id), departmentIdsQuery);
|
|
|
+ departmentNameQuery.Limit(1);
|
|
|
+ departmentNameQuery.Select("Name");
|
|
|
+ query.Select(departmentNameQuery, "DepartmentName");
|
|
|
+ query.Select("tede_addressee.{SourceId as MissiveId,LastModifiedDate,UserId}");
|
|
|
+ query.Select("b.{AvatarUrl,Name}");
|
|
|
+ var result = await _repository.GetAllAsync<MissiveReadListResult>(query);
|
|
|
+ foreach (var item in result)
|
|
|
+ item.AvatarUrl = StringUtils.AddDomainMin(item.AvatarUrl);
|
|
|
+ return result;
|
|
|
}
|
|
|
}
|
|
|
}
|