Browse Source

新增 UserInfoView

leiy 2 years ago
parent
commit
097ea5d44c

+ 3 - 4
OASystem/OASystem.Api/Controllers/SystemController.cs

@@ -2,7 +2,6 @@
 using MySqlX.XDevAPI.Common;
 using OASystem.Domain.Dtos;
 using OASystem.Domain.Entities.System;
-using OASystem.Domain.ResponseEntities.System;
 using OASystem.Domain.ViewModels.System;
 using OASystem.Infrastructure.Repositories.Login;
 using OASystem.Infrastructure.Repositories.System;
@@ -15,11 +14,11 @@ namespace OASystem.API.Controllers
     [Route("api/[controller]/[action]")]
     public class SystemController : ControllerBase
     {
-        private readonly Sys_DepartmentRepository _sysDepRep;
+        private readonly DepartmentRepository _sysDepRep;
         private readonly UsersRepository _userRep;
         private readonly IMapper _mapper;
 
-        public SystemController(Sys_DepartmentRepository sysDepRep, IMapper mapper, UsersRepository userRep)
+        public SystemController(DepartmentRepository sysDepRep, IMapper mapper, UsersRepository userRep)
         {
             _sysDepRep = sysDepRep;
             _userRep = userRep;
@@ -50,7 +49,7 @@ namespace OASystem.API.Controllers
         public async Task<IActionResult> fnQueryDepartment(Sys_DepartmentDto dto)
         {
             _sysDepRep.BeginTran();
-            var result = _sysDepRep.QueryDto<Sys_Department,Sys_DepartmentView>(s => s.CompanyId == dto.CompanyId).ToList();
+            var result = _sysDepRep.QueryDto<Sys_Department,DepartmentView>(s => s.CompanyId == dto.CompanyId).ToList();
             foreach (var item in result)
             {
                 item.a = "123";

+ 26 - 0
OASystem/OASystem.Domain/ViewModels/System/DepartmentView.cs

@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OASystem.Domain.ViewModels.System
+{
+    public class DepartmentView
+    {
+        /// <summary>
+        /// 
+        /// </summary>
+        public int Id { get; set; }
+        
+        /// <summary>
+        /// 
+        /// </summary>
+        public string? DepName { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string? a { get; set; }
+    }
+}

+ 0 - 16
OASystem/OASystem.Domain/ViewModels/System/Sys_DepartmentView.cs

@@ -1,16 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace OASystem.Domain.ViewModels.System
-{
-    public class Sys_DepartmentView
-    {
-        public int Id { get; set; }
-        public string DepName { get; set; }
-
-        public string a { get; set; }
-    }
-}

+ 2 - 3
OASystem/OASystem.Domain/ResponseEntities/System/UserInfo.cs

@@ -5,13 +5,13 @@ using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
 
-namespace OASystem.Domain.ResponseEntities.System
+namespace OASystem.Domain.ViewModels.System
 {
     /// <summary>
     /// 用户表
     /// 数据库查询接受实体类
     /// </summary>
-    public class UserInfo: Sys_Users
+    public class UserInfoView :Sys_Users
     {
         /// <summary>
         /// 公司名称
@@ -27,6 +27,5 @@ namespace OASystem.Domain.ResponseEntities.System
         /// 岗位名称
         /// </summary>
         public string? JobName { get; set; }
-
     }
 }

+ 2 - 2
OASystem/OASystem.Infrastructure/Repositories/System/Sys_DepartmentRepository.cs

@@ -9,9 +9,9 @@ using System.Threading.Tasks;
 
 namespace OASystem.Infrastructure.Repositories.System
 {
-    public class Sys_DepartmentRepository : BaseRepository<Sys_Department, Sys_DepartmentView>
+    public class DepartmentRepository : BaseRepository<Sys_Department, DepartmentView>
     {
-        public Sys_DepartmentRepository(SqlSugarClient sqlSugar) : base(sqlSugar)
+        public DepartmentRepository(SqlSugarClient sqlSugar) : base(sqlSugar)
         {
         }
     }

+ 5 - 6
OASystem/OASystem.Infrastructure/Repositories/System/UsersRepository.cs

@@ -1,7 +1,6 @@
 using OASystem.Domain;
-using OASystem.Domain.Dtos.UserDto;
-using OASystem.Domain.Entities.System;
-using OASystem.Domain.ResponseEntities.System;
+
+using OASystem.Domain.ViewModels.System;
 using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -10,7 +9,7 @@ using System.Threading.Tasks;
 
 namespace OASystem.Infrastructure.Repositories.System
 {
-    public class UsersRepository : BaseRepository<UserInfo, JsonView>
+    public class UsersRepository : BaseRepository<UserInfoView, JsonView>
     {
         public UsersRepository(SqlSugarClient sqlSugar) : base(sqlSugar)
         {
@@ -28,7 +27,7 @@ namespace OASystem.Infrastructure.Repositories.System
                                                   Inner Join Sys_Company sc On su.CompanyId = sc.Id
                                                   Inner Join Sys_Department sd On su.DepId = sd.Id
                                                   Inner Join Sys_JobPost sjp On su.JobPostId = sjp.Id ");
-            List<UserInfo> _userList = await _userRep.GetListBySqlWithNolockAsync(userSqlWhere);
+            List<UserInfoView> _userList = await _userRep.GetListBySqlWithNolockAsync(userSqlWhere);
             if (_userList.Count < 1)
             {
                 result.Code = -2;
@@ -38,7 +37,7 @@ namespace OASystem.Infrastructure.Repositories.System
             }
 
             List<dynamic> reultUserList = new List<dynamic>();
-            foreach (UserInfo user in _userList)
+            foreach (UserInfoView user in _userList)
             {
                 var data = new
                 {