master
张同海 9 months ago
commit 87caf1caff

@ -13,7 +13,7 @@ VITE_PROXY=[["/api","http://60.209.125.238:3008"],["/stage-api","https://www.666
VITE_DROP_CONSOLE = true
# 后台接口父地址(必填)
VITE_GLOB_API_URL=http://localhost:3008
#VITE_GLOB_API_URL=http://localhost:3008
# VITE_GLOB_API_URL="/api" # 开发 测试环境
# File upload address optional

@ -0,0 +1,22 @@
using System.ComponentModel;
namespace DS.Module.Core;
/// <summary>
/// 数据权限常量
/// </summary>
public static class DataRuleConst
{
/// <summary>
/// 数据权限配置中当前登录用户的key
/// </summary>
public const string LoginUser = "{loginUser}";
/// <summary>
/// 数据权限配置中当前登录角色的key
/// </summary>
public const string LoginRole = "{loginRole}";
/// <summary>
/// 数据权限配置中当前登录机构的key
/// </summary>
public const string LoginOrg = "{loginOrg}";
}

@ -23,6 +23,14 @@ public static class MultiLanguageConst
/// </summary>
[Description("更新成功")]
public const string DataUpdateSuccess = "Data_Update_Success";
/// <summary>
/// 删除成功
/// </summary>
[Description("删除成功")]
public const string DataDelSuccess = "Data_Del_Success";
/// <summary>
/// 更新失败
/// </summary>
@ -44,12 +52,16 @@ public static class MultiLanguageConst
[Description("用户授权数量限制")]
public const string UserAuthNumLimit = "User_AuthNum_Limit";
[Description("{0}模块数量超出授权数量{1}")]
public const string PerAuthNumLimit = "Permission_AuthNum_Limit";
[Description("用户唯一编码已存在")]
public const string UserCodeExist = "UserCode_Exist";
[Description("角色唯一编码已存在")]
public const string RoleCodeExist = "RoleCode_Exist";
#endregion
[Description("字典类型唯一编码已存在")]
public const string DictCodeExist = "DictCode_Exist";
[Description("机构名称已存在")]
public const string OrgNameExist = "OrgName_Exist";
/// <summary>
@ -58,6 +70,9 @@ public static class MultiLanguageConst
[Description("权限模块不存在")]
public const string PermissionNotExist = "Permission_NotExist";
[Description("数据权限已存在")]
public const string DataRuleExist = "Data_Rule_Exist";
/// <summary>
/// 非法请求
/// </summary>
@ -66,6 +81,10 @@ public static class MultiLanguageConst
#region 工作流相关
[Description("工作流实例存在引用的流程模板不能删除")]
public const string FlowTemplateDelExistImport = "FlowTemplate_Del_Exist_Import";
[Description("引入的流程模板不存在")]
public const string FlowTemplateImportNotExist = "FlowTemplate_Import_NotExist";
/// <summary>
/// 只能修改【草稿】和【驳回】状态的流程
/// </summary>
@ -74,7 +93,7 @@ public static class MultiLanguageConst
/// <summary>
/// 该流程模板已不存在,请重新设计流程
/// </summary>
[Description("该流程模板不存在,请重新设计流程")]
[Description("该流程模板不存在")]
public const string FlowTemplateNotExist = "FlowTemplate_NotExist";
/// <summary>

@ -0,0 +1,43 @@
namespace DS.Module.Core.Data;
/// <summary>
/// 数据条件组
/// </summary>
public class DataGroupConditions
{
/// <summary>
/// 逻辑操作符
/// </summary>
public string LogicalOperator { get; set; }
/// <summary>
/// 条件组
/// </summary>
public List<DataConditions> Conditions { get; set; }
/// <summary>
/// 分组
/// </summary>
public List<DataGroupConditions> Groups { get; set; }
}
/// <summary>
/// 条件
/// </summary>
public class DataConditions
{
/// <summary>
/// 字段
/// </summary>
public string Field { get; set; }
/// <summary>
/// 操作符
/// </summary>
public string Operator { get; set; }
/// <summary>
/// 值
/// </summary>
public string Value { get; set; }
}

@ -0,0 +1,12 @@
namespace DS.Module.Core.Data;
/// <summary>
/// id实体
/// </summary>
public class IdModel
{
/// <summary>
/// 主键id
/// </summary>
public string Id { get; set; }
}

@ -1,5 +1,7 @@
using SqlSugar;
using System.ComponentModel;
using DS.Module.Core.Data;
using Newtonsoft.Json;
namespace DS.Module.Core.Extensions;
@ -35,14 +37,15 @@ public static partial class Extensions
/// <param name="page"></param>
/// <typeparam name="TEntity"></typeparam>
/// <returns></returns>
public static DataResult<List<TEntity>> ToQueryPage<TEntity>(this ISugarQueryable<TEntity> source, PageCondition page)
public static DataResult<List<TEntity>> ToQueryPage<TEntity>(this ISugarQueryable<TEntity> source,
PageCondition page)
{
page.NotNull(nameof(page));
var result = source.WhereAsync(page.PageIndex, page.PageSize, page.SortConditions);
var list = result.data;
var total = result.totalNumber;
return DataResult<List<TEntity>>.PageList(total, list,MultiLanguageConst.DataQuerySuccess);
return DataResult<List<TEntity>>.PageList(total, list, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
@ -79,4 +82,191 @@ public static partial class Extensions
? source.ToPageList(pageIndex, pageSize, ref total)
: Enumerable.Empty<TEntity>().ToList(), total);
}
/// <summary>
/// 转换SqlSugar条件查询表达式
/// </summary>
/// <param name="ruleStr"></param>
/// <returns></returns>
public static List<ConditionalCollections> ConvertSqlSugarExpression(this string ruleStr)
{
var conditions = JsonConvert.DeserializeObject<DataGroupConditions>(ruleStr);
var conditionalCollections = new List<ConditionalCollections>();
if (conditions.LogicalOperator == "and")
{
var conditionList = new List<KeyValuePair<WhereType, ConditionalModel>>();
foreach (var item in conditions.Conditions)
{
conditionList.Add(new KeyValuePair<WhereType, ConditionalModel>
(WhereType.And,
new ConditionalModel
{
FieldName = item.Field, ConditionalType = GetConditionalType(item.Operator),
FieldValue = item.Value
})
);
}
if (conditionList.Count > 0)
{
conditionalCollections.Add(new ConditionalCollections
{
ConditionalList = conditionList
}
)
;
}
var groupList = new List<KeyValuePair<WhereType, ConditionalModel>>();
foreach (var group in conditions.Groups)
{
if (group.LogicalOperator == "and")
{
foreach (var item1 in group.Conditions)
{
groupList.Add(new KeyValuePair<WhereType, ConditionalModel>
(WhereType.And,
new ConditionalModel
{
FieldName = item1.Field, ConditionalType = GetConditionalType(item1.Operator),
FieldValue = item1.Value
})
);
}
}
else
{
foreach (var item1 in group.Conditions)
{
groupList.Add(new KeyValuePair<WhereType, ConditionalModel>
(WhereType.Or,
new ConditionalModel
{
FieldName = item1.Field, ConditionalType =GetConditionalType(item1.Operator),
FieldValue = item1.Value
})
);
}
}
}
if (groupList.Count > 0)
{
conditionalCollections.Add(new ConditionalCollections
{
ConditionalList = groupList
}
)
;
}
}
else
{
var conditionList = new List<KeyValuePair<WhereType, ConditionalModel>>();
foreach (var item in conditions.Conditions)
{
conditionList.Add(new KeyValuePair<WhereType, ConditionalModel>
(WhereType.Or,
new ConditionalModel
{
FieldName = item.Field, ConditionalType = GetConditionalType(item.Operator),
FieldValue = item.Value
})
);
}
if (conditionList.Count > 0)
{
conditionalCollections.Add(new ConditionalCollections
{
ConditionalList = conditionList
}
)
;
}
var groupList = new List<KeyValuePair<WhereType, ConditionalModel>>();
foreach (var group in conditions.Groups)
{
if (group.LogicalOperator == "and")
{
foreach (var item1 in group.Conditions)
{
groupList.Add(new KeyValuePair<WhereType, ConditionalModel>
(WhereType.And,
new ConditionalModel
{
FieldName = item1.Field, ConditionalType = GetConditionalType(item1.Operator),
FieldValue = item1.Value
})
);
}
}
else
{
foreach (var item1 in group.Conditions)
{
groupList.Add(new KeyValuePair<WhereType, ConditionalModel>
(WhereType.Or,
new ConditionalModel
{
FieldName = item1.Field, ConditionalType = GetConditionalType(item1.Operator),
FieldValue = item1.Value
})
);
}
}
}
if (groupList.Count > 0)
{
conditionalCollections.Add(new ConditionalCollections
{
ConditionalList = groupList
}
)
;
}
}
return conditionalCollections;
}
/// <summary>
/// 转换SqlSugar 条件操作符
/// </summary>
/// <param name="conditionalType"></param>
/// <returns></returns>
private static ConditionalType GetConditionalType(string conditionalType)
{
switch (conditionalType)
{
//等于
case "equal":
return ConditionalType.Equal;
//不等于
case "not_equal":
return ConditionalType.NoEqual;
//大于
case "GreaterThan":
return ConditionalType.GreaterThan;
//大于等于
case "GreaterThanOrEqual":
return ConditionalType.GreaterThanOrEqual;
//小于
case "LessThan":
return ConditionalType.LessThan;
//小于等于
case "LessThanOrEqual":
return ConditionalType.GreaterThanOrEqual;
//包含
case "contains":
return ConditionalType.In;
//不包含
case "not_contain":
return ConditionalType.NotIn;
//默认
default:
return ConditionalType.Equal;
}
}
}

@ -13,6 +13,7 @@ public class SaasDbService : ISaasDbService
private readonly IServiceProvider _serviceProvider;
private readonly SqlSugarScope db;
private readonly IUser user;
private readonly ISaasDbService saasService;
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
/// <summary>

@ -27,8 +27,10 @@ namespace DS.Module.SqlSugar
entityInfo.SetValue(GuidHelper.GetSnowflakeId());
}
if (entityInfo.EntityColumnInfo.PropertyInfo.PropertyType == typeof(long))
if (entityInfo.EntityColumnInfo.IsPrimarykey && entityInfo.EntityColumnInfo.PropertyInfo.PropertyType == typeof(long))
{
var id = entityInfo.EntityColumnInfo.PropertyInfo.GetValue(entityInfo.EntityValue);
if (id == null || (long)id == 0)
entityInfo.SetValue(SnowFlakeSingle.Instance.NextId());
}
}

@ -0,0 +1,101 @@
using DS.Module.Core;
using DS.WMS.Core.System.Dtos;
using DS.WMS.Core.System.Entity;
using DS.WMS.Core.System.Interface;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace DS.WMS.AdminApi.Controllers;
/// <summary>
/// 字典模块
/// </summary>
public class DictController : ApiController
{
private readonly ISysDictTypeService _invokeService;
private readonly ISysDictDataService _dictDataService;
/// <summary>
/// 构造函数
/// </summary>
/// <param name="invokeService"></param>
public DictController(ISysDictTypeService invokeService,ISysDictDataService dictDataService)
{
_invokeService = invokeService;
_dictDataService = dictDataService;
}
/// <summary>
/// 字典类型列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[HttpPost]
[Route("GetSysDictTypeList")]
public DataResult<List<DictTypeRes>> GetSysDictTypeList([FromBody] PageRequest request)
{
var res = _invokeService.GetListByPage(request);
return res;
}
/// <summary>
/// 编辑字典类型
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
[Route("EditDictType")]
public DataResult EditDictType([FromBody] DictTypeReq model)
{
var res = _invokeService.EditDictType(model);
return res;
}
/// <summary>
/// 字典明细列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[HttpPost]
[Route("GetSysDictDataList")]
public DataResult<List<DictDataRes>> GetSysDictDataList([FromBody] PageRequest request)
{
var res = _dictDataService.GetListByPage(request);
return res;
}
/// <summary>
/// 编辑字典明细
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
[Route("EditDictData")]
public DataResult EditDictData([FromBody] DictDataReq model)
{
var res = _dictDataService.EditDictData(model);
return res;
}
/// <summary>
/// 字典类型详情
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpGet]
[Route("GetDictTypeInfo")]
public DataResult<DictTypeRes> GetDictTypeInfo([FromQuery] string id)
{
var res = _invokeService.GetDictTypeInfo(id);
return res;
}
/// <summary>
/// 字典明细详情
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpGet]
[Route("GetDictDataInfo")]
public DataResult<DictDataRes> GetDictDataInfo([FromQuery] string id)
{
var res = _dictDataService.GetDictDataInfo(id);
return res;
}
}

@ -3,6 +3,7 @@ using DS.Module.Core.Data;
using DS.WMS.Core.System.Dtos;
using DS.WMS.Core.System.Interface;
using Microsoft.AspNetCore.Mvc;
using SqlSugar;
namespace DS.WMS.AdminApi.Controllers;
@ -83,4 +84,28 @@ public class TenantController : ApiController
{
return _invokeService.UpdateTenantPermission(req);
}
/// <summary>
/// 获取租户表差异
/// </summary>
/// <param name="id">租户Id</param>
/// <returns></returns>
[HttpGet]
[Route("GetSaasTableDifference")]
public DataResult<TableDifferenceProvider> GetSaasTableDifference([FromQuery] string id)
{
var res = _invokeService.GetSaasTableDifference(id);
return res;
}
/// <summary>
/// 更新租户表差异
/// </summary>
/// <param name="req">主键id</param>
/// <returns></returns>
[HttpPost]
[Route("UpdateSaasTableInfo")]
public DataResult UpdateSaasTableInfo([FromBody] IdModel req)
{
return _invokeService.UpdateSaasTableInfo(req);
}
}

@ -404,3 +404,31 @@
2024-02-19 14:33:49.2154 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.AdminApi\bin\Debug\net8.0\nlog.config
2024-02-19 14:33:49.2301 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-02-19 14:33:49.2610 Info Configuration initialized.
2024-02-20 09:36:39.3273 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-02-20 09:36:39.4228 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-02-20 09:36:39.4960 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-02-20 09:36:39.5664 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-02-20 09:36:39.6753 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.AdminApi\bin\Debug\net8.0\nlog.config
2024-02-20 09:36:39.7236 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-02-20 09:36:39.8320 Info Configuration initialized.
2024-02-20 15:44:41.9090 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-02-20 15:44:42.1108 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-02-20 15:44:42.2070 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-02-20 15:44:42.4571 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-02-20 15:44:42.6293 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.AdminApi\bin\Debug\net8.0\nlog.config
2024-02-20 15:44:42.6549 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-02-20 15:44:42.7207 Info Configuration initialized.
2024-02-22 17:59:02.7290 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-02-22 17:59:02.7572 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-02-22 17:59:02.7819 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-02-22 17:59:02.8134 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-02-22 17:59:02.8482 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.AdminApi\bin\Debug\net8.0\nlog.config
2024-02-22 17:59:02.8692 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-02-22 17:59:02.9376 Info Configuration initialized.
2024-02-23 08:53:34.7978 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-02-23 08:53:34.8813 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-02-23 08:53:34.9347 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-02-23 08:53:35.0052 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-02-23 08:53:35.0867 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.AdminApi\bin\Debug\net8.0\nlog.config
2024-02-23 08:53:35.1429 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-02-23 08:53:35.2826 Info Configuration initialized.

@ -0,0 +1,103 @@
using DS.Module.Core;
using DS.Module.Core.Data;
using SqlSugar;
namespace DS.WMS.Core.Code.Entity;
/// <summary>
/// 商品信息表
/// </summary>
[SqlSugar.SugarTable("op_code_goods","商品信息表")]
public class CodeGoods: BaseModel<long>
{
/// <summary>
/// 商品编码
/// </summary>
[SugarColumn(ColumnDescription = "商品编码", Length = 30)]
public string GoodsCode { get; set; }
/// <summary>
/// 商品名称
/// </summary>
[SugarColumn(ColumnDescription = "商品名称", Length = 50)]
public string GoodName { get; set; }
/// <summary>
/// 物料号
/// </summary>
[SugarColumn(ColumnDescription = "物料号", Length = 50)]
public string GoodNo { get; set; }
/// <summary>
/// 英文名称
/// </summary>
[SugarColumn(ColumnDescription = "英文名称", Length = 10)]
public string EnName { get; set; }
/// <summary>
/// 商品描述
/// </summary>
[SugarColumn(ColumnDescription = "商品描述", Length = 200)]
public string Description { get; set; }
/// <summary>
/// 入库应收
/// </summary>
[SugarColumn(ColumnDescription = "入库应收", Length = 18,DecimalDigits = 2,DefaultValue ="0")]
public decimal ARRate { get; set; }
/// <summary>
/// 入库应付
/// </summary>
[SugarColumn(ColumnDescription = "入库应收", Length = 18,DecimalDigits = 2,DefaultValue ="0")]
public decimal APRate { get; set; }
/// <summary>
/// 出库应收
/// </summary>
[SugarColumn(ColumnDescription = "出库应收", Length = 18,DecimalDigits = 2,DefaultValue ="0")]
public decimal AROutRate { get; set; }
/// <summary>
/// 出库应付
/// </summary>
[SugarColumn(ColumnDescription = "出库应收", Length = 18,DecimalDigits = 2,DefaultValue ="0")]
public decimal APOutRate { get; set; }
/// <summary>
/// 商品类型
/// </summary>
[SugarColumn(ColumnDescription = "商品类型", IsNullable = true)]
public long GoodsTypeId { get; set; }
/// <summary>
/// 计费大类
/// </summary>
[SugarColumn(ColumnDescription = "计费大类", IsNullable = true)]
public long GoodsFeeTypeId { get; set; }
/// <summary>
/// 海关代码
/// </summary>
[SugarColumn(ColumnDescription = "海关代码", Length = 50)]
public string HSCode { get; set; }
/// <summary>
/// 申报计量单位
/// </summary>
[SugarColumn(ColumnDescription = "物料号", Length = 50)]
public string RuleUnit { get; set; }
/// <summary>
/// 法定第一计量单位
/// </summary>
[SugarColumn(ColumnDescription = "法定第一计量单位", Length = 50)]
public string RuleUnit1 { get; set; }
/// <summary>
/// 法定第二计量单位
/// </summary>
[SugarColumn(ColumnDescription = "法定第二计量单位", Length = 50)]
public string RuleUnit2 { get; set; }
/// <summary>
/// 状态 0启用 1禁用
/// </summary>
[SugarColumn(ColumnDescription = "状态",DefaultValue = "0")]
public StatusEnum? Status { get; set; } = StatusEnum.Enable;
}

@ -0,0 +1,39 @@
using DS.Module.Core;
using DS.Module.Core.Data;
using SqlSugar;
namespace DS.WMS.Core.Code.Entity;
/// <summary>
/// 商品类型表
/// </summary>
[SqlSugar.SugarTable("op_code_goods_type","商品类型表")]
public class CodeGoodsType: BaseModel<long>
{
/// <summary>
/// 类型代码
/// </summary>
[SugarColumn(ColumnDescription = "类型代码", Length = 20)]
public string GoodsTypeCode { get; set; }
/// <summary>
/// 货物类型
/// </summary>
[SugarColumn(ColumnDescription = "货物类型", Length = 50)]
public string GoodsTypeName { get; set; }
/// <summary>
/// 英文名称
/// </summary>
[SugarColumn(ColumnDescription = "英文名称", Length = 10)]
public string EnName { get; set; }
/// <summary>
/// 描述
/// </summary>
[SugarColumn(ColumnDescription = "描述", Length = 200)]
public string Description { get; set; }
/// <summary>
/// 状态 0启用 1禁用
/// </summary>
[SugarColumn(ColumnDescription = "状态",DefaultValue = "0")]
public StatusEnum? Status { get; set; } = StatusEnum.Enable;
}

@ -20,6 +20,10 @@
<PackageReference Include="Mapster" Version="7.3.0" />
</ItemGroup>
<ItemGroup>
<Folder Include="BaseInfo\Dtos\" />
<Folder Include="BaseInfo\Entity\" />
<Folder Include="BaseInfo\Interface\" />
<Folder Include="BaseInfo\Method\" />
<Folder Include="Code\Dtos\" />
<Folder Include="Code\Interface\" />
<Folder Include="Code\Method\" />

@ -37,7 +37,10 @@ public class FlowTemplateReq
/// 排序
/// </summary>
public int? OrderNo { get; set; } = 100;
/// <summary>
/// 状态 0 启用 1 禁用
/// </summary>
public StatusEnum? Status { get; set; } = StatusEnum.Enable;
/// <summary>
/// 备注
/// </summary>

@ -11,6 +11,7 @@ public class FlowTemplateRes
/// 主键Id
/// </summary>
public long Id { get; set; }
/// <summary>
/// 模板名称
/// </summary>
@ -27,6 +28,7 @@ public class FlowTemplateRes
/// 模块名称
/// </summary>
public string PermissionName { get; set; }
/// <summary>
///中文视图名;设计打印方案时,提供中文快捷按钮的视图来源
/// </summary>
@ -47,6 +49,10 @@ public class FlowTemplateRes
/// </summary>
public StatusEnum? Status { get; set; } = StatusEnum.Enable;
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
/// <summary>
/// 备注

@ -34,6 +34,13 @@ public interface IClientFlowTemplateService
/// <returns></returns>
DataResult ImportFlowTemplate(string id);
/// <summary>
/// 删除模板
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
DataResult DelFlowTemplate(string id);
/// <summary>
/// 获取模板列表
/// </summary>

@ -49,17 +49,7 @@ public class ClientFlowTemplateService : IClientFlowTemplateService
{
if (req.Id == 0)
{
var isExist = db.Queryable<FlowTemplateTenant>().Where(x => x.Name == req.Name).First();
if (isExist != null)
{
return DataResult.Failed("流程模板名称已存在!");
}
var data = req.Adapt<FlowTemplateTenant>();
var entity = db.Insertable(data).ExecuteReturnEntity();
return DataResult.Successed("添加成功!", entity.Id);
return DataResult.Failed("非法请求!",MultiLanguageConst.IllegalRequest);
}
else
{
@ -68,7 +58,7 @@ public class ClientFlowTemplateService : IClientFlowTemplateService
info = req.Adapt(info);
db.Updateable(info).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand();
return DataResult.Successed("更新成功!");
return DataResult.Successed("更新成功!",MultiLanguageConst.DataUpdateSuccess);
}
}
@ -78,7 +68,7 @@ public class ClientFlowTemplateService : IClientFlowTemplateService
.Where(a => a.Id == long.Parse(id))
.Select<FlowTemplateRes>()
.First();
return DataResult<FlowTemplateRes>.Success(data);
return DataResult<FlowTemplateRes>.Success(data,MultiLanguageConst.DataQuerySuccess);
}
public DataResult ImportFlowTemplate(string id)
@ -86,20 +76,38 @@ public class ClientFlowTemplateService : IClientFlowTemplateService
var info = db.Queryable<FlowTemplate>().Where(x => x.Id == long.Parse(id)).First();
if (info == null)
{
return DataResult.Failed("流程模板不存在!");
return DataResult.Failed("流程模板不存在!",MultiLanguageConst.FlowTemplateImportNotExist);
}
var data = info.Adapt<FlowTemplateTenant>();
db.Insertable(info).ExecuteCommand();
return DataResult.Successed("引入成功!");
data.Id = 0;
db.Insertable(data).ExecuteCommand();
return DataResult.Successed("引入成功!",MultiLanguageConst.DataImportSuccess);
}
public DataResult DelFlowTemplate(string id)
{
var info = db.Queryable<FlowTemplateTenant>().Where(x => x.Id == long.Parse(id)).First();
if (info == null)
{
return DataResult.Failed("流程模板不存在!",MultiLanguageConst.FlowTemplateNotExist);
}
if (db.Queryable<FlowInstance>().Where(x=>x.TemplateId == long.Parse(id)).Any())
{
return DataResult.Failed("工作流实例存在引用的流程模板不能删除!",MultiLanguageConst.FlowTemplateDelExistImport);
}
db.Deleteable(info).ExecuteCommand();
return DataResult.Successed("删除成功!",MultiLanguageConst.DataDelSuccess);
}
public DataResult<List<FlowTemplateRes>> GetFlowTemplateList(PageRequest request)
{
//序列化查询条件
var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
var data = db.Queryable<FlowTemplate>()
// .LeftJoin<SysPermission>((a, b) => a.PermissionId == b.Id)
var data = db.Queryable<FlowTemplate>().Where(a=>a.Status == StatusEnum.Enable)
.LeftJoin<SysPermission>((a, b) => a.PermissionId == b.Id)
.Select<FlowTemplateRes>()
.Where(whereList).ToQueryPage(request.PageCondition);
return data;

@ -182,7 +182,7 @@ public class FlowInstanceService : IFlowInstanceService
instance.ActivityType = wfruntime.GetNodeType(startNodeId);
instance.ActivityName = wfruntime.ChildNodes.First(x => x.Id == startNodeId).Name;
instance.MakerList =
(wfruntime.GetNextNodeType() != 4 ? GetCurrentMakers(wfruntime) : "");
(wfruntime.GetNextNodeType() != 4 ? GetCurrentMakers(wfruntime) : "1");
instance.FlowStatus = FlowStatusEnum.Draft.ToEnumInt();
wfruntime.FlowInstanceId = instance.Id;
@ -243,7 +243,7 @@ public class FlowInstanceService : IFlowInstanceService
instance.ActivityName = wfruntime.NextNode.Name;
instance.PreviousId = wfruntime.CurrentNodeId;
instance.MakerList =
(wfruntime.GetNextNodeType() != 4 ? GetNextMakers(wfruntime) : "");
(wfruntime.GetNextNodeType() != 4 ? GetNextMakers(wfruntime) : "1");
instance.FlowStatus = (wfruntime.GetNextNodeType() == 4
? FlowStatusEnum.Approve.ToEnumInt()
: FlowStatusEnum.Running.ToEnumInt());
@ -318,7 +318,7 @@ public class FlowInstanceService : IFlowInstanceService
? FlowStatusEnum.Approve.ToEnumInt()
: FlowStatusEnum.Running.ToEnumInt());
instance.MakerList =
(wfruntime.NextNodeType == 4 ? "" : GetNextMakers(wfruntime));
(wfruntime.NextNodeType == 4 ? "1" : GetNextMakers(wfruntime));
// AddTransHistory(wfruntime);
}
@ -343,7 +343,7 @@ public class FlowInstanceService : IFlowInstanceService
instance.ActivityId = wfruntime.NextNodeId;
instance.ActivityType = wfruntime.NextNodeType;
instance.ActivityName = wfruntime.NextNode.Name;
instance.MakerList = wfruntime.NextNodeType == 4 ? "" : GetNextMakers(wfruntime);
instance.MakerList = wfruntime.NextNodeType == 4 ? "1" : GetNextMakers(wfruntime);
instance.FlowStatus = (wfruntime.NextNodeType == 4
? FlowStatusEnum.Approve.ToEnumInt()
: FlowStatusEnum.Running.ToEnumInt());

@ -245,7 +245,7 @@ public class FlowRuntimeService
(WhereType.And,
new ConditionalModel
{
FieldName = item.Field, ConditionalType = ConditionalType.Equal,
FieldName = item.Field, ConditionalType = GetConditionalType(item.Operator),
FieldValue = item.Value
})
);
@ -272,7 +272,7 @@ public class FlowRuntimeService
(WhereType.And,
new ConditionalModel
{
FieldName = item1.Field, ConditionalType = ConditionalType.Equal,
FieldName = item1.Field, ConditionalType = GetConditionalType(item1.Operator),
FieldValue = item1.Value
})
);
@ -286,7 +286,7 @@ public class FlowRuntimeService
(WhereType.Or,
new ConditionalModel
{
FieldName = item1.Field, ConditionalType = ConditionalType.Equal,
FieldName = item1.Field, ConditionalType = GetConditionalType(item1.Operator),
FieldValue = item1.Value
})
);
@ -313,7 +313,7 @@ public class FlowRuntimeService
(WhereType.Or,
new ConditionalModel
{
FieldName = item.Field, ConditionalType = ConditionalType.Equal,
FieldName = item.Field, ConditionalType = GetConditionalType(item.Operator),
FieldValue = item.Value
})
);
@ -340,7 +340,7 @@ public class FlowRuntimeService
(WhereType.And,
new ConditionalModel
{
FieldName = item1.Field, ConditionalType = ConditionalType.Equal,
FieldName = item1.Field, ConditionalType = GetConditionalType(item1.Operator),
FieldValue = item1.Value
})
);
@ -354,7 +354,7 @@ public class FlowRuntimeService
(WhereType.Or,
new ConditionalModel
{
FieldName = item1.Field, ConditionalType = ConditionalType.Equal,
FieldName = item1.Field, ConditionalType = GetConditionalType(item1.Operator),
FieldValue = item1.Value
})
);
@ -373,10 +373,6 @@ public class FlowRuntimeService
}
}
var entity = EntityUtil.getEntity(ColumnView);
var temp = db.EntityMaintenance.GetEntityInfo(entity);
// var table = ColumnView
var conditionalModels =
db.ConfigQuery.Context.Utilities.JsonToConditionalModels(
JsonConvert.SerializeObject(conditionalCollections));
@ -505,7 +501,44 @@ public class FlowRuntimeService
return -1;
}
/// <summary>
/// 转换SqlSugar 条件操作符
/// </summary>
/// <param name="conditionalType"></param>
/// <returns></returns>
private static ConditionalType GetConditionalType(string conditionalType)
{
switch (conditionalType)
{
//等于
case "equal":
return ConditionalType.Equal;
//不等于
case "not_equal":
return ConditionalType.NoEqual;
//大于
case "GreaterThan":
return ConditionalType.GreaterThan;
//大于等于
case "GreaterThanOrEqual":
return ConditionalType.GreaterThanOrEqual;
//小于
case "LessThan":
return ConditionalType.LessThan;
//小于等于
case "LessThanOrEqual":
return ConditionalType.GreaterThanOrEqual;
//包含
case "contains":
return ConditionalType.In;
//不包含
case "not_contain":
return ConditionalType.NotIn;
//默认
default:
return ConditionalType.Equal;
}
}
/// <summary>
/// 获取节点类型 0会签开始,1会签结束,2一般节点,3开始节点,4流程运行结束
/// </summary>

@ -0,0 +1,22 @@
namespace DS.WMS.Core.System.Dtos;
/// <summary>
/// 客户权限返回
/// </summary>
public class ClientPermissionRes
{
/// <summary>
/// 主键Id
/// </summary>
public long Id { get; set; }
/// <summary>
/// 权限名称
/// </summary>
public string PermissionName { get; set; }
/// <summary>
/// 权限实体
/// </summary>
public string PermissionEntity { get; set; }
}

@ -0,0 +1,66 @@
using DS.Module.Core;
using FluentValidation;
namespace DS.WMS.Core.System.Dtos;
/// <summary>
/// 数据权限请求实体
/// </summary>
public class DataRuleReq
{
/// <summary>
/// 主键Id
/// </summary>
public long Id { get; set; }
/// <summary>
/// 资源标识权限ID
/// </summary>
public long PermissionId { get; set; }
/// <summary>
/// 中文视图名
/// </summary>
public string ColumnView { get; set; }
/// <summary>
/// 权限规则
/// </summary>
public string DataRules { get; set; }
/// <summary>
/// 权限实体
/// </summary>
public string PermissionEntity { get; set; }
/// <summary>
/// 数据权限描述
/// </summary>
public string Description { get; set; }
/// <summary>
/// 排序
/// </summary>
public int? OrderNo { get; set; } = 100;
/// <summary>
/// 状态 0 启用 1 禁用
/// </summary>
public StatusEnum? Status { get; set; } = StatusEnum.Enable;
/// <summary>
/// 备注
/// </summary>
public string Note { get; set; } = "";
}
/// <summary>
/// 验证
/// </summary>
public class DataRuleReqValidator : AbstractValidator<DataRuleReq>
{
/// <summary>
/// 构造函数
/// </summary>
public DataRuleReqValidator()
{
this.RuleFor(o => o.PermissionId)
.NotEmpty().WithName("权限模块Id");
this.RuleFor(o => o.ColumnView)
.NotEmpty().WithName("中文视图名");
}
}

@ -0,0 +1,58 @@
using DS.Module.Core;
namespace DS.WMS.Core.System.Dtos;
/// <summary>
/// 数据权限返回实体
/// </summary>
public class DataRuleRes
{
/// <summary>
/// 主键Id
/// </summary>
public long Id { get; set; }
/// <summary>
/// 资源标识权限ID
/// </summary>
public long PermissionId { get; set; }
/// <summary>
/// 中文视图名
/// </summary>
public string ColumnView { get; set; }
/// <summary>
/// 权限模块名称
/// </summary>
public string PermissionName { get; set; }
/// <summary>
/// 权限实体
/// </summary>
public string PermissionEntity { get; set; }
/// <summary>
/// 权限规则
/// </summary>
public string DataRules { get; set; }
/// <summary>
/// 数据权限描述
/// </summary>
public string Description { get; set; }
/// <summary>
/// 状态 0 启用 1 禁用
/// </summary>
public StatusEnum? Status { get; set; } = StatusEnum.Enable;
/// <summary>
/// 备注
/// </summary>
public string Note { get; set; } = "";
/// <summary>
/// 排序
/// </summary>
public int? OrderNo { get; set; } = 100;
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
}

@ -0,0 +1,59 @@
using DS.Module.Core;
using FluentValidation;
namespace DS.WMS.Core.System.Dtos;
/// <summary>
/// 字典值请求实体
/// </summary>
public class DictDataReq
{
/// <summary>
/// 主键Id
/// </summary>
public long Id { get; set; }
/// <summary>
/// 字典类型Id
/// </summary>
public long TypeId { get; set; }
/// <summary>
/// 字典值编码
/// </summary>
public string Code { get; set; }
/// <summary>
/// 字典值
/// </summary>
public string Value { get; set; }
/// <summary>
/// 排序
/// </summary>
public int? OrderNo { get; set; } = 100;
/// <summary>
/// 状态 0 启用 1 禁用
/// </summary>
public StatusEnum? Status { get; set; } = StatusEnum.Enable;
/// <summary>
/// 备注
/// </summary>
public string Note { get; set; } = "";
}
/// <summary>
/// 验证
/// </summary>
public class DictDataReqValidator : AbstractValidator<DictDataReq>
{
/// <summary>
/// 构造函数
/// </summary>
public DictDataReqValidator()
{
this.RuleFor(o => o.Value)
.NotEmpty().WithName("字典值");
this.RuleFor(o => o.Code)
.NotEmpty().WithName("字典值编码");
}
}

@ -0,0 +1,45 @@
using DS.Module.Core;
namespace DS.WMS.Core.System.Dtos;
/// <summary>
/// 字典值返回
/// </summary>
public class DictDataRes
{
/// <summary>
/// 主键Id
/// </summary>
public long Id { get; set; }
/// <summary>
/// 字典类型Id
/// </summary>
public long TypeId { get; set; }
/// <summary>
/// 字典值编码
/// </summary>
public string Code { get; set; }
/// <summary>
/// 字典值
/// </summary>
public string Value { get; set; }
/// <summary>
/// 排序
/// </summary>
public int? OrderNo { get; set; } = 100;
/// <summary>
/// 状态 0 启用 1 禁用
/// </summary>
public StatusEnum? Status { get; set; } = StatusEnum.Enable;
/// <summary>
/// 备注
/// </summary>
public string Note { get; set; } = "";
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
}

@ -0,0 +1,54 @@
using DS.Module.Core;
using FluentValidation;
namespace DS.WMS.Core.System.Dtos;
/// <summary>
/// 字典类型请求实体
/// </summary>
public class DictTypeReq
{
/// <summary>
/// 主键Id
/// </summary>
public long Id { get; set; }
/// <summary>
/// 唯一编码
/// </summary>
public string Code { get; set; }
/// <summary>
/// 字典类型名称
/// </summary>
public string Name { get; set; }
/// <summary>
/// 排序
/// </summary>
public int? OrderNo { get; set; } = 100;
/// <summary>
/// 状态 0 启用 1 禁用
/// </summary>
public StatusEnum? Status { get; set; } = StatusEnum.Enable;
/// <summary>
/// 备注
/// </summary>
public string Note { get; set; } = "";
}
/// <summary>
/// 验证
/// </summary>
public class DictTypeReqValidator : AbstractValidator<DictTypeReq>
{
/// <summary>
/// 构造函数
/// </summary>
public DictTypeReqValidator()
{
this.RuleFor(o => o.Name)
.NotEmpty().WithName("字典类型名称");
this.RuleFor(o => o.Code)
.NotEmpty().WithName("字典类型唯一编码");
}
}

@ -0,0 +1,40 @@
using DS.Module.Core;
namespace DS.WMS.Core.System.Dtos;
/// <summary>
/// 字典类型返回
/// </summary>
public class DictTypeRes
{
/// <summary>
/// 主键Id
/// </summary>
public long Id { get; set; }
/// <summary>
/// 唯一编码
/// </summary>
public string Code { get; set; }
/// <summary>
/// 字典类型名称
/// </summary>
public string Name { get; set; }
/// <summary>
/// 排序
/// </summary>
public int? OrderNo { get; set; } = 100;
/// <summary>
/// 备注
/// </summary>
public string Note { get; set; } = "";
/// <summary>
/// 状态 0 启用 1 禁用
/// </summary>
public StatusEnum? Status { get; set; } = StatusEnum.Enable;
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
}

@ -20,7 +20,7 @@ public class SysOrgRes
/// </summary>
public string OrgName { get; set; }
/// <summary>
/// <summary/>
/// Desc:负责人
/// Default:
/// Nullable:True
@ -36,7 +36,10 @@ public class SysOrgRes
/// </summary>
public int? OrderNo { get; set; } = 100;
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
/// <summary>
/// 是否部门标识
/// </summary>

@ -1,25 +1,29 @@
using DS.Module.Core;
using DS.Module.Core.Data;
namespace DS.WMS.Core.System.Entity;
[SqlSugar.SugarTable("sys_datarule")]
public class SysDataRule : BaseModel<string>
[SqlSugar.SugarTable("sys_data_rule")]
public class SysDataRule : BaseTenantModel<long>
{
/// <summary>
/// 资源标识权限ID
/// </summary>
public string PermissionId { get; set; }
public long PermissionId { get; set; }
/// <summary>
/// 模块名称
/// 权限实体
/// </summary>
public string PermissionName { get; set; }
public string PermissionEntity { get; set; }
/// <summary>
/// 是否可用
/// 状态
/// </summary>
public string Enable { get; set; }
[SqlSugar.SugarColumn(ColumnDescription = "状态")]
public StatusEnum? Status { get; set; } = StatusEnum.Enable;
/// <summary>
/// 中文视图名
/// </summary>
public string ColumnView { get; set; }
/// <summary>
/// 权限规则
/// </summary>
@ -33,5 +37,5 @@ public class SysDataRule : BaseModel<string>
/// <summary>
/// 排序号
/// </summary>
public string SortNo { get; set; }
public string OrderNo { get; set; }
}

@ -0,0 +1,41 @@
using DS.Module.Core;
using DS.Module.Core.Data;
namespace DS.WMS.Core.System.Entity;
/// <summary>
/// 系统字典值表
/// </summary>
[SqlSugar.SugarTable("sys_dict_data")]
public class SysDictData : BaseModel<long>
{
/// <summary>
/// 字典类型Id
/// </summary>
public long TypeId { get; set; }
/// <summary>
/// 字典值
/// </summary>
[SqlSugar.SugarColumn(Length = 100,ColumnDescription="名称")]
public string Value { get; set; }
/// <summary>
/// 字典值编码
/// </summary>
[SqlSugar.SugarColumn(Length = 50,ColumnDescription="编码")]
public string Code { get; set; }
/// <summary>
/// 排序
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "排序")]
public int? OrderNo { get; set; } = 100;
/// <summary>
/// 状态
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "状态")]
public StatusEnum? Status { get; set; } = StatusEnum.Enable;
}

@ -0,0 +1,38 @@
using DS.Module.Core;
using DS.Module.Core.Data;
namespace DS.WMS.Core.System.Entity;
/// <summary>
/// 系统字典类型表
/// </summary>
[SqlSugar.SugarTable("sys_dict_type")]
public class SysDictType : BaseModel<long>
{
/// <summary>
/// 名称
/// </summary>
[SqlSugar.SugarColumn(Length = 100,ColumnDescription="名称")]
public string Name { get; set; }
/// <summary>
/// 编码
/// </summary>
[SqlSugar.SugarColumn(Length = 50,ColumnDescription="编码")]
public string Code { get; set; }
/// <summary>
/// 排序
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "排序")]
public int? OrderNo { get; set; } = 100;
/// <summary>
/// 状态
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "状态")]
public StatusEnum? Status { get; set; } = StatusEnum.Enable;
}

@ -118,7 +118,7 @@ public class SysPermission : BaseModel<long>
#endregion 拓展字段
/// <summary>
///权限实体
/// 权限实体
/// </summary>
public string PermissionEntity { get; set; }
}

@ -89,6 +89,11 @@ public interface ICommonService
/// <returns></returns>
DataResult<List<ApiSelectViewModel>> GetOrgList();
/// <summary>
/// 获取客户数据权限列表
/// </summary>
/// <returns></returns>
public DataResult<List<ClientPermissionRes>> GetClientPermissionList();
/// <summary>
/// 修改密码
/// </summary>

@ -1,9 +1,30 @@
using DS.Module.Core;
using DS.WMS.Core.System.Dtos;
using DS.WMS.Core.System.Entity;
namespace DS.WMS.Core.System.Interface;
public interface IDataRuleService
{
DataResult<List<SysDataRule>> GetListByPage(PageRequest request);
/// <summary>
/// 列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
DataResult<List<DataRuleRes>> GetListByPage(PageRequest request);
/// <summary>
/// 编辑
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
DataResult EditDataRule(DataRuleReq model);
/// <summary>
/// 获取详情
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
DataResult<DataRuleRes> GetDataRuleInfo(string id);
}

@ -0,0 +1,27 @@
using DS.Module.Core;
using DS.WMS.Core.System.Dtos;
namespace DS.WMS.Core.System.Interface;
public interface ISysDictDataService
{
/// <summary>
/// 列表查询
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
DataResult<List<DictDataRes>> GetListByPage(PageRequest request);
/// <summary>
/// 添加字典值
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
DataResult EditDictData(DictDataReq model);
/// <summary>
/// 获取详情
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
DataResult<DictDataRes> GetDictDataInfo(string id);
}

@ -0,0 +1,27 @@
using DS.Module.Core;
using DS.WMS.Core.System.Dtos;
namespace DS.WMS.Core.System.Interface;
public interface ISysDictTypeService
{
/// <summary>
/// 列表查询
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
DataResult<List<DictTypeRes>> GetListByPage(PageRequest request);
/// <summary>
/// 添加字典类型
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
DataResult EditDictType(DictTypeReq model);
/// <summary>
/// 获取详情
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
DataResult<DictTypeRes> GetDictTypeInfo(string id);
}

@ -55,4 +55,10 @@ public interface ISysRoleService
/// <param name="model"></param>
/// <returns></returns>
DataResult UpdateRolePermission(RolePermissionInput model);
/// <summary>
/// 更新角色权限-客户端
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public DataResult UpdateClientRolePermission(RolePermissionInput model);
}

@ -1,6 +1,8 @@
using DS.Module.Core;
using DS.Module.Core.Data;
using DS.WMS.Core.System.Dtos;
using DS.WMS.Core.System.Entity;
using SqlSugar;
namespace DS.WMS.Core.System.Interface;
@ -39,4 +41,18 @@ public interface ITenantService
/// <param name="req"></param>
/// <returns></returns>
public DataResult UpdateTenantPermission(TenantPermissionReq req);
/// <summary>
/// 获取租户表差异
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public DataResult<TableDifferenceProvider> GetSaasTableDifference(string id);
/// <summary>
/// 更新租户表差异
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
public DataResult UpdateSaasTableInfo(IdModel req);
}

@ -603,8 +603,10 @@ public class CommonService : ICommonService
foreach (var item in list)
{
var childs = db.Queryable<SysPermissionTenant>().Where(x =>
x.MenuType == 2 && x.ParentId == item.ParentId && x.IsHidden == false && permissions.Contains(x.PermissionId) &&
(x.PermissionType == 1 || x.PermissionType == 0))
x.MenuType == 2 && x.ParentId == item.ParentId && x.IsHidden == false &&
permissions.Contains(x.PermissionId) &&
(x.PermissionType == 1 || x.PermissionType == 0) &&
x.PermissionId != 1744968217220222976) //排除企业用户维护
.OrderBy(x => x.SortCode)
.Select(a => new RouteItem
{
@ -781,6 +783,26 @@ public class CommonService : ICommonService
#endregion 获取机构下拉列表
#region 获取客户数据权限列表
/// <summary>
/// 获取客户数据权限列表
/// </summary>
/// <returns></returns>
public DataResult<List<ClientPermissionRes>> GetClientPermissionList()
{
var list = db.Queryable<SysPermission>().Where(x => x.MenuType == 2 && x.IsHidden == false &&
(x.PermissionType == 1 || x.PermissionType == 0) &&
x.Id != 1744968217220222976 &&
(x.PermissionEntity != "" || x.PermissionEntity != null))
.Select<ClientPermissionRes>()
.ToList();
return DataResult<List<ClientPermissionRes>>.Success("获取数据成功!", list);
}
#endregion
#region 修改密码
/// <summary>
@ -954,41 +976,39 @@ public class CommonService : ICommonService
return db.Queryable<T>(); //超级管理员特权
}
var moduleName = typeof(T).Name;
var rule = db.Queryable<SysDataRule>().First(u => u.PermissionName == moduleName);
var moduleName = typeof(T).Name.ToLower();
var rule = db.Queryable<SysDataRule>()
.First(u => u.PermissionEntity.ToLower() == moduleName && u.Status == StatusEnum.Enable);
if (rule == null) return db.Queryable<T>(); //没有设置数据规则,那么视为该资源允许被任何主体查看
var ruleConditions = JsonConvert.DeserializeObject<DataRuleJson>(rule.DataRules);
if (ruleConditions.RoleCondition.Count > 0)
if (rule.DataRules.Contains(DataRuleConst.LoginUser))
{
var roles = db.Queryable<SysRoleUser>().Where(x => x.UserId == long.Parse(user.UserId))
.Select(u => u.RoleId.ToString()).ToList();
roles.Sort(); //按字母排序,这样可以进行like操作
var ruleCondition = ruleConditions.RoleCondition[0];
if (ruleCondition.ConditionalType == SqlSugar.ConditionalType.In)
{
var s = ruleCondition.FieldValue.Split(',');
var intersectArr = roles.Intersect(s);
if (intersectArr.Count() == 0)
{
throw new Exception("该用户角色无权限!");
}
}
//即把{loginUser} =='xxxxxxx'换为 user.UserId =='xxxxxxx'从而把当前登录的用户名与当时设计规则时选定的用户id对比
rule.DataRules = rule.DataRules.Replace(DataRuleConst.LoginUser, user.UserId);
}
if (ruleConditions.QueryCondition.Count > 0)
if (rule.DataRules.Contains(DataRuleConst.LoginRole))
{
return db.Queryable<T>()
.Where(ruleConditions.QueryCondition);
var roles = db.Queryable<SysRoleUser>().Where(x => x.UserId == long.Parse(user.UserId))
.Select(n => n.RoleId)
.ToList();
roles.Sort();
rule.DataRules = rule.DataRules.Replace(DataRuleConst.LoginRole, string.Join(',', roles));
}
else
if (rule.DataRules.Contains(DataRuleConst.LoginOrg))
{
return db.Queryable<T>();
var orgs = db.Queryable<SysOrgUser>().Where(x => x.UserId == long.Parse(user.UserId)).Select(n => n.OrgId)
.ToList();
orgs.Sort();
rule.DataRules = rule.DataRules.Replace(DataRuleConst.LoginOrg, string.Join(',', orgs));
}
var conditions = rule.DataRules.ConvertSqlSugarExpression();
var conditionalModels =
db.ConfigQuery.Context.Utilities.JsonToConditionalModels(
JsonConvert.SerializeObject(conditions));
return db.Queryable<T>().Where(conditionalModels);
}

@ -1,8 +1,10 @@
using DS.Module.Core;
using DS.Module.Core.Extensions;
using DS.Module.UserModule;
using DS.WMS.Core.System.Dtos;
using DS.WMS.Core.System.Entity;
using DS.WMS.Core.System.Interface;
using Mapster;
using Microsoft.Extensions.DependencyInjection;
using SqlSugar;
@ -26,16 +28,63 @@ public class DataRuleService : IDataRuleService
}
/// <summary>
///
/// 列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public DataResult<List<SysDataRule>> GetListByPage(PageRequest request)
public DataResult<List<DataRuleRes>> GetListByPage(PageRequest request)
{
//序列化查询条件
var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
var data = db.Queryable<SysDataRule>()
.Where(whereList).ToQueryPage(request.PageCondition);
.LeftJoin<SysPermission>((a, b) => a.PermissionId == b.Id)
.Where(whereList)
.Select<DataRuleRes>().ToQueryPage(request.PageCondition);
return data;
}
/// <summary>
/// 编辑
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
public DataResult EditDataRule(DataRuleReq req)
{
if (req.Id == 0)
{
if (db.Queryable<SysDataRule>().Where(x=>x.PermissionId == req.PermissionId).Any())
{
return DataResult.Failed("数据权限已存在!",MultiLanguageConst.DataRuleExist);
}
var data = req.Adapt<SysDataRule>();
var entity = db.Insertable(data).ExecuteReturnEntity();
return DataResult.Successed("添加成功!", entity.Id,MultiLanguageConst.DataCreateSuccess);
}
else
{
var info = db.Queryable<SysDataRule>().Where(x => x.Id == req.Id).First();
info = req.Adapt(info);
db.Updateable(info).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand();
return DataResult.Successed("更新成功!",MultiLanguageConst.DataUpdateSuccess);
}
}
/// <summary>
/// 详情
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public DataResult<DataRuleRes> GetDataRuleInfo(string id)
{
var data = db.Queryable<SysDataRule>()
.LeftJoin<SysPermission>((a, b) => a.PermissionId == b.Id)
.Where(a => a.Id == long.Parse(id))
.Select<DataRuleRes>()
.First();
return DataResult<DataRuleRes>.Success(data,MultiLanguageConst.DataQuerySuccess);
}
}

@ -0,0 +1,75 @@
using DS.Module.Core;
using DS.Module.Core.Extensions;
using DS.Module.UserModule;
using DS.WMS.Core.System.Dtos;
using DS.WMS.Core.System.Entity;
using DS.WMS.Core.System.Interface;
using Mapster;
using Microsoft.Extensions.DependencyInjection;
using SqlSugar;
namespace DS.WMS.Core.System.Method;
public class SysDictDataService:ISysDictDataService
{
private readonly IServiceProvider _serviceProvider;
private readonly ISqlSugarClient db;
private readonly IUser user;
private readonly ICommonService _commonService;
/// <summary>
///
/// </summary>
/// <param name="serviceProvider"></param>
public SysDictDataService(IServiceProvider serviceProvider)
{
_serviceProvider = serviceProvider;
db = _serviceProvider.GetRequiredService<ISqlSugarClient>();
user = _serviceProvider.GetRequiredService<IUser>();
_commonService = _serviceProvider.GetRequiredService<ICommonService>();
}
public DataResult<List<DictDataRes>> GetListByPage(PageRequest request)
{
//序列化查询条件
var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
var data = db.Queryable<SysDictData>()
.Select<DictDataRes>()
.Where(whereList).ToQueryPage(request.PageCondition);
return data;
}
public DataResult EditDictData(DictDataReq req)
{
if (req.Id == 0)
{
var isExist = db.Queryable<SysDictData>().Where(x =>x.TypeId == req.TypeId && x.Code == req.Code).First();
if (isExist != null)
{
return DataResult.Failed("字典值唯一编码已存在!",MultiLanguageConst.DictCodeExist);
}
var data = req.Adapt<SysDictData>();
var entity = db.Insertable(data).ExecuteReturnEntity();
return DataResult.Successed("添加成功!", entity.Id,MultiLanguageConst.DataCreateSuccess);
}
else
{
var info = db.Queryable<SysDictData>().Where(x => x.Id == req.Id).First();
info = req.Adapt(info);
db.Updateable(info).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand();
return DataResult.Successed("更新成功!",MultiLanguageConst.DataUpdateSuccess);
}
}
public DataResult<DictDataRes> GetDictDataInfo(string id)
{
var data = db.Queryable<SysDictData>()
.Where(a => a.Id == long.Parse(id))
.Select<DictDataRes>()
.First();
return DataResult<DictDataRes>.Success(data,MultiLanguageConst.DataQuerySuccess);
}
}

@ -0,0 +1,78 @@
using DS.Module.Core;
using DS.Module.Core.Extensions;
using DS.Module.UserModule;
using DS.WMS.Core.System.Dtos;
using DS.WMS.Core.System.Entity;
using DS.WMS.Core.System.Interface;
using Mapster;
using Microsoft.Extensions.DependencyInjection;
using SqlSugar;
namespace DS.WMS.Core.System.Method;
/// <summary>
///
/// </summary>
public class SysDictTypeService:ISysDictTypeService
{
private readonly IServiceProvider _serviceProvider;
private readonly ISqlSugarClient db;
private readonly IUser user;
private readonly ICommonService _commonService;
/// <summary>
///
/// </summary>
/// <param name="serviceProvider"></param>
public SysDictTypeService(IServiceProvider serviceProvider)
{
_serviceProvider = serviceProvider;
db = _serviceProvider.GetRequiredService<ISqlSugarClient>();
user = _serviceProvider.GetRequiredService<IUser>();
_commonService = _serviceProvider.GetRequiredService<ICommonService>();
}
public DataResult<List<DictTypeRes>> GetListByPage(PageRequest request)
{
//序列化查询条件
var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
var data = db.Queryable<SysDictType>()
.Select<DictTypeRes>()
.Where(whereList).ToQueryPage(request.PageCondition);
return data;
}
public DataResult EditDictType(DictTypeReq req)
{
if (req.Id == 0)
{
var isExist = db.Queryable<SysDictType>().Where(x => x.Code == req.Code).First();
if (isExist != null)
{
return DataResult.Failed("字典类型唯一编码已存在!",MultiLanguageConst.DictCodeExist);
}
var data = req.Adapt<SysDictType>();
var entity = db.Insertable(data).ExecuteReturnEntity();
return DataResult.Successed("添加成功!", entity.Id,MultiLanguageConst.DataCreateSuccess);
}
else
{
var info = db.Queryable<SysDictType>().Where(x => x.Id == req.Id).First();
info = req.Adapt(info);
db.Updateable(info).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand();
return DataResult.Successed("更新成功!",MultiLanguageConst.DataUpdateSuccess);
}
}
public DataResult<DictTypeRes> GetDictTypeInfo(string id)
{
var data = db.Queryable<SysDictType>()
.Where(a => a.Id == long.Parse(id))
.Select<DictTypeRes>()
.First();
return DataResult<DictTypeRes>.Success(data,MultiLanguageConst.DataQuerySuccess);
}
}

@ -72,7 +72,7 @@ public class SysOrgService:ISysOrgService
}
}
/// <summary>
///
/// 获取机构信息
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
@ -98,7 +98,7 @@ public class SysOrgService:ISysOrgService
ParentId = a.ParentId
}).ToList();
var orgList = BulidTree(list);
var orgList = BuildTree(list);
return DataResult<List<OrgTree>>.Success("获取数据成功!", orgList);
}
@ -108,7 +108,7 @@ public class SysOrgService:ISysOrgService
/// </summary>
/// <param name="treeNodes"></param>
/// <returns></returns>
public static List<OrgTree> BulidTree(List<OrgTree> treeNodes)
public static List<OrgTree> BuildTree(List<OrgTree> treeNodes)
{
try
{

@ -1,5 +1,6 @@
using DS.Module.Core;
using DS.Module.Core.Extensions;
using DS.Module.Core.Helpers;
using DS.Module.UserModule;
using DS.WMS.Core.System.Dtos;
using DS.WMS.Core.System.Entity;
@ -245,4 +246,87 @@ public class SysRoleService : ISysRoleService
}
return DataResult.Successed("更新成功!",MultiLanguageConst.DataUpdateSuccess);
}
public DataResult UpdateClientRolePermission(RolePermissionInput model)
{
var existPermissions = db.Queryable<SysRolePermission>().Where(x => x.RoleId == model.RoleId && x.IsPermission == 1).Select(n => n.PermissionId).ToArray();
IEnumerable<long?> delPermissions = existPermissions.AsQueryable().Except(model.PermissionIds);
if (delPermissions.Count() > 0)
{
db.Updateable<SysRolePermission>()
.SetColumns(it => it.IsPermission == 0)//SetColumns是可以叠加的 写2个就2个字段赋值
.Where(it => it.RoleId == model.RoleId && delPermissions.Contains(it.PermissionId))
.ExecuteCommand();
}
IEnumerable<long?> addPermissions = model.PermissionIds.AsQueryable().Except(existPermissions);
if (addPermissions.Count() > 0)
{
var existNoPermissions = db.Queryable<SysRolePermission>().Where(x => x.RoleId == model.RoleId && x.IsPermission == 0).Select(n => n.PermissionId).ToArray();
IEnumerable<long?> updatePermissions = existNoPermissions.AsQueryable().Except(addPermissions);
if (updatePermissions.Count() > 0)
{
db.Updateable<SysRolePermission>()
.SetColumns(it => it.IsPermission == 1)
.Where(it => it.RoleId == model.RoleId && updatePermissions.Contains(it.PermissionId))
.ExecuteCommand();
}
IEnumerable<long?> addRolePermissions = addPermissions.AsQueryable().Except(existNoPermissions);
#region 租户模块权限检测
var tenant = db.Queryable<SysTenant>().Where(x=>x.Id ==long.Parse(user.TenantId)).First();
foreach (var item in addRolePermissions)
{
var per = db.Queryable<SysPermission>().Where(x => x.Id == item)
.First();
if (per.MenuType == 2)
{
var perAuth = db.Queryable<SysTenantPermissionAuth>().Where(x=>x.PermissionId == item).First();
if (perAuth.IsNotNull())
{
var authNum = EncrypteHelper.DecryptData(perAuth.AuthNum, tenant.AppSecret);
var roleList = db.Queryable<SysRolePermission>()
.Where(x => x.PermissionId == item && x.IsPermission == 1).Select(n => n.RoleId).ToList();
roleList.Add(model.RoleId);
roleList.Distinct();
var userList = new List<long?>();
foreach (var role in roleList)
{
var userArr = db.Queryable<SysRoleUser>().Where(x => x.RoleId == role).Select(n => n.UserId)
.ToList();
userList.AddRange(userArr);
}
userList.Distinct();
var userCount = userList.Count();
if (userCount>= int.Parse(authNum))
{
return DataResult.Failed(string.Format("{0}模块数量超出授权数量{1}",per.PermissionName, int.Parse(authNum)),MultiLanguageConst.PerAuthNumLimit);
}
}
}
}
#endregion
foreach (var item in addRolePermissions)
{
var permission = new SysRolePermission
{
RoleId = model.RoleId,
PermissionId = item,
IsPermission = 1,
};
db.Insertable(permission).ExecuteCommand();
}
}
return DataResult.Successed("更新成功!",MultiLanguageConst.DataUpdateSuccess);
}
}

@ -156,6 +156,7 @@ public class TenantApplyService : ITenantApplyService
foreach (var item in permissions)
{
var tenantPer = item.Adapt<SysPermissionTenant>();
tenantPer.Id = 0;
tenantPer.TenantId = tenant.Id;
tenantPer.PermissionId = item.Id;

@ -1,6 +1,9 @@
using System.Reflection;
using DS.Module.Core;
using DS.Module.Core.Data;
using DS.Module.Core.Extensions;
using DS.Module.Core.Helpers;
using DS.Module.SqlSugar;
using DS.WMS.Core.System.Dtos;
using DS.WMS.Core.System.Entity;
using DS.WMS.Core.System.Interface;
@ -17,7 +20,7 @@ public class TenantService : ITenantService
{
private readonly IServiceProvider _serviceProvider;
private readonly ISqlSugarClient db;
private readonly ISaasDbService saasService;
/// <summary>
///
/// </summary>
@ -26,6 +29,7 @@ public class TenantService : ITenantService
{
_serviceProvider = serviceProvider;
db = _serviceProvider.GetRequiredService<ISqlSugarClient>();
saasService = _serviceProvider.GetRequiredService<ISaasDbService>();
}
/// <summary>
@ -99,6 +103,24 @@ public class TenantService : ITenantService
{
var addPers = db.Queryable<SysPermission>().Filter(null, true)
.Where(x => addPermissions.Contains(x.Id)).ToList();
#region 处理租户管理员新增权限
var tenantRole = db.Queryable<SysRole>().Filter(null, true)
.Where(x => x.TenantId == req.TenantId && x.RoleCode == "tenantAdmin").First();
//写入租户管理员权限
var rolePerList = new List<SysRolePermission>();
foreach (var item in addPers)
{
var rolePer = item.Adapt<SysRolePermission>();
rolePer.RoleId = tenantRole.Id;
rolePer.PermissionId = item.Id;
rolePer.IsPermission = 1;
rolePerList.Add(rolePer);
}
db.Insertable(rolePerList).ExecuteCommandAsync();
#endregion 处理租户管理员新增权限
var tenantPerList = new List<SysPermissionTenant>();
foreach (var item in addPers)
{
@ -166,4 +188,36 @@ public class TenantService : ITenantService
return DataResult<List<PermissionAuth>>.Success("获取数据成功!", list, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
/// 获取租户表差异
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public DataResult<TableDifferenceProvider> GetSaasTableDifference(string id)
{
Type[] types= Assembly
.LoadFrom("DS.WMS.Core.dll")//如果 .dll报错可以换成 xxx.exe 有些生成的是exe
.GetTypes().Where(it=>it.FullName != null && it.FullName.Contains("DS.WMS.Core.Code."))//命名空间过滤,当然你也可以写其他条件过滤
.ToArray();
var tenantDb = saasService.GetBizDbById(id);
var data = db.CodeFirst.GetDifferenceTables(types);
return DataResult<TableDifferenceProvider>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess);
}
/// <summary>
/// 更新租户表差异
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
public DataResult UpdateSaasTableInfo(IdModel req)
{
Type[] types= Assembly
.LoadFrom("DS.WMS.Core.dll")//如果 .dll报错可以换成 xxx.exe 有些生成的是exe
.GetTypes().Where(it=>it.FullName != null && it.FullName.Contains("DS.WMS.Core.Code."))//命名空间过滤,当然你也可以写其他条件过滤
.ToArray();
var tenantDb = saasService.GetBizDbById(req.Id);
StaticConfig.CodeFirst_MySqlCollate="utf8mb4_0900_ai_ci";//较高版本支持
tenantDb.CodeFirst.InitTables(types);
return DataResult.Successed("更新租户表信息成功!", MultiLanguageConst.DataUpdateSuccess);
}
}

@ -58,7 +58,30 @@ public class ClientFlowTemplateController : ApiController
var res = _invokeService.GetClientFlowTemplateInfo(id);
return res;
}
/// <summary>
/// 导入模板
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpGet]
[Route("ImportFlowTemplate")]
public DataResult ImportFlowTemplate([FromQuery] string id)
{
var res = _invokeService.ImportFlowTemplate(id);
return res;
}
/// <summary>
/// 删除模板
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpGet]
[Route("DelFlowTemplate")]
public DataResult DelFlowTemplate([FromQuery] string id)
{
var res = _invokeService.DelFlowTemplate(id);
return res;
}
/// <summary>
/// 获取模板列表

@ -1,6 +1,7 @@
using DS.Module.Core;
using DS.Module.Core.Extensions;
using DS.WMS.Core.System.Dtos;
using DS.WMS.Core.System.Entity;
using DS.WMS.Core.System.Interface;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
@ -185,7 +186,17 @@ public class CommonController : ApiController
return res;
}
/// <summary>
/// 获取客户数据权限列表
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("GetClientPermissionList")]
public DataResult<List<ClientPermissionRes>> GetClientPermissionList()
{
var res = _invokeService.GetClientPermissionList();
return res;
}
/// <summary>
/// 获取数据库表及视图名
/// </summary>
@ -209,4 +220,31 @@ public class CommonController : ApiController
var res = _invokeService.GetColumns(tableViewName);
return res;
}
/// <summary>
/// 获取用户字段设置
/// </summary>
/// <param name="permissionId"></param>
/// <returns></returns>
[HttpGet]
[Route("GetUserFieldSet")]
public DataResult<SysUserFieldSet> GetUserFieldSet([FromQuery] string permissionId)
{
var res = _invokeService.GetUserFieldSet(permissionId);
return res;
}
/// <summary>
/// 更新用户字段设置
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
[HttpPost]
[Route("UpdateUserFieldSet")]
public DataResult UpdateUserFieldSet([FromBody] UserFieldSetUpdateReq req)
{
var res = _invokeService.UpdateUserFieldSet(req);
return res;
}
}

@ -0,0 +1,62 @@
using DS.Module.Core;
using DS.WMS.Core.System.Dtos;
using DS.WMS.Core.System.Interface;
using Microsoft.AspNetCore.Mvc;
namespace DS.WMS.MainApi.Controllers;
/// <summary>
/// 数据权限模块
/// </summary>
public class DataRuleController : ApiController
{
private readonly IDataRuleService _invokeService;
/// <summary>
/// 构造函数
/// </summary>
/// <param name="invokeService"></param>
public DataRuleController(IDataRuleService invokeService)
{
_invokeService = invokeService;
}
/// <summary>
/// 列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[HttpPost]
[Route("GetDataRuleList")]
public DataResult<List<DataRuleRes>> GetDataRuleList([FromBody] PageRequest request)
{
var res = _invokeService.GetListByPage(request);
return res;
}
/// <summary>
/// 编辑
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
[HttpPost]
[Route("EditDataRule")]
public DataResult EditDataRule([FromBody] DataRuleReq req)
{
var res = _invokeService.EditDataRule(req);
return res;
}
/// <summary>
/// 详情
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpGet]
[Route("GetDataRuleInfo")]
public DataResult<DataRuleRes> GetDataRuleInfo([FromQuery] string id)
{
var res = _invokeService.GetDataRuleInfo(id);
return res;
}
}

@ -87,15 +87,15 @@ public class RoleController : ApiController
}
/// <summary>
/// 更新角色权限
/// 更新角色权限-客户端
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
[Route("UpdateRolePermission")]
public DataResult UpdateRolePermission([FromBody] RolePermissionInput model)
[Route("UpdateClientRolePermission")]
public DataResult UpdateClientRolePermission([FromBody] RolePermissionInput model)
{
var res = _invokeService.UpdateRolePermission(model);
var res = _invokeService.UpdateClientRolePermission(model);
return res;
}
}

@ -138,3 +138,24 @@
2024-02-19 14:09:24.2207 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.MainApi\bin\Debug\net8.0\nlog.config
2024-02-19 14:09:24.2517 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-02-19 14:09:24.3040 Info Configuration initialized.
2024-02-20 09:40:59.5968 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-02-20 09:40:59.6794 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-02-20 09:40:59.7454 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-02-20 09:40:59.8286 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-02-20 09:40:59.9372 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.MainApi\bin\Debug\net8.0\nlog.config
2024-02-20 09:40:59.9923 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-02-20 09:41:00.1331 Info Configuration initialized.
2024-02-22 18:00:02.8205 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-02-22 18:00:02.8930 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-02-22 18:00:02.9099 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-02-22 18:00:02.9383 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-02-22 18:00:02.9564 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.MainApi\bin\Debug\net8.0\nlog.config
2024-02-22 18:00:02.9679 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-02-22 18:00:02.9866 Info Configuration initialized.
2024-02-23 08:54:46.3885 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-02-23 08:54:46.5134 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-02-23 08:54:46.5423 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-02-23 08:54:46.5925 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-02-23 08:54:46.6245 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\ds8-solution\ds-wms-service\DS.WMS.MainApi\bin\Debug\net8.0\nlog.config
2024-02-23 08:54:46.6406 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-02-23 08:54:46.6758 Info Configuration initialized.

@ -0,0 +1,46 @@
using System.Reflection;
using DS.Module.Core;
using DS.Module.Core.Extensions;
using DS.Module.SqlSugar;
using DS.WMS.Core.System.Entity;
using Microsoft.Extensions.DependencyInjection;
using SqlSugar;
using SqlSugar.IOC;
using Xunit;
namespace Ds.WMS.Test;
public class SaasTest
{
private readonly IServiceProvider _serviceProvider;
private readonly SqlSugarScope db;
private readonly ISaasDbService saasService;
public SaasTest(IServiceProvider serviceProvider)
{
_serviceProvider = serviceProvider;
db = (SqlSugarScope)_serviceProvider.GetRequiredService<ISqlSugarClient>();
saasService = _serviceProvider.GetRequiredService<ISaasDbService>();
}
[Fact]
public void TreeTest1()
{
Type[] types= Assembly
.LoadFrom("DS.WMS.Core.dll")//如果 .dll报错可以换成 xxx.exe 有些生成的是exe
.GetTypes().Where(it=>it.FullName.Contains("DS.WMS.Core.Code."))//命名空间过滤,当然你也可以写其他条件过滤
.ToArray();
var tenantDb = saasService.GetBizDbById("1750335377144680448");
var temp = db.CodeFirst.GetDifferenceTables(types);
// var diffString= tenantDb.CodeFirst.GetDifferenceTables(types).ToDiffString();
// StaticConfig.CodeFirst_MySqlCollate="utf8mb4_0900_ai_ci";//较高版本支持
// tenantDb.CodeFirst.InitTables(types);
// //初始化数库
// tenantDb.DbMaintenance.CreateDatabase();
//
// tenantDb.CodeFirst.InitTables(typeof(CodeCountry));
Assert.True(true);
}
}

@ -2,6 +2,7 @@ using Autofac;
using Autofac.Extensions.DependencyInjection;
using DS.Module.AutofacModule;
using DS.Module.SqlSugar;
using DS.Module.UserModule;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
@ -48,7 +49,9 @@ public class Startup
public void ConfigureServices(IServiceCollection services, HostBuilderContext hostBuilderContext)
{
// services.AddTransient<ITestService, TestService>();
services.AddUserModuleInstall(); //用户服务
services.AddSqlsugarInstall();
services.AddSaasDbInstall();
}
/// <summary>

@ -1,6 +1,7 @@
using DS.Module.Core;
using DS.Module.Core.Extensions;
using DS.WMS.Core.System.Entity;
using DS.WMS.Core.System.Interface;
using Microsoft.Extensions.DependencyInjection;
using SqlSugar;
using Xunit;
@ -11,11 +12,12 @@ public class UnitTest1
{
private readonly IServiceProvider _serviceProvider;
private readonly ISqlSugarClient db;
// private readonly ICommonService _commonService;
public UnitTest1(IServiceProvider serviceProvider)
{
_serviceProvider = serviceProvider;
db = _serviceProvider.GetRequiredService<ISqlSugarClient>();
// _commonService = _serviceProvider.GetRequiredService<ICommonService>();
}
[Fact]
@ -40,4 +42,25 @@ public class UnitTest1
ConstUtil.GetConstantField();
Assert.True(true);
}
[Fact]
public void DataRuleTest()
{
// var query = _commonService.GetDataRuleFilter<SysUser>();
var query = GetDataRuleFilter<SysUser>();
Assert.True(true);
}
public ISugarQueryable<T> GetDataRuleFilter<T>()
{
// var userInfo = db.Queryable<SysUser>().First(x => x.Id == long.Parse(user.UserId));
// if (userInfo.UserType == 0)
// {
// return db.Queryable<T>(); //超级管理员特权
// }
var moduleName = typeof(T).Name;
// var rule = db.Queryable<SysDataRule>().First(u => u.PermissionName == moduleName);
// if (rule == null) return db.Queryable<T>(); //没有设置数据规则,那么视为该资源允许被任何主体查看
return db.Queryable<T>();
}
}
Loading…
Cancel
Save