Browse Source

Merge branch 'master' of zmq/99ditui into master

zmq 1 year ago
parent
commit
fcd2e4955e

+ 15 - 0
src/platform/ZhonTai.Admin/Domain/Project/IProjectRepository.cs

@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ZhonTai.Admin.Core.Repositories;
+using ZhonTai.Admin.Domain.User;
+
+namespace ZhonTai.Admin.Domain.Project
+{    
+    public interface IProjectRepository : IRepositoryBase<ProjectEntity>
+    {
+
+    }
+}

+ 14 - 0
src/platform/ZhonTai.Admin/Domain/Project/ProjectEntity.cs

@@ -0,0 +1,14 @@
+using FreeSql.DataAnnotations;
+using ZhonTai.Admin.Core.Entities;
+
+namespace ZhonTai.Admin.Domain.Project
+{
+    /// <summary>
+    /// 拉新项目
+    /// </summary>
+    [Table(Name = "ad_project")]
+    public class ProjectEntity : EntityTenant
+    {
+        public string name { get; set; }
+    }
+}

+ 19 - 0
src/platform/ZhonTai.Admin/Repositories/Project/ProjectRepository.cs

@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ZhonTai.Admin.Core.Db.Transaction;
+using ZhonTai.Admin.Domain.Project;
+using ZhonTai.Admin.Domain.User;
+
+namespace ZhonTai.Admin.Repositories.Project
+{    
+    public class ProjectRepository : AdminRepositoryBase<ProjectEntity>, IProjectRepository
+    {
+        public ProjectRepository(UnitOfWorkManagerCloud muowm) : base(muowm)
+        {
+
+        }
+    }
+}

+ 12 - 0
src/platform/ZhonTai.Admin/Services/Project/Dto/ProjectGetPageInput.cs

@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ZhonTai.Admin.Services.Project.Dto
+{
+    public class ProjectGetPageInput
+    {
+    }
+}

+ 13 - 0
src/platform/ZhonTai.Admin/Services/Project/Dto/ProjectGetPageOutput.cs

@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ZhonTai.Admin.Services.Project.Dto
+{
+    public class ProjectGetPageOutput
+    {
+        public string name { get; set; }
+    }
+}

+ 12 - 0
src/platform/ZhonTai.Admin/Services/Project/IProjectService.cs

@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ZhonTai.Admin.Services.Project
+{
+    public interface IProjectService
+    {
+    }
+}

+ 70 - 0
src/platform/ZhonTai.Admin/Services/Project/ProjectService.cs

@@ -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;
+        }
+    }
+}

+ 17 - 0
src/platform/ZhonTai.Admin/ZhonTai.Admin.xml

@@ -2868,6 +2868,11 @@
             权限列表
             </summary>
         </member>
+        <member name="T:ZhonTai.Admin.Domain.Project.ProjectEntity">
+            <summary>
+            拉新项目
+            </summary>
+        </member>
         <member name="T:ZhonTai.Admin.Domain.RoleOrgEntity">
             <summary>
             角色部门
@@ -6547,6 +6552,18 @@
             映射配置
             </summary>
         </member>
+        <member name="T:ZhonTai.Admin.Services.Project.ProjectService">
+            <summary>
+            项目服务
+            </summary>
+        </member>
+        <member name="M:ZhonTai.Admin.Services.Project.ProjectService.GetPageAsync(ZhonTai.Admin.Core.Dto.PageInput{ZhonTai.Admin.Services.Project.Dto.ProjectGetPageInput})">
+            <summary>
+            查询分页
+            </summary>
+            <param name="input"></param>
+            <returns></returns>
+        </member>
         <member name="T:ZhonTai.Admin.Services.Role.Dto.RoleAddInput">
             <summary>
             添加