ソースを参照

部分代码修改

yuanrf 7 ヶ月 前
コミット
8fc891577e

+ 24 - 0
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -345,6 +345,30 @@ namespace OASystem.API.Controllers
             return Ok(JsonView(groupData.Data));
         }
 
+        /// <summary>
+        /// 分页查询团组列表
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> QueryGroupListOffset(QueryGroupListOffsetDto dto)
+        {
+            var watch = new Stopwatch();
+            watch.Start();
+            RefAsync<int> total = 0;
+            var countyDatas = await _sqlSugar.Queryable<Grp_DelegationInfo>()
+                                             .Where((di) => di.IsDel == 0 && !string.IsNullOrWhiteSpace(di.TeamName))
+                                             .WhereIF(!string.IsNullOrEmpty(dto.Search), (di) => di.TeamName.Contains(dto.Search))
+                                             .OrderBy((di) => new { id = SqlFunc.Desc(di.Id) })
+                                             .Select((di) => new { id = di.Id, name = di.TeamName })
+                                             .Distinct()
+                                             .ToPageListAsync(dto.PageIndex, dto.PageSize, total);
+            watch.Stop();
+
+            return Ok(JsonView(true, $"{MsgTips.Succeed},耗时 {watch.ElapsedMilliseconds} ms", countyDatas, total));
+        }
+
         /// <summary>
         ///  接团信息列表 Page
         /// </summary>

+ 38 - 0
OASystem/OASystem.Api/Controllers/SystemController.cs

@@ -1,3 +1,4 @@
+using NPOI.SS.Formula.Functions;
 using System.Collections;
 using static OASystem.API.OAMethodLib.GeneralMethod;
 
@@ -1319,6 +1320,43 @@ namespace OASystem.API.Controllers
             return Ok(JsonView(false, "操作失败!"));
 
         }
+
+        [HttpPost]
+        public IActionResult QueryUserByDepart(QueryUserByDepartDto dto)
+        {
+            var jw = JsonView(false);
+            if (dto.DepartId < 1)
+            {
+                jw.Msg = "请传入正确的部门id";
+                return Ok(jw);
+            }
+
+            string sql = $@"SELECT  * FROM  Sys_Users su WHERE su.JobPostId  in (SELECT  id FROM  Sys_JobPost sj  WHERE  sj.IsDel  = 0 AND  sj.DepId  = {dto.DepartId} )
+                            AND  su.IsDel  = 0 ";
+
+            try
+            {
+                var result = _sqlSugar.SqlQueryable<Sys_Users>(sql).Select(x => new
+                {
+                    x.Id,
+                    x.CnName,
+                    x.EnName
+                }).ToList();
+
+                jw.Data = result;
+                jw.Code = 200;
+                jw.Msg = "获取成功!";
+            }
+            catch (Exception ex)
+            {
+                jw.Data = System.Array.Empty<string>();
+                jw.Code = 400;
+                jw.Msg = "获取失败!" + ex.Message;
+            }
+
+            return Ok(jw);
+        }
+
         #endregion
 
         #region 权限模块

+ 5 - 0
OASystem/OASystem.Domain/Dtos/Groups/GroupLinkInvitingDto.cs

@@ -11,6 +11,11 @@ namespace OASystem.Domain.Dtos.Groups
         public string Search { get; set; }
     }
 
+    public class QueryGroupListOffsetDto : DtoBase
+    {
+        public string Search { get; set; }
+    }
+
     public class GroupLinkInvitingUnitNameInitDto : DtoBase
     {
         public string Search { get; set; }

+ 5 - 0
OASystem/OASystem.Domain/Dtos/System/UserDto.cs

@@ -237,4 +237,9 @@ namespace OASystem.Domain.Dtos.System
         /// </summary>
         public int IsAudit { get; set; }
     }
+
+    public class QueryUserByDepartDto
+    {
+        public int DepartId { get; set; }
+    }
 }