|
@@ -0,0 +1,70 @@
|
|
|
+using System;
|
|
|
+using System.Collections.Generic;
|
|
|
+using System.Linq;
|
|
|
+using System.Text;
|
|
|
+using System.Threading.Tasks;
|
|
|
+using ZhonTai.Admin.Core.Consts;
|
|
|
+using ZhonTai.Admin.Services.User;
|
|
|
+using ZhonTai.DynamicApi.Attributes;
|
|
|
+using ZhonTai.DynamicApi;
|
|
|
+using Microsoft.AspNetCore.Mvc;
|
|
|
+using ZhonTai.Admin.Core.Dto;
|
|
|
+using ZhonTai.Admin.Domain.Role;
|
|
|
+using ZhonTai.Admin.Domain.User;
|
|
|
+using ZhonTai.Admin.Services.User.Dto;
|
|
|
+using ZhonTai.Admin.Domain.UserRole;
|
|
|
+using ZhonTai.Admin.Domain.Project;
|
|
|
+using ZhonTai.Admin.Services.Project.Dto;
|
|
|
+
|
|
|
+namespace ZhonTai.Admin.Services.Project
|
|
|
+{
|
|
|
+ /// <summary>
|
|
|
+ /// 项目服务
|
|
|
+ /// </summary>
|
|
|
+ [Order(10)]
|
|
|
+ [DynamicApi(Area = AdminConsts.AreaName)]
|
|
|
+ public partial class ProjectService : BaseService, IProjectService, IDynamicApi
|
|
|
+ {
|
|
|
+ private IProjectRepository _projectRepository => LazyGetRequiredService<IProjectRepository>();
|
|
|
+ public ProjectService()
|
|
|
+ {
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 查询分页
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="input"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ public async Task<PageOutput<ProjectGetPageOutput>> GetPageAsync(PageInput<ProjectGetPageInput> input)
|
|
|
+ {
|
|
|
+ var list = await _projectRepository.Select
|
|
|
+ .Count(out var total)
|
|
|
+ .OrderByDescending(true, a => a.Id)
|
|
|
+ .Page(input.CurrentPage, input.PageSize)
|
|
|
+ .ToListAsync(a => new ProjectGetPageOutput { name = a.name });
|
|
|
+
|
|
|
+ //if (orgId.HasValue && orgId > 0)
|
|
|
+ //{
|
|
|
+ // var managerUserIds = await _userOrgRepository.Select
|
|
|
+ // .Where(a => a.OrgId == orgId && a.IsManager == true).ToListAsync(a => a.UserId);
|
|
|
+
|
|
|
+ // if (managerUserIds.Any())
|
|
|
+ // {
|
|
|
+ // var managerUsers = list.Where(a => managerUserIds.Contains(a.Id));
|
|
|
+ // foreach (var managerUser in managerUsers)
|
|
|
+ // {
|
|
|
+ // managerUser.IsManager = true;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ //}
|
|
|
+
|
|
|
+ var data = new PageOutput<ProjectGetPageOutput>()
|
|
|
+ {
|
|
|
+ List = Mapper.Map<List<ProjectGetPageOutput>>(list),
|
|
|
+ Total = total
|
|
|
+ };
|
|
|
+
|
|
|
+ return data;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|