Przeglądaj źródła

重构团组前期信息相关方法和类

在 `GroupsController.cs` 中重命名 `GroupOrderPreInfo` 方法为 `GroupOrderPreInfoList`,并添加重载方法以接受 `userId` 参数。更新 `DataInit` 方法以根据 `userId` 过滤数据。

在 `OrderPreInfoView.cs` 中新增 `GroupOrderPreInfoListView` 类,包含多个属性以表示团组前期信息列表,同时定义 `GrpOrderPreInfoView` 类。

在 `GroupOrderPreInfoRepository.cs` 中修改 `DataInit` 方法,实现根据 `userId` 过滤 `Grp_OrderPreInfo` 数据,确保返回特定用户相关的信息。
LEIYI 2 miesięcy temu
rodzic
commit
62bab25d08

+ 15 - 4
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -396,15 +396,27 @@ namespace OASystem.API.Controllers
 
         #region 团组前期信息
 
+
         /// <summary>
         ///  团组前期信息 Init
         /// </summary>
         /// <returns></returns>
-        [HttpGet]
+        [HttpGet("{userId}")]
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
-        public async Task<IActionResult> GroupOrderPreInfo()
+        public async Task<IActionResult> GroupOrderPreInfoList(int userId)
         {
-            return Ok(await _grpOrderPreInfoRep.DataInit());
+            return Ok(await _grpOrderPreInfoRep.DataInit(userId));
+        }
+
+        /// <summary>
+        ///  团组前期信息 Init
+        /// </summary>
+        /// <returns></returns>
+        [HttpGet("{userId}")]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> GroupOrderPreInfo(int userId)
+        {
+            return Ok(await _grpOrderPreInfoRep.DataInit(userId));
         }
 
         /// <summary>
@@ -427,7 +439,6 @@ namespace OASystem.API.Controllers
         [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
         public async Task<IActionResult> CityByCountry(string countryLabel)
         {
-
             countryLabel=HttpUtility.UrlDecode(countryLabel);
             var countryList = countryLabel.Split(',', StringSplitOptions.RemoveEmptyEntries).ToArray();
             var citys = Array.Empty<string?>();

+ 16 - 0
OASystem/OASystem.Domain/ViewModels/Groups/OrderPreInfoView.cs

@@ -17,6 +17,22 @@ namespace OASystem.Domain.ViewModels.Groups
     {
     }
 
+
+    public class GroupOrderPreInfoListView
+    {
+        public int Id { get; set; }
+
+        public string Name { get; set; }
+
+        public string UnitName { get; set; }
+
+        public int VisitDays { get; set; }
+
+        public int VisiPpNum { get; set; }
+
+        public string MyProperty { get; set; }
+    }
+
     public class GrpOrderPreInfoView
     {
         public int Id { get; set; }

+ 3 - 3
OASystem/OASystem.Infrastructure/Repositories/Groups/GroupOrderPreInfoRepository.cs

@@ -29,17 +29,17 @@ namespace OASystem.Infrastructure.Repositories.Groups
         }
 
         /// <summary>
-        /// 获取模板信息
+        /// 获取基础信息
         /// </summary>
         /// <param name="tempId"></param>
         /// <returns></returns>
-        public async Task<JsonView> DataInit()
+        public async Task<JsonView> DataInit(int userId)
         {
             var jw = new JsonView() { Code = StatusCodes.Status200OK, Msg = "操作成功!" };
 
             var groupNames = await _groupInfoRep.GetGroupNameList(new Domain.Dtos.Groups.GroupNameDto() { PortType = 1 });
             var tempDatas = await _sqlSugar.Queryable<Sys_SetData>().Where(x => x.IsDel == 0 && x.STid == 109).Select(x => new { x.Id, x.Name }).ToListAsync();
-            var names = await _sqlSugar.Queryable<Grp_OrderPreInfo>().Where(x => x.IsDel == 0).OrderByDescending(x => x.Id).Select(x => new { x.Id, x.Name }).ToListAsync();
+            var names = await _sqlSugar.Queryable<Grp_OrderPreInfo>().Where(x => x.IsDel == 0 && x.CreateUserId == userId).OrderByDescending(x => x.Id).Select(x => new { x.Id, x.Name }).ToListAsync();
             jw.Data = new
             {
                 groupNames = groupNames,