Browse Source

添加岗位查看方法

wangh 2 years ago
parent
commit
1b3d9e0a6a

+ 43 - 5
OASystem/OASystem.Api/Controllers/SystemController.cs

@@ -1,15 +1,11 @@
 
 
-
-
-using OASystem.Infrastructure.Repositories.System;
-
 namespace OASystem.API.Controllers
 {
     /// <summary>
     /// 系统设置
     /// </summary>
-    [Authorize]
+    //[Authorize]
     [Route("api/[controller]/[action]")]
     public class SystemController : ControllerBase
     {
@@ -369,6 +365,48 @@ namespace OASystem.API.Controllers
         }
         #endregion
 
+        #region 岗位板块
+        /// <summary>
+        /// 岗位查询
+        /// </summary>
+        /// <param name="dto"></param>
+        /// <returns></returns>
+        [HttpPost]
+        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
+        public async Task<IActionResult> QueryJobPost(QueryJobPostDto dto)
+        {
+            try
+            {
+                if (dto.PortType == 1)
+                {
+                    return Ok(JsonView(false, "暂无数据!"));
+                }
+                else if (dto.PortType == 2)
+                {
+                    var result = _sysDepRep.QueryDto<Sys_JobPost, JobPostView>(s => s.CompanyId == dto.CompanyId && s.DepId==dto.DepId).ToList();
+                    if (result.Count == 0)
+                    {
+                        return Ok(JsonView(false, "暂无数据!"));
+                    }
+                    return Ok(JsonView(true, "查询成功!", result));
+                }
+                else if (dto.PortType == 3)
+                {
+                    return Ok(JsonView(false, "暂无数据!"));
+                }
+                else
+                {
+                    return Ok(JsonView(false, "暂无数据!"));
+                }
+            }
+            catch (Exception ex)
+            {
+                return Ok(JsonView(false, "程序错误!"));
+                throw;
+            }
+        }
+        #endregion
+
         #region 用户操作
         /// <summary>
         /// 查询用户数据

+ 4 - 0
OASystem/OASystem.Domain/AutoMappers/_baseMappingProfile.cs

@@ -28,6 +28,10 @@ namespace OASystem.Domain.AutoMappers
             CreateMap<EditDepartmentDto,Sys_Department>();
             #endregion
 
+            #region 岗位板块
+            CreateMap<Sys_JobPost, JobPostView>();
+            #endregion
+
             #region 用户板块
             CreateMap<UserDto, Sys_Users>();
             CreateMap<Sys_Users, UserInfo>();

+ 21 - 0
OASystem/OASystem.Domain/Dtos/System/JobPostDto.cs

@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OASystem.Domain.Dtos.System
+{
+    public class QueryJobPostDto : DtoBase
+    {
+        /// <summary>
+        /// 公司Id
+        /// </summary>
+
+        public int CompanyId { get; set; }
+        /// <summary>
+        /// 部门Id
+        /// </summary>
+        public int DepId { get; set; }
+    }
+}

+ 31 - 0
OASystem/OASystem.Domain/ViewModels/System/JobPostView.cs

@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OASystem.Domain.ViewModels.System
+{
+    /// <summary>
+    /// 下拉框/单名类视图类
+    /// </summary>
+    public class JobPostView
+    {
+        /// <summary>
+        /// 岗位Id
+        /// </summary>
+        public int Id{ get; set; }
+        /// <summary>
+        /// 岗位名称
+        /// </summary>
+        public string JobName { get; set; }
+        /// <summary>
+        /// 公司Id
+        /// </summary>
+        public int CompanyId { get; set; }
+        /// <summary>
+        /// 部门Id
+        /// </summary>
+        public int DepId { get; set; }
+    }
+}

+ 2 - 1
OASystem/OASystem.Infrastructure/Repositories/System/DepartmentRepository.cs

@@ -1,10 +1,11 @@
 using OASystem.Domain;
+using OASystem.Domain.Dtos.System;
 using OASystem.Domain.Entities.System;
 using OASystem.Domain.ViewModels.System;
 
 namespace OASystem.Infrastructure.Repositories.System
 {
-    public class DepartmentRepository : BaseRepository<Sys_Department, DepartmentIView>
+    public class DepartmentRepository : BaseRepository<Sys_Department, DepartmentDto>
     {
         public DepartmentRepository(SqlSugarClient sqlSugar) : base(sqlSugar)
         {

+ 17 - 0
OASystem/OASystem.Infrastructure/Repositories/System/JobPostRepository.cs

@@ -0,0 +1,17 @@
+using OASystem.Domain.Dtos.System;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace OASystem.Infrastructure.Repositories.System
+{
+    public class JobPostRepository : BaseRepository<Sys_JobPost, QueryJobPostDto>
+    {
+        public JobPostRepository(SqlSugarClient sqlSugar) : base(sqlSugar)
+        {
+
+        }
+    }
+}