数据权限模板及用户权限范围修改

dev
cjy 2 months ago
parent 2822c8a5cc
commit 00670e1a22

@ -18,9 +18,22 @@ namespace DS.WMS.Core.Code.Dtos
/// </summary>
public long Id { get; set; }
/// <summary>
/// 模板名称
/// 权限模板类型
/// </summary>
public string TemplateName { get; set; }
/// <summary>
/// 权限类型 visible 可视范围 operate 操作范围
/// </summary>
public string RuleType { get; set; } = "visible";
/// <summary>
/// 权限模板范围
/// </summary>
public string RuleScope { get; set; }
/// <summary>
/// 权限模板范围名称
/// </summary>
public string RuleScopeName { get; set; }
/// <summary>
/// 资源标识权限ID
/// </summary>

@ -17,9 +17,22 @@ namespace DS.WMS.Core.Code.Dtos
/// </summary>
public long Id { get; set; }
/// <summary>
/// 模板名称
/// 权限模板类型
/// </summary>
public string TemplateName { get; set; }
/// <summary>
/// 权限类型 visible 可视范围 operate 操作范围
/// </summary>
public string RuleType { get; set; } = "visible";
/// <summary>
/// 权限模板范围
/// </summary>
public string RuleScope { get; set; }
/// <summary>
/// 权限模板范围名称
/// </summary>
public string RuleScopeName { get; set; }
/// <summary>
/// 资源标识权限ID
/// </summary>

@ -32,41 +32,39 @@ namespace DS.WMS.Core.Code.Entity
[SqlSugar.SugarColumn(ColumnDescription = "用户名称", IsNullable = true, Length = 100)]
public string UserName { get; set; }
/// <summary>
/// 模板ID
/// 可视模板Id
/// </summary>
[SugarColumn(ColumnDescription = "模板ID")]
public long TemplateId { get; set; }
/// <summary>
/// 模板名称
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "模板名称", IsNullable = false, Length = 200)]
public string TemplateName { get; set; }
[SugarColumn(ColumnDescription = "可视模板Id")]
public long VisibleTemplateId { get; set; }
/// <summary>
/// 权限实体
/// 可视权限模板范围
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "权限实体", IsNullable = false, Length = 100)]
public string PermissionEntity { get; set; }
[SqlSugar.SugarColumn(ColumnDescription = "可视权限模板范围", IsNullable = false, Length = 200)]
public string VisibleRuleScope { get; set; }
/// <summary>
/// 中文视图名
/// 可视权限模板范围名称
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "中文视图名", IsNullable = true, Length = 50)]
public string ColumnView { get; set; }
[SqlSugar.SugarColumn(ColumnDescription = "可视权限模板范围名称", IsNullable = false, Length = 200)]
public string VisibleRuleScopeName { get; set; }
/// <summary>
/// 权限规则
/// 操作模板Id
/// </summary>
[SugarColumn(ColumnDescription = "权限规则", IsNullable = true, ColumnDataType = StaticConfig.CodeFirst_BigString)]
public string DataRules { get; set; }
[SugarColumn(ColumnDescription = "操作模板Id")]
public long OperatorTemplateId { get; set; }
/// <summary>
/// 数据权限描述
/// 操作权限模板范围
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "操作权限模板范围", IsNullable = false, Length = 200)]
public string OperatorRuleScope { get; set; }
/// <summary>
/// 操作权限模板范围名称
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "数据权限描述", IsNullable = true, Length = 200)]
public string Description { get; set; }
[SqlSugar.SugarColumn(ColumnDescription = "操作权限模板范围名称", IsNullable = false, Length = 200)]
public string OperatorRuleScopeName { get; set; }
/// <summary>
/// 状态
/// </summary>

@ -15,16 +15,26 @@ namespace DS.WMS.Core.Code.Entity
[SqlSugar.SugarTable("code_data_rule_template","数据权限模板")]
public class CodeDataRuleTemplate : BaseModel<long>
{
/// <summary>
/// 权限模板类型
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "权限模板类型", IsNullable = false, Length = 200)]
public string TemplateName { get; set; }
/// <summary>
/// 权限类型 visible 可视范围 operate 操作范围
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "权限类型", IsNullable = false, Length = 100)]
public string RuleType { get; set; } = "visible";
/// <summary>
/// 模板名称
/// 权限模板范围
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "模板名称", IsNullable = false, Length = 200)]
public string TemplateName { get; set; }
[SqlSugar.SugarColumn(ColumnDescription = "权限模板范围", IsNullable = false, Length = 200)]
public string RuleScope { get; set; }
/// <summary>
/// 权限模板范围名称
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "权限模板范围名称", IsNullable = false, Length = 200)]
public string RuleScopeName { get; set; }
/// <summary>
/// 资源标识权限ID
/// </summary>

@ -15,12 +15,12 @@ public interface ICodeDataRuleService
Task<DataResult<List<CodeDataRuleRes>>> GetListByPage(PageRequest request);
/// <summary>
/// 编辑
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
Task<DataResult> EditCodeDataRule(CodeDataRuleReq model);
///// <summary>
///// 编辑
///// </summary>
///// <param name="model"></param>
///// <returns></returns>
//Task<DataResult> EditCodeDataRule(CodeDataRuleReq model);
/// <summary>
/// 获取详情

@ -47,37 +47,37 @@ namespace DS.WMS.Core.Code.Method
return data;
}
/// <summary>
/// 编辑
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
public async Task<DataResult> EditCodeDataRule(CodeDataRuleReq req)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
if (req.Id == 0)
{
if (tenantDb.Queryable<CodeDataRule>()
.Where(x => x.PermissionId == req.PermissionId && x.TemplateName == req.TemplateName).Any())
{
return await Task.FromResult(DataResult.Failed("数据权限模板已存在!", MultiLanguageConst.DataRuleTemplateExist));
}
///// <summary>
///// 编辑
///// </summary>
///// <param name="req"></param>
///// <returns></returns>
//public async Task<DataResult> EditCodeDataRule(CodeDataRuleReq req)
//{
// var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
// if (req.Id == 0)
// {
// if (tenantDb.Queryable<CodeDataRule>()
// .Where(x => x.PermissionId == req.PermissionId && x.TemplateName == req.TemplateName).Any())
// {
// return await Task.FromResult(DataResult.Failed("数据权限模板已存在!", MultiLanguageConst.DataRuleTemplateExist));
// }
var data = req.Adapt<CodeDataRule>();
var entity = await tenantDb.Insertable(data).ExecuteReturnEntityAsync();
// var data = req.Adapt<CodeDataRule>();
// var entity = await tenantDb.Insertable(data).ExecuteReturnEntityAsync();
return await Task.FromResult(DataResult.Successed("添加成功!", entity.Id, MultiLanguageConst.DataCreateSuccess));
}
else
{
var info = await tenantDb.Queryable<CodeDataRule>().Where(x => x.Id == req.Id).FirstAsync();
// return await Task.FromResult(DataResult.Successed("添加成功!", entity.Id, MultiLanguageConst.DataCreateSuccess));
// }
// else
// {
// var info = await tenantDb.Queryable<CodeDataRule>().Where(x => x.Id == req.Id).FirstAsync();
info = req.Adapt(info);
// info = req.Adapt(info);
await tenantDb.Updateable(info).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
return await Task.FromResult(DataResult.Successed("更新成功!", MultiLanguageConst.DataUpdateSuccess));
}
}
// await tenantDb.Updateable(info).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
// return await Task.FromResult(DataResult.Successed("更新成功!", MultiLanguageConst.DataUpdateSuccess));
// }
//}
/// <summary>
/// 详情

@ -63,7 +63,7 @@ namespace DS.WMS.Core.Code.Method
if (req.Id == 0)
{
if (tenantDb.Queryable<CodeDataRuleTemplate>()
.Where(x => x.PermissionId == req.PermissionId && x.TemplateName == req.TemplateName).Any())
.Where(x => x.PermissionId == req.PermissionId && x.TemplateName == req.TemplateName && x.RuleScope == req.RuleScope && x.RuleType == req.RuleType).Any())
{
return await Task.FromResult(DataResult.Failed("数据权限模板已存在!", MultiLanguageConst.DataRuleTemplateExist));
}

@ -37,18 +37,18 @@ public class CodeDataRuleController : ApiController
return res;
}
/// <summary>
/// 编辑
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
[HttpPost]
[Route("EditCodeDataRule")]
public async Task<DataResult> EditCodeDataRule([FromBody] CodeDataRuleReq req)
{
var res = await _invokeService.EditCodeDataRule(req);
return res;
}
///// <summary>
///// 编辑
///// </summary>
///// <param name="req"></param>
///// <returns></returns>
//[HttpPost]
//[Route("EditCodeDataRule")]
//public async Task<DataResult> EditCodeDataRule([FromBody] CodeDataRuleReq req)
//{
// var res = await _invokeService.EditCodeDataRule(req);
// return res;
//}
/// <summary>
/// 详情

Loading…
Cancel
Save