diff --git a/ds-wms-service/DS.WMS.Core/Code/Method/CodeFormSetService.cs b/ds-wms-service/DS.WMS.Core/Code/Method/CodeFormSetService.cs index 8abf4211..eebec377 100644 --- a/ds-wms-service/DS.WMS.Core/Code/Method/CodeFormSetService.cs +++ b/ds-wms-service/DS.WMS.Core/Code/Method/CodeFormSetService.cs @@ -47,9 +47,16 @@ public class CodeFormSetService : IFormSetService public DataResult> GetListByPage(PageRequest request) { var tenantDb = saasService.GetBizDbScopeById(user.TenantId); + #region 添加系统参数 是否租户共享信息 + var query = tenantDb.Queryable(); + var config = db.Queryable().Where(x => x.Status == StatusEnum.Enable && x.Code == "IsTenantShareInfo").First(); + + if (config.IsNotNull() && config.Value == "TRUE") + query.ClearFilter(); + #endregion //序列化查询条件 var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition); - var data = tenantDb.Queryable() + var data = query .Where(whereList) .Select().ToQueryPage(request.PageCondition); return data; @@ -63,15 +70,20 @@ public class CodeFormSetService : IFormSetService public DataResult EditFormSet(CodeFormSetReq req) { var tenantDb = saasService.GetBizDbScopeById(user.TenantId); - //var orgId = user.GetOrgId(); - if (req.Id == 0) - { - if (tenantDb.Queryable() - .Where(x => x.OrgId == user.OrgId && x.PermissionId == req.PermissionId && x.FormNo == req.FormNo &&x.TaskStatus == req.TaskStatus).Any()) - { - return DataResult.Failed("表单设置已存在!", MultiLanguageConst.FormSetExist); - } + #region 添加系统参数 是否租户共享信息 + var query = tenantDb.Queryable(); + var config = db.Queryable().Where(x => x.Status == StatusEnum.Enable && x.Code == "IsTenantShareInfo").First(); + if (config.IsNotNull() && config.Value == "TRUE") + query.ClearFilter(); + #endregion + if (query + .Where(x => x.PermissionId == req.PermissionId && x.FormNo == req.FormNo && x.TaskStatus == req.TaskStatus && x.Id != req.Id).Any()) + { + return DataResult.Failed("表单设置已存在!", MultiLanguageConst.FormSetExist); + } + if (req.Id == 0) + { var data = req.Adapt(); data.DefaultContent = req.Content; var entity = tenantDb.Insertable(data).ExecuteReturnEntity(); @@ -80,7 +92,7 @@ public class CodeFormSetService : IFormSetService } else { - var info = tenantDb.Queryable().Where(x => x.Id == req.Id).First(); + var info = query.Where(x => x.Id == req.Id).First(); info = req.Adapt(info); @@ -97,7 +109,14 @@ public class CodeFormSetService : IFormSetService public DataResult GetFormSetInfo(string id) { var tenantDb = saasService.GetBizDbScopeById(user.TenantId); - var data = tenantDb.Queryable() + #region 添加系统参数 是否租户共享信息 + var query = tenantDb.Queryable(); + var config = db.Queryable().Where(x => x.Status == StatusEnum.Enable && x.Code == "IsTenantShareInfo").First(); + + if (config.IsNotNull() && config.Value == "TRUE") + query.ClearFilter(); + #endregion + var data = query .Where(x => x.Id == long.Parse(id) && x.Status == StatusEnum.Enable) .Select() .First(); @@ -157,7 +176,14 @@ public class CodeFormSetService : IFormSetService public async Task>> GetFormSetListByModule(string permissionId) { var tenantDb = saasService.GetBizDbScopeById(user.TenantId); - var data = await tenantDb.Queryable() + #region 添加系统参数 是否租户共享信息 + var query = tenantDb.Queryable(); + var config = db.Queryable().Where(x => x.Status == StatusEnum.Enable && x.Code == "IsTenantShareInfo").First(); + + if (config.IsNotNull() && config.Value == "TRUE") + query.ClearFilter(); + #endregion + var data = await query .Where(x => x.PermissionId == long.Parse(permissionId) && x.Status == StatusEnum.Enable) .Select() .ToListAsync(); @@ -167,7 +193,14 @@ public class CodeFormSetService : IFormSetService public DataResult BatchDelFormSet(IdModel req) { var tenantDb = saasService.GetBizDbScopeById(user.TenantId); - var list = tenantDb.Queryable().Where(x => req.Ids.Contains(x.Id)).ToList(); + #region 添加系统参数 是否租户共享信息 + var query = tenantDb.Queryable(); + var config = db.Queryable().Where(x => x.Status == StatusEnum.Enable && x.Code == "IsTenantShareInfo").First(); + + if (config.IsNotNull() && config.Value == "TRUE") + query.ClearFilter(); + #endregion + var list = query.Where(x => req.Ids.Contains(x.Id)).ToList(); if (list.Count > 0) { tenantDb.Deleteable(list).ExecuteCommand(); @@ -182,7 +215,14 @@ public class CodeFormSetService : IFormSetService public DataResult SetPublicFormSet(CodeFormSetPublicStatusReq req) { var tenantDb = saasService.GetBizDbScopeById(user.TenantId); - var info = tenantDb.Queryable().Where(x => x.Id == req.Id).First(); + #region 添加系统参数 是否租户共享信息 + var query = tenantDb.Queryable(); + var config = db.Queryable().Where(x => x.Status == StatusEnum.Enable && x.Code == "IsTenantShareInfo").First(); + + if (config.IsNotNull() && config.Value == "TRUE") + query.ClearFilter(); + #endregion + var info = query.Where(x => x.Id == req.Id).First(); if (info.IsNull()) { @@ -204,7 +244,14 @@ public class CodeFormSetService : IFormSetService public async Task FormSetCopy(string id) { var tenantDb = saasService.GetBizDbScopeById(user.TenantId); - var info = await tenantDb.Queryable().Where(x => x.Id == long.Parse(id)).FirstAsync(); + #region 添加系统参数 是否租户共享信息 + var query = tenantDb.Queryable(); + var config = db.Queryable().Where(x => x.Status == StatusEnum.Enable && x.Code == "IsTenantShareInfo").First(); + + if (config.IsNotNull() && config.Value == "TRUE") + query.ClearFilter(); + #endregion + var info = await query.Where(x => x.Id == long.Parse(id)).FirstAsync(); var data = info.Adapt(); data.Id = 0;