操作权限相关接口

usertest
cjy 5 months ago
parent c383eaa0a2
commit 0970f4a87e

@ -64,6 +64,25 @@ public static partial class Extensions
return DataResult<List<TEntity>>.PageList(total, list, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
/// 过滤操作权限
/// </summary>
/// <typeparam name="TEntity"></typeparam>
/// <param name="source"></param>
/// <param name="conditionalModels"></param>
/// <returns></returns>
public static ISugarQueryable<TEntity> WhereFilterOperationRule<TEntity>(this ISugarQueryable<TEntity> source, List<IConditionalModel> conditionalModels)
{
source = source.Where(conditionalModels);
if (source.Count() == 0)
{
//return new Exception("没有数据操作权限!");
Check.ExceptionEasy("NO Operation", "没有数据操作权限!");
}
return source;
}
/// <summary>
///
/// </summary>

@ -22,6 +22,10 @@ public class CodeFormCopyReq
/// 权限模块名称
/// </summary>
public string PermissionName { get; set; }
///// <summary>
///// 表单默认设置
///// </summary>
//public string DefaultContent { get; set; }
/// <summary>
/// 字段复制设置
/// </summary>

@ -30,10 +30,10 @@ public class CodeFormCopyRes
/// 字段设置
/// </summary>
public string Content { get; set; }
/// <summary>
/// 表单默认设置
/// </summary>
public string DefaultContent { get; set; }
///// <summary>
///// 表单默认设置
///// </summary>
//public string DefaultContent { get; set; }
/// <summary>
/// 复制字段集合

@ -501,7 +501,9 @@ public partial class SeaExportService : ISeaExportService
}
else
{
var info = await tenantDb.Queryable<SeaExport>().Where(x => x.Id == req.Id).FirstAsync();
//添加操作权限
var operationRule = commonService.GetOperationRuleConditional<SeaExport>();
var info = await tenantDb.Queryable<SeaExport>().Where(x => x.Id == req.Id).WhereFilterOperationRule(operationRule).FirstAsync();
var feeStatus = await tenantDb.Queryable<BusinessFeeStatus>().Where(x => x.BusinessId == req.Id).FirstAsync();
if (feeStatus.IsNotNull() && (bool)feeStatus.IsBusinessLocking)

@ -78,9 +78,9 @@ namespace DS.WMS.Core.Op.Method
}
else
{
//var info = tenantDb.Queryable<SeaExportShippingBillTemplate>().Where(x => x.Id == req.Id).First();
var operationRule = commonService.GetOperationRuleConditional<SeaExportShippingBillTemplate>();
var info = tenantDb.Queryable<SeaExportShippingBillTemplate>().Where(x => x.Id == req.Id).Where(operationRule).First();
var info = tenantDb.Queryable<SeaExportShippingBillTemplate>().Where(x => x.Id == req.Id).First();
//var operationRule = commonService.GetOperationRuleConditional<SeaExportShippingBillTemplate>();
//var info = tenantDb.Queryable<SeaExportShippingBillTemplate>().Where(x => x.Id == req.Id).WhereFilterOperationRule(operationRule).First();
info = req.Adapt(info);

@ -28,9 +28,12 @@ public class OperationRuleReq
/// 权限实体
/// </summary>
public string PermissionEntity { get; set; }
/// <summary>
/// 数据权限描述
/// 中文视图名
/// </summary>
public string ColumnView { get; set; }
/// <summary>
/// 操作权限描述
/// </summary>
public string Description { get; set; }

@ -25,12 +25,16 @@ public class OperationRuleRes
/// </summary>
public string PermissionEntity { get; set; }
/// <summary>
/// 中文视图名
/// </summary>
public string ColumnView { get; set; }
/// <summary>
/// 权限规则
/// </summary>
public string DataRules { get; set; }
/// <summary>
/// 数据权限描述
/// 操作权限描述
/// </summary>
public string Description { get; set; }

@ -17,6 +17,10 @@ public class SysOperationRule : BaseTenantModel<long>
/// </summary>
public string PermissionEntity { get; set; }
/// <summary>
/// 中文视图名
/// </summary>
public string ColumnView { get; set; }
/// <summary>
/// 状态
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "状态")]

@ -0,0 +1,62 @@
using DS.Module.Core;
using DS.WMS.Core.Sys.Dtos;
using DS.WMS.Core.Sys.Interface;
using Microsoft.AspNetCore.Mvc;
namespace DS.WMS.MainApi.Controllers;
/// <summary>
/// 操作权限模块
/// </summary>
public class OperationRuleController : ApiController
{
private readonly IOperationRuleService _invokeService;
/// <summary>
/// 构造函数
/// </summary>
/// <param name="invokeService"></param>
public OperationRuleController(IOperationRuleService invokeService)
{
_invokeService = invokeService;
}
/// <summary>
/// 列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[HttpPost]
[Route("GetOperationRuleList")]
public DataResult<List<OperationRuleRes>> GetOperationRuleList([FromBody] PageRequest request)
{
var res = _invokeService.GetListByPage(request);
return res;
}
/// <summary>
/// 编辑
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
[HttpPost]
[Route("EditOperationRule")]
public DataResult EditOperationRule([FromBody] OperationRuleReq req)
{
var res = _invokeService.EditOperationRule(req);
return res;
}
/// <summary>
/// 详情
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpGet]
[Route("GetOperationRuleInfo")]
public DataResult<OperationRuleRes> GetOperationRuleInfo([FromQuery] string id)
{
var res = _invokeService.GetOperationRuleInfo(id);
return res;
}
}
Loading…
Cancel
Save