|
@@ -12,6 +12,7 @@ using GxPress.Request.Department;
|
|
|
using GxPress.Result.Department;
|
|
|
using Microsoft.Extensions.Options;
|
|
|
using Datory;
|
|
|
+using GxPress.Result.User;
|
|
|
|
|
|
namespace GxPress.Repository.Implement
|
|
|
{
|
|
@@ -104,9 +105,9 @@ namespace GxPress.Repository.Implement
|
|
|
return await _repository.UpdateAsync(department);
|
|
|
}
|
|
|
|
|
|
- public async Task<IEnumerable<Department>> GetListAsync(int parentId)
|
|
|
+ public async Task<IEnumerable<DepartmentResult>> GetListAsync(int parentId)
|
|
|
{
|
|
|
- return await _repository.GetAllAsync(Q.Where(nameof(Department.ParentId), parentId)
|
|
|
+ return await _repository.GetAllAsync<DepartmentResult>(Q.Where(nameof(Department.ParentId), parentId)
|
|
|
.OrderBy(nameof(Department.Sort)));
|
|
|
}
|
|
|
|
|
@@ -115,9 +116,9 @@ namespace GxPress.Repository.Implement
|
|
|
/// </summary>
|
|
|
/// <param name="request"></param>
|
|
|
/// <returns></returns>
|
|
|
- public async Task<IEnumerable<Department>> GetListAsync(DepartmentUserRequest request)
|
|
|
+ public async Task<IEnumerable<DepartmentResult>> GetListAsync(DepartmentUserRequest request)
|
|
|
{
|
|
|
- return await _repository.GetAllAsync(Q.Where(nameof(Department.ParentId), request.DepartmentId)
|
|
|
+ return await _repository.GetAllAsync<DepartmentResult>(Q.Where(nameof(Department.ParentId), request.DepartmentId)
|
|
|
.WhereNot(nameof(Department.Id), request.SourceDepartmentId));
|
|
|
}
|
|
|
|
|
@@ -221,8 +222,13 @@ namespace GxPress.Repository.Implement
|
|
|
result.Departments = departments;
|
|
|
//获取用户ID
|
|
|
var departmentUsers = await departmentUserRepository.GetAllAsync<int>(Q.Where(nameof(Entity.DepartmentUser.DepartmentId), request.DepartmentId).Select(nameof(Entity.DepartmentUser.UserId)));
|
|
|
- var users = await _userRepository.GetAllAsync(Q.WhereIn(nameof(User.Id), departmentUsers));
|
|
|
+ var users = await _userRepository.GetAllAsync<UserInfoResult>(Q.WhereIn(nameof(User.Id), departmentUsers));
|
|
|
result.Users = users.ToList();
|
|
|
+ foreach (var item in result.Users)
|
|
|
+ {
|
|
|
+ item.TypeId = 0;
|
|
|
+ item.TypeValue = 0;
|
|
|
+ }
|
|
|
for (int i = 0; i < result.Users.Count(); i++)
|
|
|
{
|
|
|
if (!request.IsShow)
|
|
@@ -243,13 +249,13 @@ namespace GxPress.Repository.Implement
|
|
|
/// <param name="id"></param>
|
|
|
/// <param name="departments"></param>
|
|
|
/// <returns></returns>
|
|
|
- public async Task<List<Department>> GetDepartmentById(int id, List<Department> departments)
|
|
|
+ public async Task<List<DepartmentResult>> GetDepartmentById(int id, List<DepartmentResult> departments)
|
|
|
{
|
|
|
- var department = await _repository.GetAsync(id);
|
|
|
+ var department = await _repository.GetAsync<DepartmentResult>(Q.Where(nameof(Entity.Department.Id), id));
|
|
|
if (department != null)
|
|
|
{
|
|
|
departments.Add(department);
|
|
|
- var list = await _repository.GetAllAsync(Q.Where(nameof(Entity.Department.ParentId), department.Id));
|
|
|
+ var list = await _repository.GetAllAsync<DepartmentResult>(Q.Where(nameof(Entity.Department.ParentId), department.Id));
|
|
|
foreach (var item in list)
|
|
|
{
|
|
|
departments.Add(item);
|