|
@@ -1,8 +1,12 @@
|
|
|
|
|
|
+using AutoMapper.Execution;
|
|
|
+using Google.Protobuf.WellKnownTypes;
|
|
|
using Microsoft.AspNetCore.Mvc.Formatters;
|
|
|
+using Newtonsoft.Json.Linq;
|
|
|
using OASystem.Domain.Dtos.System;
|
|
|
using Org.BouncyCastle.Asn1.Cms;
|
|
|
using System.Collections;
|
|
|
+using System.Xml.Linq;
|
|
|
using static OpenAI.GPT3.ObjectModels.SharedModels.IOpenAiModels;
|
|
|
|
|
|
namespace OASystem.API.Controllers
|
|
@@ -1212,6 +1216,8 @@ namespace OASystem.API.Controllers
|
|
|
public async Task<IActionResult> EditPageInfo(SetDataAndPageInfoView dto)
|
|
|
{
|
|
|
JsonView view = null;
|
|
|
+ _SystemMenuPermissionRepository.BeginTran();
|
|
|
+
|
|
|
var istrue = await _SystemMenuPermissionRepository.UpdateAsync(x=>x.Id == dto.Pageid ,x=> new Sys_SystemMenuPermission
|
|
|
{
|
|
|
AndroidUrl = dto.AndroidUrl,
|
|
@@ -1231,10 +1237,31 @@ namespace OASystem.API.Controllers
|
|
|
|
|
|
if (istrue)
|
|
|
{
|
|
|
+
|
|
|
+ //删除页面绑定的操作后重新绑定
|
|
|
+ istrue = await _SystemMenuAndFunctionRepository.DeleteAsync(x => x.SmId == dto.Pageid);
|
|
|
+
|
|
|
+ List<Sys_SystemMenuAndFunction> binFun = new List<Sys_SystemMenuAndFunction>();
|
|
|
+
|
|
|
+ foreach (var item in dto.FunArr)
|
|
|
+ {
|
|
|
+ binFun.Add(new Sys_SystemMenuAndFunction
|
|
|
+ {
|
|
|
+ CreateTime = DateTime.Now,
|
|
|
+ CreateUserId = 235,
|
|
|
+ FId = item,
|
|
|
+ SmId = dto.Pageid,
|
|
|
+ IsDel = 0,
|
|
|
+ });
|
|
|
+ }
|
|
|
+ int number = _SystemMenuAndFunctionRepository.Adds<Sys_SystemMenuAndFunction>(binFun);
|
|
|
+
|
|
|
view = JsonView(istrue);
|
|
|
+ _SystemMenuPermissionRepository.CommitTran();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
+ _SystemMenuPermissionRepository.RollbackTran();
|
|
|
view = JsonView("添加失败");
|
|
|
}
|
|
|
return Ok(view);
|
|
@@ -1251,7 +1278,10 @@ namespace OASystem.API.Controllers
|
|
|
public async Task<IActionResult> AddPageInfo(SetDataAndPageInfoView dto)
|
|
|
{
|
|
|
JsonView view = null;
|
|
|
- int number = await _SystemMenuPermissionRepository.AddAsync(new Sys_SystemMenuPermission
|
|
|
+
|
|
|
+ _SystemMenuPermissionRepository.BeginTran();
|
|
|
+
|
|
|
+ int number = await _SystemMenuPermissionRepository.AddAsyncReturnId(new Sys_SystemMenuPermission
|
|
|
{
|
|
|
AndroidUrl = dto.AndroidUrl,
|
|
|
CreateTime = DateTime.Now,
|
|
@@ -1268,14 +1298,33 @@ namespace OASystem.API.Controllers
|
|
|
WebUrl = dto.WebUrl,
|
|
|
});
|
|
|
|
|
|
+ List<Sys_SystemMenuAndFunction> binFun = new List<Sys_SystemMenuAndFunction>();
|
|
|
+
|
|
|
+ foreach (var item in dto.FunArr)
|
|
|
+ {
|
|
|
+ binFun.Add(new Sys_SystemMenuAndFunction
|
|
|
+ {
|
|
|
+ CreateTime = DateTime.Now,
|
|
|
+ CreateUserId = 235,
|
|
|
+ FId = item,
|
|
|
+ SmId = number,
|
|
|
+ IsDel = 0,
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ number = _SystemMenuAndFunctionRepository.Adds<Sys_SystemMenuAndFunction>(binFun);
|
|
|
+
|
|
|
if (number > 0)
|
|
|
{
|
|
|
view = JsonView(number);
|
|
|
+ _SystemMenuPermissionRepository.CommitTran();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
+ _SystemMenuPermissionRepository.RollbackTran();
|
|
|
view = JsonView("添加失败");
|
|
|
}
|
|
|
+
|
|
|
return Ok(view);
|
|
|
}
|
|
|
|
|
@@ -1317,6 +1366,40 @@ namespace OASystem.API.Controllers
|
|
|
return Ok(JsonView(view));
|
|
|
}
|
|
|
|
|
|
+ [HttpPost]
|
|
|
+ [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
|
|
|
+ public async Task<IActionResult> QueryPageFunById(PageFunDto Dto)
|
|
|
+ {
|
|
|
+ //页面与操作关联表
|
|
|
+ var pageAndFunList = _SystemMenuAndFunctionRepository.QueryDto<Sys_SystemMenuAndFunction, SystemMenuAndFunctionView>().ToList();
|
|
|
+ //页面功能表
|
|
|
+ var pageFunList = _PageFunctionPermissionRepository.QueryDto<Sys_PageFunctionPermission, Sys_PageFunctionPermission>().ToList();
|
|
|
+
|
|
|
+ ArrayList arr = new ArrayList();
|
|
|
+ foreach (var item in pageFunList)
|
|
|
+ {
|
|
|
+ var FindVal = pageAndFunList.Find(x => x.SmId == Dto.Pageid && x.FId == item.Id);
|
|
|
+ if (FindVal == null)
|
|
|
+ {
|
|
|
+ arr.Add(new
|
|
|
+ {
|
|
|
+ id = item.Id,
|
|
|
+ name = item.FunctionName,
|
|
|
+ value =false
|
|
|
+ });
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ arr.Add( new {
|
|
|
+ id = item.Id,
|
|
|
+ name = item.FunctionName,
|
|
|
+ value = true
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return Ok(JsonView(arr));
|
|
|
+ }
|
|
|
+
|
|
|
#endregion
|
|
|
|
|
|
#region 页面操作
|