|
@@ -1,6 +1,7 @@
|
|
|
|
|
|
|
|
|
using OASystem.Infrastructure.Repositories.System;
|
|
|
+using System.Collections;
|
|
|
|
|
|
namespace OASystem.API.Controllers
|
|
|
{
|
|
@@ -20,10 +21,14 @@ namespace OASystem.API.Controllers
|
|
|
private readonly SetDataRepository _setDataRepository;
|
|
|
private readonly SystemMenuPermissionRepository _SystemMenuPermissionRepository;
|
|
|
private readonly CompanyRepository _CompanyRepository;
|
|
|
+ private readonly PageFunctionPermissionRepository _PageFunctionPermissionRepository;
|
|
|
+ private readonly SystemMenuAndFunctionRepository _SystemMenuAndFunctionRepository;
|
|
|
+ private readonly JobPostAuthorityRepository _JobPostAuthorityRepository;
|
|
|
|
|
|
- public SystemController( CompanyRepository syscom,DepartmentRepository sysDepRep, UsersRepository userRep,
|
|
|
+ public SystemController( CompanyRepository syscom, DepartmentRepository sysDepRep, UsersRepository userRep,
|
|
|
IMapper mapper, SetDataRepository setDataRepository, CompanyRepository companyRepository,
|
|
|
- SystemMenuPermissionRepository systemMenuPermissionRepository)
|
|
|
+ SystemMenuPermissionRepository systemMenuPermissionRepository, PageFunctionPermissionRepository pageFunctionPermissionRepository,
|
|
|
+ SystemMenuAndFunctionRepository systemMenuAndFunctionRepository, JobPostAuthorityRepository jobPostAuthorityRepository)
|
|
|
{
|
|
|
_syscomRep = syscom;
|
|
|
_sysDepRep = sysDepRep;
|
|
@@ -32,6 +37,9 @@ namespace OASystem.API.Controllers
|
|
|
_setDataRepository = setDataRepository;
|
|
|
_CompanyRepository = companyRepository;
|
|
|
_SystemMenuPermissionRepository = systemMenuPermissionRepository;
|
|
|
+ _PageFunctionPermissionRepository = pageFunctionPermissionRepository;
|
|
|
+ _SystemMenuAndFunctionRepository = systemMenuAndFunctionRepository;
|
|
|
+ _JobPostAuthorityRepository = jobPostAuthorityRepository;
|
|
|
}
|
|
|
|
|
|
#region user 操作
|
|
@@ -230,7 +238,12 @@ namespace OASystem.API.Controllers
|
|
|
{
|
|
|
if (dto.PortType==1)
|
|
|
{
|
|
|
- return Ok(JsonView(false, "暂无数据!"));
|
|
|
+ var result = _sysDepRep.QueryDto<Sys_Department, DepartmentIView>(s => s.CompanyId == dto.CompanyId).ToList();
|
|
|
+ if (result.Count == 0)
|
|
|
+ {
|
|
|
+ return Ok(JsonView(false, "暂无数据!"));
|
|
|
+ }
|
|
|
+ return Ok(JsonView(true, "查询成功!", result));
|
|
|
}
|
|
|
else if (dto.PortType==2)
|
|
|
{
|
|
@@ -382,7 +395,12 @@ namespace OASystem.API.Controllers
|
|
|
{
|
|
|
if (dto.PortType == 1)
|
|
|
{
|
|
|
- return Ok(JsonView(false, "暂无数据!"));
|
|
|
+ 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 == 2)
|
|
|
{
|
|
@@ -480,18 +498,41 @@ namespace OASystem.API.Controllers
|
|
|
return Ok(JsonView(setDataResult.Msg));
|
|
|
}
|
|
|
|
|
|
- List<SetDataView> setDataList = _mapper.Map<List<SetDataView>>(setDataResult.Data);
|
|
|
- var mod = setDataList.Find(x => x.Name == "权限模块");
|
|
|
- if (mod == null)
|
|
|
+ //操作方式
|
|
|
+ var PageOperation = _PageFunctionPermissionRepository.QueryDto<Sys_PageFunctionPermission, Sys_PageFunctionPermission>().ToList();
|
|
|
+
|
|
|
+ //获取所有关联页面
|
|
|
+ var Sys_SystemMenuAndFunction = _SystemMenuAndFunctionRepository.QueryDto<Sys_SystemMenuAndFunction, SystemMenuAndFunctionView>().ToList();
|
|
|
+
|
|
|
+
|
|
|
+ //页面数据
|
|
|
+ var SystemMenuPermissionData = _SystemMenuPermissionRepository.QueryDto<Sys_SystemMenuPermission, SystemMenuPermissionView>(x=>x.Mid == dto.moduleId).ToList();
|
|
|
+ if (SystemMenuPermissionData == null || SystemMenuPermissionData.Count() == 0)
|
|
|
{
|
|
|
- return Ok(JsonView("未找到权限模块!"));
|
|
|
+ return Ok(JsonView("暂无数据"));
|
|
|
}
|
|
|
|
|
|
- //页面数据
|
|
|
- var SystemMenuPermissionData = _SystemMenuPermissionRepository.GetSystemMenuViweData(_SystemMenuPermissionRepository, mod.Id, dto.pageSize, dto.currentPage);
|
|
|
- if (SystemMenuPermissionData.Code != 0)
|
|
|
+ ArrayList viewData = new ArrayList();
|
|
|
+ //组合页面数据
|
|
|
+ foreach (var item in SystemMenuPermissionData)
|
|
|
{
|
|
|
- return Ok(JsonView(SystemMenuPermissionData.Msg));
|
|
|
+ ArrayList ids = new ArrayList();
|
|
|
+ foreach (var viewop in PageOperation)
|
|
|
+ {
|
|
|
+ var op = Sys_SystemMenuAndFunction.FirstOrDefault(x => x.SmId == item.Id && x.FId == viewop.Id);
|
|
|
+ if (op != null)
|
|
|
+ {
|
|
|
+ ids.Add(viewop.Id);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ viewData.Add(new
|
|
|
+ {
|
|
|
+ Id = item.Id,
|
|
|
+ Mid = item.Mid,
|
|
|
+ Name = item.Name,
|
|
|
+ SystemMenuCode = item.SystemMenuCode,
|
|
|
+ opList = ids
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
//公司数据
|
|
@@ -507,12 +548,21 @@ namespace OASystem.API.Controllers
|
|
|
{
|
|
|
setDataResult = setDataResult.Data,
|
|
|
CompanyDataResult = CompanyDataResult.Data,
|
|
|
- SystemMenuPermissionData = SystemMenuPermissionData.Data
|
|
|
+ SystemMenuPermissionData = viewData,
|
|
|
+ PageOperation = PageOperation,
|
|
|
};
|
|
|
|
|
|
return Ok(JsonView(200, "成功!", Dyresult));
|
|
|
}
|
|
|
|
|
|
+ [HttpPost]
|
|
|
+ [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
+ public IActionResult QueryJobAuto(int jobid)
|
|
|
+ {
|
|
|
+ var DBdata = _JobPostAuthorityRepository.QueryDto<Sys_JobPostAuthority, JobPostAuthorityView>(x=>x.JpId == jobid).ToList();
|
|
|
+ return Ok(JsonView(200, "成功!", DBdata));
|
|
|
+ }
|
|
|
+
|
|
|
#endregion
|
|
|
}
|
|
|
}
|