diff --git a/ds-wms-service/DS.Module.Core/Extensions/QueryableExtensions.cs b/ds-wms-service/DS.Module.Core/Extensions/QueryableExtensions.cs index 9a3a5995..2fdf2cbf 100644 --- a/ds-wms-service/DS.Module.Core/Extensions/QueryableExtensions.cs +++ b/ds-wms-service/DS.Module.Core/Extensions/QueryableExtensions.cs @@ -64,6 +64,25 @@ public static partial class Extensions return DataResult>.PageList(total, list, MultiLanguageConst.DataQuerySuccess); } + /// + /// 过滤操作权限 + /// + /// + /// + /// + /// + + public static ISugarQueryable WhereFilterOperationRule(this ISugarQueryable source, List conditionalModels) + { + source = source.Where(conditionalModels); + if (source.Count() == 0) + { + //return new Exception("没有数据操作权限!"); + Check.ExceptionEasy("NO Operation", "没有数据操作权限!"); + } + return source; + } + /// /// /// diff --git a/ds-wms-service/DS.WMS.Core/Code/Dtos/CodeFormCopyReq.cs b/ds-wms-service/DS.WMS.Core/Code/Dtos/CodeFormCopyReq.cs index 93efe867..701379be 100644 --- a/ds-wms-service/DS.WMS.Core/Code/Dtos/CodeFormCopyReq.cs +++ b/ds-wms-service/DS.WMS.Core/Code/Dtos/CodeFormCopyReq.cs @@ -22,6 +22,10 @@ public class CodeFormCopyReq /// 权限模块名称 /// public string PermissionName { get; set; } + ///// + ///// 表单默认设置 + ///// + //public string DefaultContent { get; set; } /// /// 字段复制设置 /// diff --git a/ds-wms-service/DS.WMS.Core/Code/Dtos/CodeFormCopyRes.cs b/ds-wms-service/DS.WMS.Core/Code/Dtos/CodeFormCopyRes.cs index 17e23331..8b70cb9f 100644 --- a/ds-wms-service/DS.WMS.Core/Code/Dtos/CodeFormCopyRes.cs +++ b/ds-wms-service/DS.WMS.Core/Code/Dtos/CodeFormCopyRes.cs @@ -30,10 +30,10 @@ public class CodeFormCopyRes /// 字段设置 /// public string Content { get; set; } - /// - /// 表单默认设置 - /// - public string DefaultContent { get; set; } + ///// + ///// 表单默认设置 + ///// + //public string DefaultContent { get; set; } /// /// 复制字段集合 diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportService.cs b/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportService.cs index 92087f21..31cb02f7 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/SeaExportService.cs @@ -501,7 +501,9 @@ public partial class SeaExportService : ISeaExportService } else { - var info = await tenantDb.Queryable().Where(x => x.Id == req.Id).FirstAsync(); + //添加操作权限 + var operationRule = commonService.GetOperationRuleConditional(); + var info = await tenantDb.Queryable().Where(x => x.Id == req.Id).WhereFilterOperationRule(operationRule).FirstAsync(); var feeStatus = await tenantDb.Queryable().Where(x => x.BusinessId == req.Id).FirstAsync(); if (feeStatus.IsNotNull() && (bool)feeStatus.IsBusinessLocking) diff --git a/ds-wms-service/DS.WMS.Core/Op/Method/ShippingBillTemplateService.cs b/ds-wms-service/DS.WMS.Core/Op/Method/ShippingBillTemplateService.cs index aae6fc3f..09846e78 100644 --- a/ds-wms-service/DS.WMS.Core/Op/Method/ShippingBillTemplateService.cs +++ b/ds-wms-service/DS.WMS.Core/Op/Method/ShippingBillTemplateService.cs @@ -78,9 +78,9 @@ namespace DS.WMS.Core.Op.Method } else { - //var info = tenantDb.Queryable().Where(x => x.Id == req.Id).First(); - var operationRule = commonService.GetOperationRuleConditional(); - var info = tenantDb.Queryable().Where(x => x.Id == req.Id).Where(operationRule).First(); + var info = tenantDb.Queryable().Where(x => x.Id == req.Id).First(); + //var operationRule = commonService.GetOperationRuleConditional(); + //var info = tenantDb.Queryable().Where(x => x.Id == req.Id).WhereFilterOperationRule(operationRule).First(); info = req.Adapt(info); diff --git a/ds-wms-service/DS.WMS.Core/Sys/Dtos/OperationRuleReq.cs b/ds-wms-service/DS.WMS.Core/Sys/Dtos/OperationRuleReq.cs index 3e2dc99c..8564260f 100644 --- a/ds-wms-service/DS.WMS.Core/Sys/Dtos/OperationRuleReq.cs +++ b/ds-wms-service/DS.WMS.Core/Sys/Dtos/OperationRuleReq.cs @@ -28,9 +28,12 @@ public class OperationRuleReq /// 权限实体 /// public string PermissionEntity { get; set; } - /// - /// 数据权限描述 + /// 中文视图名 + /// + public string ColumnView { get; set; } + /// + /// 操作权限描述 /// public string Description { get; set; } diff --git a/ds-wms-service/DS.WMS.Core/Sys/Dtos/OperationRuleRes.cs b/ds-wms-service/DS.WMS.Core/Sys/Dtos/OperationRuleRes.cs index 6834e8b5..20ac9c41 100644 --- a/ds-wms-service/DS.WMS.Core/Sys/Dtos/OperationRuleRes.cs +++ b/ds-wms-service/DS.WMS.Core/Sys/Dtos/OperationRuleRes.cs @@ -25,12 +25,16 @@ public class OperationRuleRes /// public string PermissionEntity { get; set; } /// + /// 中文视图名 + /// + public string ColumnView { get; set; } + /// /// 权限规则 /// public string DataRules { get; set; } /// - /// 数据权限描述 + /// 操作权限描述 /// public string Description { get; set; } diff --git a/ds-wms-service/DS.WMS.Core/Sys/Entity/SysOperationRule.cs b/ds-wms-service/DS.WMS.Core/Sys/Entity/SysOperationRule.cs index 6c375b31..c61fbf14 100644 --- a/ds-wms-service/DS.WMS.Core/Sys/Entity/SysOperationRule.cs +++ b/ds-wms-service/DS.WMS.Core/Sys/Entity/SysOperationRule.cs @@ -17,6 +17,10 @@ public class SysOperationRule : BaseTenantModel /// public string PermissionEntity { get; set; } /// + /// 中文视图名 + /// + public string ColumnView { get; set; } + /// /// 状态 /// [SqlSugar.SugarColumn(ColumnDescription = "状态")] diff --git a/ds-wms-service/DS.WMS.MainApi/Controllers/OperationRuleController.cs b/ds-wms-service/DS.WMS.MainApi/Controllers/OperationRuleController.cs new file mode 100644 index 00000000..8ac2ef29 --- /dev/null +++ b/ds-wms-service/DS.WMS.MainApi/Controllers/OperationRuleController.cs @@ -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; + +/// +/// 操作权限模块 +/// +public class OperationRuleController : ApiController +{ + private readonly IOperationRuleService _invokeService; + + /// + /// 构造函数 + /// + /// + public OperationRuleController(IOperationRuleService invokeService) + { + _invokeService = invokeService; + } + + /// + /// 列表 + /// + /// + /// + [HttpPost] + [Route("GetOperationRuleList")] + public DataResult> GetOperationRuleList([FromBody] PageRequest request) + { + var res = _invokeService.GetListByPage(request); + return res; + } + + /// + /// 编辑 + /// + /// + /// + [HttpPost] + [Route("EditOperationRule")] + public DataResult EditOperationRule([FromBody] OperationRuleReq req) + { + var res = _invokeService.EditOperationRule(req); + return res; + } + + /// + /// 详情 + /// + /// + /// + [HttpGet] + [Route("GetOperationRuleInfo")] + public DataResult GetOperationRuleInfo([FromQuery] string id) + { + var res = _invokeService.GetOperationRuleInfo(id); + return res; + } +} \ No newline at end of file