|
@@ -1,5 +1,7 @@
|
|
|
|
|
|
|
|
|
+using System.ComponentModel.Design;
|
|
|
+
|
|
|
namespace OASystem.API.Controllers
|
|
|
{
|
|
|
/// <summary>
|
|
@@ -18,10 +20,11 @@ namespace OASystem.API.Controllers
|
|
|
private readonly SetDataRepository _setDataRepository;
|
|
|
private readonly SystemMenuPermissionRepository _SystemMenuPermissionRepository;
|
|
|
private readonly CompanyRepository _CompanyRepository;
|
|
|
+ private readonly JobPostRepository _jobRep;
|
|
|
|
|
|
public SystemController( CompanyRepository syscom,DepartmentRepository sysDepRep, UsersRepository userRep,
|
|
|
IMapper mapper, SetDataRepository setDataRepository, CompanyRepository companyRepository,
|
|
|
- SystemMenuPermissionRepository systemMenuPermissionRepository)
|
|
|
+ SystemMenuPermissionRepository systemMenuPermissionRepository, JobPostRepository jobRep)
|
|
|
{
|
|
|
_syscomRep = syscom;
|
|
|
_sysDepRep = sysDepRep;
|
|
@@ -30,37 +33,9 @@ namespace OASystem.API.Controllers
|
|
|
_setDataRepository = setDataRepository;
|
|
|
_CompanyRepository = companyRepository;
|
|
|
_SystemMenuPermissionRepository = systemMenuPermissionRepository;
|
|
|
+ _jobRep = jobRep;
|
|
|
}
|
|
|
|
|
|
- #region user 操作
|
|
|
- /// <summary>
|
|
|
- /// 查询所有员工(web)
|
|
|
- /// </summary>
|
|
|
- /// <param name="dto"></param>
|
|
|
- /// <returns></returns>
|
|
|
- [HttpPost]
|
|
|
- [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
- public async Task<IActionResult> GetUserList(DtoBase dto)
|
|
|
- {
|
|
|
- try
|
|
|
- {
|
|
|
- var result = _userRep.GetUserList(dto.PortType,string.Empty);
|
|
|
- if (result.Result.Code != 0)
|
|
|
- {
|
|
|
- return Ok(JsonView(false, "暂无数据!"));
|
|
|
-
|
|
|
- }
|
|
|
- return Ok(JsonView(true,"查询成功!",result.Result.Data));
|
|
|
- }
|
|
|
- catch (Exception)
|
|
|
- {
|
|
|
- return Ok(JsonView(false, "程序错误!"));
|
|
|
- throw;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- #endregion
|
|
|
-
|
|
|
#region 企业操作
|
|
|
/// <summary>
|
|
|
/// 查询企业数据
|
|
@@ -75,7 +50,13 @@ namespace OASystem.API.Controllers
|
|
|
{
|
|
|
if (dto.PortType == 1)
|
|
|
{
|
|
|
- return Ok(JsonView(false, "暂无数据!"));
|
|
|
+ var CompanyDataResult = _CompanyRepository.GetCompanyData();
|
|
|
+ if (CompanyDataResult.Code != 0)
|
|
|
+ {
|
|
|
+ return Ok(JsonView(CompanyDataResult.Msg));
|
|
|
+ }
|
|
|
+
|
|
|
+ return Ok(JsonView(true, "查询成功!", CompanyDataResult.Data));
|
|
|
}
|
|
|
else if (dto.PortType == 2)
|
|
|
{
|
|
@@ -219,7 +200,7 @@ namespace OASystem.API.Controllers
|
|
|
/// </summary>
|
|
|
/// <param name="dto"></param>
|
|
|
/// <returns></returns>
|
|
|
- //[Authorize]
|
|
|
+
|
|
|
[HttpPost]
|
|
|
[ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
public async Task<IActionResult> QueryDepartmentList(DepartmentDto dto)
|
|
@@ -314,7 +295,7 @@ namespace OASystem.API.Controllers
|
|
|
DepName=dto.DepName,
|
|
|
ParentDepId=dto.ParentDepId,
|
|
|
Remark=dto.Remark,
|
|
|
- });
|
|
|
+ });
|
|
|
if (!res)
|
|
|
{
|
|
|
return Ok(JsonView(false, "修改失败!"));
|
|
@@ -384,7 +365,7 @@ namespace OASystem.API.Controllers
|
|
|
}
|
|
|
else if (dto.PortType == 2)
|
|
|
{
|
|
|
- var result = _sysDepRep.QueryDto<Sys_JobPost, JobPostView>(s => s.CompanyId == dto.CompanyId && s.DepId==dto.DepId).ToList();
|
|
|
+ var result = _jobRep.QueryDto<Sys_JobPost, JobPostView>(s => s.CompanyId == dto.CompanyId && s.DepId==dto.DepId).ToList();
|
|
|
if (result.Count == 0)
|
|
|
{
|
|
|
return Ok(JsonView(false, "暂无数据!"));
|
|
@@ -406,9 +387,108 @@ namespace OASystem.API.Controllers
|
|
|
throw;
|
|
|
}
|
|
|
}
|
|
|
+ /// <summary>
|
|
|
+ /// 添加岗位
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
+ public async Task<IActionResult> AddJobPost(AddJobPostDto dto)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ Sys_JobPost sys_Job = _mapper.Map<Sys_JobPost>(dto);
|
|
|
+ int id = await _jobRep.AddAsyncReturnId(sys_Job);
|
|
|
+ if (id == 0)
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, "添加失败"));
|
|
|
+ }
|
|
|
+ return Ok(JsonView(true, "添加成功", new { Id = id }));
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, "程序错误!"));
|
|
|
+ throw;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /// <summary>
|
|
|
+ /// 修改岗位
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
+ public async Task<IActionResult> EditJobPost(EditJobPostDto dto)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ bool res = await _jobRep.UpdateAsync<Sys_JobPost>(a=>a.Id==dto.Id,a =>new Sys_JobPost
|
|
|
+ {
|
|
|
+ CompanyId=dto.CompanyId,
|
|
|
+ DepId=dto.DepId,
|
|
|
+ JobName=dto.JobName,
|
|
|
+ Remark=dto.Remark,
|
|
|
+ });
|
|
|
+ if (!res)
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, "修改失败"));
|
|
|
+ }
|
|
|
+ return Ok(JsonView(true, "修改成功"));
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, "程序错误!"));
|
|
|
+ throw;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public async Task<IActionResult> DelJobPost(DelJobPostDto dto)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ bool res = await _jobRep.SoftDeleteAsync<Sys_JobPost>(dto.Id.ToString());
|
|
|
+ if (!res)
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, "删除失败!"));
|
|
|
+ }
|
|
|
+ return Ok(JsonView(true, "删除成功"));
|
|
|
+ }
|
|
|
+ catch (Exception)
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, "程序错误!"));
|
|
|
+ throw;
|
|
|
+ }
|
|
|
+ }
|
|
|
#endregion
|
|
|
|
|
|
#region 用户操作
|
|
|
+ /// <summary>
|
|
|
+ /// 查询所有员工(web)
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
+ public async Task<IActionResult> GetUserList(DtoBase dto)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ var result = _userRep.GetUserList(dto.PortType, string.Empty);
|
|
|
+ if (result.Result.Code != 0)
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, "暂无数据!"));
|
|
|
+
|
|
|
+ }
|
|
|
+ return Ok(JsonView(true, "查询成功!", result.Result.Data));
|
|
|
+ }
|
|
|
+ catch (Exception)
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, "程序错误!"));
|
|
|
+ throw;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 查询用户数据
|
|
|
/// </summary>
|