|
@@ -2,6 +2,7 @@
|
|
|
using AutoMapper.Execution;
|
|
|
using Google.Protobuf.WellKnownTypes;
|
|
|
using Microsoft.AspNetCore.Mvc.Formatters;
|
|
|
+using Microsoft.AspNetCore.Mvc.ModelBinding;
|
|
|
using Newtonsoft.Json.Linq;
|
|
|
using OASystem.Domain.Dtos.System;
|
|
|
using Org.BouncyCastle.Asn1.Cms;
|
|
@@ -991,7 +992,12 @@ namespace OASystem.API.Controllers
|
|
|
{
|
|
|
//获取所有关联页面
|
|
|
var Sys_SystemMenuAndFunction = _SystemMenuAndFunctionRepository.QueryDto<Sys_SystemMenuAndFunction, SystemMenuAndFunctionView>().ToList();
|
|
|
-
|
|
|
+
|
|
|
+ var RemoveJobPostAuthList = _SystemMenuAndFunctionRepository._sqlSugar.SqlQueryable<Sys_JobPostAuthority>($@"
|
|
|
+ select a.* from Sys_JobPostAuthority a, Sys_SetData b ,Sys_SystemMenuPermission c
|
|
|
+ where a.SmId = c.Id and c.Mid = b.Id and JpId = {dto.Jpid} and c.Mid ={dto.modulId}
|
|
|
+ ").ToList();
|
|
|
+
|
|
|
List<Sys_JobPostAuthority> adds = new List<Sys_JobPostAuthority>();
|
|
|
foreach (var item in dto.Savejobs)
|
|
|
{
|
|
@@ -1015,7 +1021,7 @@ namespace OASystem.API.Controllers
|
|
|
_JobPostAuthorityRepository.BeginTran();
|
|
|
try
|
|
|
{ //删除岗位
|
|
|
- bool isdel = await _JobPostAuthorityRepository.DeleteAsync<Sys_JobPostAuthority>(x => x.JpId == dto.Jpid);
|
|
|
+ bool isdel = await _JobPostAuthorityRepository.DeletesAsync<Sys_JobPostAuthority>(RemoveJobPostAuthList);
|
|
|
int UpRows = _JobPostAuthorityRepository.Adds<Sys_JobPostAuthority>(adds);
|
|
|
|
|
|
//获取所有职位员工
|
|
@@ -1033,11 +1039,17 @@ namespace OASystem.API.Controllers
|
|
|
if (users != null && users.Count > 0)
|
|
|
{
|
|
|
List<Sys_UserAuthority> userAuth = null;
|
|
|
+ var uids = string.Join(',', users.Select(x => x.Id)).TrimEnd(',');
|
|
|
+ var RemoveUserAuthorityListAndTemp = _UserAuthorityRepository._sqlSugar.SqlQueryable<Sys_UserAuthority>($@"
|
|
|
+ select a.* from Sys_UserAuthority a, Sys_SetData b ,Sys_SystemMenuPermission c
|
|
|
+ where a.SmId = c.Id and c.Mid = b.Id and uid in ({uids}) and c.Mid =716 and IsTemp = 1
|
|
|
+ ").ToList();
|
|
|
+
|
|
|
foreach (var user in users)
|
|
|
{
|
|
|
//删除个人级岗位权限
|
|
|
- isdel = await _UserAuthorityRepository.DeleteAsync<Sys_UserAuthority>(x => x.IsTemp == 1 &&
|
|
|
- x.UId == user.Id);
|
|
|
+ isdel = await _UserAuthorityRepository.DeletesAsync<Sys_UserAuthority>
|
|
|
+ (RemoveUserAuthorityListAndTemp.FindAll(x=>x.UId == user.Id));
|
|
|
|
|
|
userAuth = adds.Select(x=> new Sys_UserAuthority
|
|
|
{
|
|
@@ -1131,6 +1143,11 @@ namespace OASystem.API.Controllers
|
|
|
{
|
|
|
//获取所有关联页面
|
|
|
var Sys_SystemMenuAndFunction = _SystemMenuAndFunctionRepository.QueryDto<Sys_SystemMenuAndFunction, SystemMenuAndFunctionView>().ToList();
|
|
|
+ //获取用户当前模块所有启用页面
|
|
|
+ var userpageList = _SystemMenuPermissionRepository._sqlSugar.SqlQueryable<Sys_UserAuthority>($@"
|
|
|
+ select a.* from Sys_UserAuthority a, Sys_SetData b ,Sys_SystemMenuPermission c
|
|
|
+ where a.SmId = c.Id and c.Mid = b.Id and uid = {dto.uid} and c.Mid ={dto.Modulid}
|
|
|
+ ").ToList();
|
|
|
|
|
|
List<Sys_UserAuthority> adds = new List<Sys_UserAuthority>();
|
|
|
foreach (var item in dto.Savejobs)
|
|
@@ -1158,7 +1175,7 @@ namespace OASystem.API.Controllers
|
|
|
{
|
|
|
List<Sys_UserAuthority> userAuth = null;
|
|
|
//删除个人级岗位权限
|
|
|
- bool isdel = await _UserAuthorityRepository.DeleteAsync<Sys_UserAuthority>(x=> x.UId == dto.uid);
|
|
|
+ bool isdel = await _UserAuthorityRepository.DeletesAsync<Sys_UserAuthority>(userpageList);
|
|
|
|
|
|
userAuth = adds.Select(x => new Sys_UserAuthority
|
|
|
{
|
|
@@ -1239,7 +1256,7 @@ namespace OASystem.API.Controllers
|
|
|
{
|
|
|
|
|
|
//删除页面绑定的操作后重新绑定
|
|
|
- istrue = await _SystemMenuAndFunctionRepository.DeleteAsync(x => x.SmId == dto.Pageid);
|
|
|
+ await _SystemMenuAndFunctionRepository.DeleteAsync(x => x.SmId == dto.Pageid);
|
|
|
|
|
|
List<Sys_SystemMenuAndFunction> binFun = new List<Sys_SystemMenuAndFunction>();
|
|
|
|
|
@@ -1365,7 +1382,12 @@ namespace OASystem.API.Controllers
|
|
|
}
|
|
|
return Ok(JsonView(view));
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 获取页面绑定的操作
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="Dto"></param>
|
|
|
+ /// <returns></returns>
|
|
|
[HttpPost]
|
|
|
[ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
public async Task<IActionResult> QueryPageFunById(PageFunDto Dto)
|
|
@@ -1400,6 +1422,51 @@ namespace OASystem.API.Controllers
|
|
|
return Ok(JsonView(arr));
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 菜单加载
|
|
|
+ /// </summary>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost]
|
|
|
+ [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
+ public async Task<IActionResult> MenuLoad(MenuLoadDto dto)
|
|
|
+ {
|
|
|
+ var QueryResult = _SystemMenuPermissionRepository.QueryMenuLoad(dto.Userid);
|
|
|
+ JsonView ViewData = new JsonView();
|
|
|
+ ArrayList arr = new ArrayList();
|
|
|
+
|
|
|
+ if (QueryResult.Code == 0)
|
|
|
+ {
|
|
|
+ var menuGroup = (QueryResult.Data as List<MenuLoadView>).GroupBy(x=>x.modulid);
|
|
|
+ foreach (var item in menuGroup)
|
|
|
+ {
|
|
|
+ var modul = item.FirstOrDefault();
|
|
|
+ if (modul != null)
|
|
|
+ {
|
|
|
+ arr.Add(new
|
|
|
+ {
|
|
|
+ modulName = modul.modulName,
|
|
|
+ modulid = modul.modulid,
|
|
|
+ pageList = item
|
|
|
+ }) ;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ ViewData.Code = 200;
|
|
|
+ ViewData.Msg = QueryResult.Msg;
|
|
|
+ ViewData.Data = arr;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ViewData.Code = 400;
|
|
|
+ ViewData.Msg = QueryResult.Msg;
|
|
|
+ ViewData.Data = null;
|
|
|
+ }
|
|
|
+
|
|
|
+ return Ok(ViewData);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
#endregion
|
|
|
|
|
|
#region 页面操作
|
|
@@ -1474,6 +1541,7 @@ namespace OASystem.API.Controllers
|
|
|
return Ok(JsonView(false, "程序错误!"));
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
#endregion
|
|
|
}
|
|
|
}
|