소스 검색

定义企业专员接口

xfe 2 달 전
부모
커밋
f8d76e6df3

+ 97 - 0
src/Hotline.Api/Controllers/EnterprisesController.cs

@@ -0,0 +1,97 @@
+using Hotline.Api.Filter;
+using Hotline.Enterprise;
+using Hotline.Share.Dtos.Enterprise;
+using Hotline.Share.Dtos.Order;
+using Hotline.Share.Requests;
+using Microsoft.AspNetCore.Mvc;
+using XF.Domain.Repository;
+
+namespace Hotline.Api.Controllers
+{
+    public class EnterprisesController : BaseController
+    {
+        private readonly IEnterpriseService _enterpriseService;
+        private readonly IRepository<EnterpriseSpecialist> _enterpriseSpecialistRepository;
+
+        public EnterprisesController(
+            IEnterpriseService enterpriseService,
+            IRepository<EnterpriseSpecialist> enterpriseSpecialistRepository)
+        {
+            _enterpriseService = enterpriseService;
+            _enterpriseSpecialistRepository = enterpriseSpecialistRepository;
+        }
+        
+        #region (宜宾)获取企业信息
+
+        /// <summary>
+        /// 获取企业信息(宜宾)
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        [HttpGet("enterprise/list")]
+        [LogFilter("查询企业列表")]
+        public async Task<YbEnterprisePaged> QueryYbEnterprises([FromQuery] PagedKeywordRequest dto)
+        {
+            return await _enterpriseService.QueryYbEnterprisesAsync(dto.Keyword!, dto.PageIndex, dto.PageSize, HttpContext.RequestAborted);
+        }
+
+        #endregion
+
+        #region 泸州
+
+        /// <summary>
+        /// 批量新增企业专员
+        /// </summary>
+        /// <returns></returns>
+        [HttpPost("specialist-batch")]
+        public Task<EnterpriseSpecialist> AddSpecialists()
+        {
+            throw new NotImplementedException();
+        }
+
+        /// <summary>
+        /// 批量删除企业专员
+        /// </summary>
+        [HttpDelete("specialist-batch/{id}")]
+        public Task RemoveSpecialists(string id)
+        {
+            //清除子元素
+            //then delete
+            throw new NotImplementedException();
+        }
+
+        /// <summary>
+        /// 查询企业专员
+        /// </summary>
+        /// <returns></returns>
+        [HttpGet("specialists-tree")]
+        public Task<List<EnterpriseSpecialist>> QuerySpecialists()
+        {
+            return _enterpriseSpecialistRepository.Queryable()
+                .OrderBy(d=>d.Id)
+                .ToTreeAsync(d=>d.Children, it => it.ParentId, null);
+        }
+
+        /// <summary>
+        /// 查询企业专员工单
+        /// </summary>
+        [HttpGet("specialist/orders")]
+        public Task<IReadOnlyList<OrderDto>> QueryEnterpriseSpecialistOrders([FromQuery] QueryOrderDto dto)
+        {
+            throw new NotImplementedException();
+        }
+
+        /// <summary>
+        /// 查询总数
+        /// </summary>
+        [HttpGet("specialist/orders/count")]
+        public Task<int> CountEnterpriseSpecialistOrders([FromQuery] QueryOrderDto dto)
+        {
+            throw new NotImplementedException();
+        }
+
+        //todo export
+        
+        #endregion
+    }
+}

+ 0 - 33
src/Hotline.Api/Controllers/YiBin/EnterprisesController.cs

@@ -1,33 +0,0 @@
-using Hotline.Api.Filter;
-using Hotline.Enterprise;
-using Hotline.Share.Dtos.Enterprise;
-using Hotline.Share.Requests;
-using Microsoft.AspNetCore.Mvc;
-
-namespace Hotline.Api.Controllers.YiBin
-{
-    public class EnterprisesController : BaseController
-    {
-        private readonly IEnterpriseService _enterpriseService;
-
-        public EnterprisesController(IEnterpriseService enterpriseService)
-        {
-            _enterpriseService = enterpriseService;
-        }
-        #region 获取企业信息
-
-        /// <summary>
-        /// 获取企业信息
-        /// </summary>
-        /// <param name="dto"></param>
-        /// <returns></returns>
-        [HttpGet("enterprise/list")]
-        [LogFilter("查询企业列表")]
-        public async Task<YbEnterprisePaged> QueryYbEnterprises([FromQuery] PagedKeywordRequest dto)
-        {
-            return await _enterpriseService.QueryYbEnterprisesAsync(dto.Keyword!, dto.PageIndex, dto.PageSize, HttpContext.RequestAborted);
-        }
-
-        #endregion
-    }
-}

+ 15 - 0
src/Hotline/Enterprise/EnterpriseSpecialist.cs

@@ -0,0 +1,15 @@
+using SqlSugar;
+using XF.Domain.Repository;
+
+namespace Hotline.Enterprise;
+
+/// <summary>
+/// 企业专员(泸州需求)
+/// </summary>
+public class EnterpriseSpecialist : Entity
+{
+    public string? ParentId { get; set; }
+
+    [SugarColumn(IsIgnore = true , ColumnDescription = "组员")]
+    public List<EnterpriseSpecialist> Children { get; set; }
+}