提交 c698ed45 编写于 作者: 麦壳饼's avatar 麦壳饼

1. 修正sqlserver的数据,

2. 调整 一些地方填写 租户信息
上级 4a6ed055
......@@ -12,7 +12,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace IoTSharp.Data.SqlServer.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20220212091230_SQLServerSchema2022")]
[Migration("20220212100016_SQLServerSchema2022")]
partial class SQLServerSchema2022
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
......@@ -926,7 +926,7 @@ namespace IoTSharp.Data.SqlServer.Migrations
b.Property<Guid>("Creator")
.HasColumnType("uniqueidentifier");
b.Property<Guid>("CustomerId")
b.Property<Guid?>("CustomerId")
.HasColumnType("uniqueidentifier");
b.Property<string>("FieldCode")
......@@ -941,7 +941,7 @@ namespace IoTSharp.Data.SqlServer.Migrations
b.Property<string>("FieldI18nKey")
.HasColumnType("nvarchar(max)");
b.Property<int?>("FieldMaxLength")
b.Property<int>("FieldMaxLength")
.HasColumnType("int");
b.Property<string>("FieldName")
......@@ -953,10 +953,10 @@ namespace IoTSharp.Data.SqlServer.Migrations
b.Property<string>("FieldPocoTypeName")
.HasColumnType("nvarchar(max)");
b.Property<int?>("FieldStatus")
b.Property<int>("FieldStatus")
.HasColumnType("int");
b.Property<long?>("FieldUIElement")
b.Property<long>("FieldUIElement")
.HasColumnType("bigint");
b.Property<string>("FieldUIElementSchema")
......@@ -974,22 +974,22 @@ namespace IoTSharp.Data.SqlServer.Migrations
b.Property<string>("FieldValueLocalDataSource")
.HasColumnType("nvarchar(max)");
b.Property<int?>("FieldValueType")
b.Property<int>("FieldValueType")
.HasColumnType("int");
b.Property<string>("FieldValueTypeName")
.HasColumnType("nvarchar(max)");
b.Property<long?>("FormId")
b.Property<long>("FormId")
.HasColumnType("bigint");
b.Property<bool?>("IsEnabled")
b.Property<bool>("IsEnabled")
.HasColumnType("bit");
b.Property<bool?>("IsRequired")
b.Property<bool>("IsRequired")
.HasColumnType("bit");
b.Property<Guid>("TenantId")
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier");
b.HasKey("FieldId");
......@@ -1009,13 +1009,13 @@ namespace IoTSharp.Data.SqlServer.Migrations
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("FieldValueId"), 1L, 1);
b.Property<long?>("BizId")
b.Property<long>("BizId")
.HasColumnType("bigint");
b.Property<Guid>("Creator")
.HasColumnType("uniqueidentifier");
b.Property<Guid>("CustomerId")
b.Property<Guid?>("CustomerId")
.HasColumnType("uniqueidentifier");
b.Property<string>("FieldCode")
......@@ -1024,7 +1024,7 @@ namespace IoTSharp.Data.SqlServer.Migrations
b.Property<DateTime?>("FieldCreateDate")
.HasColumnType("datetime2");
b.Property<long?>("FieldId")
b.Property<long>("FieldId")
.HasColumnType("bigint");
b.Property<string>("FieldName")
......@@ -1036,13 +1036,13 @@ namespace IoTSharp.Data.SqlServer.Migrations
b.Property<string>("FieldValue")
.HasColumnType("nvarchar(max)");
b.Property<long?>("FieldValueType")
b.Property<long>("FieldValueType")
.HasColumnType("bigint");
b.Property<long?>("FromId")
b.Property<long>("FromId")
.HasColumnType("bigint");
b.Property<Guid>("TenantId")
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier");
b.HasKey("FieldValueId");
......@@ -1062,16 +1062,16 @@ namespace IoTSharp.Data.SqlServer.Migrations
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("FormId"), 1L, 1);
b.Property<long?>("BizId")
b.Property<long>("BizId")
.HasColumnType("bigint");
b.Property<Guid>("Creator")
.HasColumnType("uniqueidentifier");
b.Property<Guid>("CustomerId")
b.Property<Guid?>("CustomerId")
.HasColumnType("uniqueidentifier");
b.Property<long?>("FormCreator")
b.Property<long>("FormCreator")
.HasColumnType("bigint");
b.Property<string>("FormDesc")
......@@ -1086,7 +1086,7 @@ namespace IoTSharp.Data.SqlServer.Migrations
b.Property<string>("FormSchame")
.HasColumnType("nvarchar(max)");
b.Property<int?>("FormStatus")
b.Property<int>("FormStatus")
.HasColumnType("int");
b.Property<DateTime?>("FromCreateDate")
......@@ -1098,7 +1098,7 @@ namespace IoTSharp.Data.SqlServer.Migrations
b.Property<string>("ModelClass")
.HasColumnType("nvarchar(max)");
b.Property<Guid>("TenantId")
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier");
b.Property<string>("Url")
......@@ -1237,7 +1237,7 @@ namespace IoTSharp.Data.SqlServer.Migrations
b.Property<Guid?>("FlowRuleRuleId")
.HasColumnType("uniqueidentifier");
b.Property<int?>("NodeStatus")
b.Property<int>("NodeStatus")
.HasColumnType("int");
b.Property<string>("OperationDesc")
......@@ -1462,7 +1462,7 @@ namespace IoTSharp.Data.SqlServer.Migrations
b.Property<Guid>("Creator")
.HasColumnType("uniqueidentifier");
b.Property<Guid>("CustomerId")
b.Property<Guid?>("CustomerId")
.HasColumnType("uniqueidentifier");
b.Property<string>("EventDesc")
......@@ -1483,7 +1483,7 @@ namespace IoTSharp.Data.SqlServer.Migrations
b.Property<string>("EventTag")
.HasColumnType("nvarchar(max)");
b.Property<Guid>("TenantId")
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier");
b.Property<int>("Type")
......@@ -2025,15 +2025,11 @@ namespace IoTSharp.Data.SqlServer.Migrations
{
b.HasOne("IoTSharp.Data.Customer", "Customer")
.WithMany()
.HasForeignKey("CustomerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
.HasForeignKey("CustomerId");
b.HasOne("IoTSharp.Data.Tenant", "Tenant")
.WithMany()
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
.HasForeignKey("TenantId");
b.Navigation("Customer");
......@@ -2044,15 +2040,11 @@ namespace IoTSharp.Data.SqlServer.Migrations
{
b.HasOne("IoTSharp.Data.Customer", "Customer")
.WithMany()
.HasForeignKey("CustomerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
.HasForeignKey("CustomerId");
b.HasOne("IoTSharp.Data.Tenant", "Tenant")
.WithMany()
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
.HasForeignKey("TenantId");
b.Navigation("Customer");
......@@ -2063,15 +2055,11 @@ namespace IoTSharp.Data.SqlServer.Migrations
{
b.HasOne("IoTSharp.Data.Customer", "Customer")
.WithMany()
.HasForeignKey("CustomerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
.HasForeignKey("CustomerId");
b.HasOne("IoTSharp.Data.Tenant", "Tenant")
.WithMany()
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
.HasForeignKey("TenantId");
b.Navigation("Customer");
......@@ -2190,15 +2178,11 @@ namespace IoTSharp.Data.SqlServer.Migrations
{
b.HasOne("IoTSharp.Data.Customer", "Customer")
.WithMany()
.HasForeignKey("CustomerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
.HasForeignKey("CustomerId");
b.HasOne("IoTSharp.Data.Tenant", "Tenant")
.WithMany()
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
.HasForeignKey("TenantId");
b.Navigation("Customer");
......
......@@ -579,27 +579,27 @@ namespace IoTSharp.Data.SqlServer.Migrations
.Annotation("SqlServer:Identity", "1, 1"),
FieldName = table.Column<string>(type: "nvarchar(max)", nullable: true),
FieldValue = table.Column<string>(type: "nvarchar(max)", nullable: true),
FieldValueType = table.Column<int>(type: "int", nullable: true),
FormId = table.Column<long>(type: "bigint", nullable: true),
FieldValueType = table.Column<int>(type: "int", nullable: false),
FormId = table.Column<long>(type: "bigint", nullable: false),
Creator = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
FieldCreateDate = table.Column<DateTime>(type: "datetime2", nullable: true),
FieldEditDate = table.Column<DateTime>(type: "datetime2", nullable: true),
FieldCode = table.Column<string>(type: "nvarchar(max)", nullable: true),
FieldUnit = table.Column<string>(type: "nvarchar(max)", nullable: true),
IsRequired = table.Column<bool>(type: "bit", nullable: true),
IsEnabled = table.Column<bool>(type: "bit", nullable: true),
FieldStatus = table.Column<int>(type: "int", nullable: true),
IsRequired = table.Column<bool>(type: "bit", nullable: false),
IsEnabled = table.Column<bool>(type: "bit", nullable: false),
FieldStatus = table.Column<int>(type: "int", nullable: false),
FieldI18nKey = table.Column<string>(type: "nvarchar(max)", nullable: true),
FieldValueDataSource = table.Column<string>(type: "nvarchar(max)", nullable: true),
FieldValueLocalDataSource = table.Column<string>(type: "nvarchar(max)", nullable: true),
FieldPattern = table.Column<string>(type: "nvarchar(max)", nullable: true),
FieldMaxLength = table.Column<int>(type: "int", nullable: true),
FieldMaxLength = table.Column<int>(type: "int", nullable: false),
FieldValueTypeName = table.Column<string>(type: "nvarchar(max)", nullable: true),
FieldUIElement = table.Column<long>(type: "bigint", nullable: true),
FieldUIElement = table.Column<long>(type: "bigint", nullable: false),
FieldUIElementSchema = table.Column<string>(type: "nvarchar(max)", nullable: true),
FieldPocoTypeName = table.Column<string>(type: "nvarchar(max)", nullable: true),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
CustomerId = table.Column<Guid>(type: "uniqueidentifier", nullable: false)
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
CustomerId = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
},
constraints: table =>
{
......@@ -608,14 +608,12 @@ namespace IoTSharp.Data.SqlServer.Migrations
name: "FK_DynamicFormFieldInfos_Customer_CustomerId",
column: x => x.CustomerId,
principalTable: "Customer",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
principalColumn: "Id");
table.ForeignKey(
name: "FK_DynamicFormFieldInfos_Tenant_TenantId",
column: x => x.TenantId,
principalTable: "Tenant",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
principalColumn: "Id");
});
migrationBuilder.CreateTable(
......@@ -624,18 +622,18 @@ namespace IoTSharp.Data.SqlServer.Migrations
{
FieldValueId = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
FieldId = table.Column<long>(type: "bigint", nullable: true),
FieldId = table.Column<long>(type: "bigint", nullable: false),
FieldName = table.Column<string>(type: "nvarchar(max)", nullable: true),
FieldValue = table.Column<string>(type: "nvarchar(max)", nullable: true),
FromId = table.Column<long>(type: "bigint", nullable: true),
FromId = table.Column<long>(type: "bigint", nullable: false),
Creator = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
FieldCreateDate = table.Column<DateTime>(type: "datetime2", nullable: true),
FieldCode = table.Column<string>(type: "nvarchar(max)", nullable: true),
FieldUnit = table.Column<string>(type: "nvarchar(max)", nullable: true),
FieldValueType = table.Column<long>(type: "bigint", nullable: true),
BizId = table.Column<long>(type: "bigint", nullable: true),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
CustomerId = table.Column<Guid>(type: "uniqueidentifier", nullable: false)
FieldValueType = table.Column<long>(type: "bigint", nullable: false),
BizId = table.Column<long>(type: "bigint", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
CustomerId = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
},
constraints: table =>
{
......@@ -644,14 +642,12 @@ namespace IoTSharp.Data.SqlServer.Migrations
name: "FK_DynamicFormFieldValueInfos_Customer_CustomerId",
column: x => x.CustomerId,
principalTable: "Customer",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
principalColumn: "Id");
table.ForeignKey(
name: "FK_DynamicFormFieldValueInfos_Tenant_TenantId",
column: x => x.TenantId,
principalTable: "Tenant",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
principalColumn: "Id");
});
migrationBuilder.CreateTable(
......@@ -660,11 +656,11 @@ namespace IoTSharp.Data.SqlServer.Migrations
{
FormId = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
BizId = table.Column<long>(type: "bigint", nullable: true),
FormCreator = table.Column<long>(type: "bigint", nullable: true),
BizId = table.Column<long>(type: "bigint", nullable: false),
FormCreator = table.Column<long>(type: "bigint", nullable: false),
FormName = table.Column<string>(type: "nvarchar(max)", nullable: true),
FormDesc = table.Column<string>(type: "nvarchar(max)", nullable: true),
FormStatus = table.Column<int>(type: "int", nullable: true),
FormStatus = table.Column<int>(type: "int", nullable: false),
FormSchame = table.Column<string>(type: "nvarchar(max)", nullable: true),
ModelClass = table.Column<string>(type: "nvarchar(max)", nullable: true),
Url = table.Column<string>(type: "nvarchar(max)", nullable: true),
......@@ -672,8 +668,8 @@ namespace IoTSharp.Data.SqlServer.Migrations
FromCreateDate = table.Column<DateTime>(type: "datetime2", nullable: true),
FormLayout = table.Column<string>(type: "nvarchar(max)", nullable: true),
IsCompact = table.Column<bool>(type: "bit", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
CustomerId = table.Column<Guid>(type: "uniqueidentifier", nullable: false)
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
CustomerId = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
},
constraints: table =>
{
......@@ -682,14 +678,12 @@ namespace IoTSharp.Data.SqlServer.Migrations
name: "FK_DynamicFormInfos_Customer_CustomerId",
column: x => x.CustomerId,
principalTable: "Customer",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
principalColumn: "Id");
table.ForeignKey(
name: "FK_DynamicFormInfos_Tenant_TenantId",
column: x => x.TenantId,
principalTable: "Tenant",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
principalColumn: "Id");
});
migrationBuilder.CreateTable(
......@@ -809,8 +803,8 @@ namespace IoTSharp.Data.SqlServer.Migrations
EventTag = table.Column<string>(type: "nvarchar(max)", nullable: true),
CreateDateTime = table.Column<DateTime>(type: "datetime2", nullable: false),
Creator = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
CustomerId = table.Column<Guid>(type: "uniqueidentifier", nullable: false)
TenantId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
CustomerId = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
},
constraints: table =>
{
......@@ -819,14 +813,12 @@ namespace IoTSharp.Data.SqlServer.Migrations
name: "FK_SubscriptionEvents_Customer_CustomerId",
column: x => x.CustomerId,
principalTable: "Customer",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
principalColumn: "Id");
table.ForeignKey(
name: "FK_SubscriptionEvents_Tenant_TenantId",
column: x => x.TenantId,
principalTable: "Tenant",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
principalColumn: "Id");
});
migrationBuilder.CreateTable(
......@@ -1099,7 +1091,7 @@ namespace IoTSharp.Data.SqlServer.Migrations
{
OperationId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
AddDate = table.Column<DateTime>(type: "datetime2", nullable: true),
NodeStatus = table.Column<int>(type: "int", nullable: true),
NodeStatus = table.Column<int>(type: "int", nullable: false),
OperationDesc = table.Column<string>(type: "nvarchar(max)", nullable: true),
Data = table.Column<string>(type: "nvarchar(max)", nullable: true),
BizId = table.Column<string>(type: "nvarchar(max)", nullable: true),
......
......@@ -924,7 +924,7 @@ namespace IoTSharp.Data.SqlServer.Migrations
b.Property<Guid>("Creator")
.HasColumnType("uniqueidentifier");
b.Property<Guid>("CustomerId")
b.Property<Guid?>("CustomerId")
.HasColumnType("uniqueidentifier");
b.Property<string>("FieldCode")
......@@ -939,7 +939,7 @@ namespace IoTSharp.Data.SqlServer.Migrations
b.Property<string>("FieldI18nKey")
.HasColumnType("nvarchar(max)");
b.Property<int?>("FieldMaxLength")
b.Property<int>("FieldMaxLength")
.HasColumnType("int");
b.Property<string>("FieldName")
......@@ -951,10 +951,10 @@ namespace IoTSharp.Data.SqlServer.Migrations
b.Property<string>("FieldPocoTypeName")
.HasColumnType("nvarchar(max)");
b.Property<int?>("FieldStatus")
b.Property<int>("FieldStatus")
.HasColumnType("int");
b.Property<long?>("FieldUIElement")
b.Property<long>("FieldUIElement")
.HasColumnType("bigint");
b.Property<string>("FieldUIElementSchema")
......@@ -972,22 +972,22 @@ namespace IoTSharp.Data.SqlServer.Migrations
b.Property<string>("FieldValueLocalDataSource")
.HasColumnType("nvarchar(max)");
b.Property<int?>("FieldValueType")
b.Property<int>("FieldValueType")
.HasColumnType("int");
b.Property<string>("FieldValueTypeName")
.HasColumnType("nvarchar(max)");
b.Property<long?>("FormId")
b.Property<long>("FormId")
.HasColumnType("bigint");
b.Property<bool?>("IsEnabled")
b.Property<bool>("IsEnabled")
.HasColumnType("bit");
b.Property<bool?>("IsRequired")
b.Property<bool>("IsRequired")
.HasColumnType("bit");
b.Property<Guid>("TenantId")
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier");
b.HasKey("FieldId");
......@@ -1007,13 +1007,13 @@ namespace IoTSharp.Data.SqlServer.Migrations
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("FieldValueId"), 1L, 1);
b.Property<long?>("BizId")
b.Property<long>("BizId")
.HasColumnType("bigint");
b.Property<Guid>("Creator")
.HasColumnType("uniqueidentifier");
b.Property<Guid>("CustomerId")
b.Property<Guid?>("CustomerId")
.HasColumnType("uniqueidentifier");
b.Property<string>("FieldCode")
......@@ -1022,7 +1022,7 @@ namespace IoTSharp.Data.SqlServer.Migrations
b.Property<DateTime?>("FieldCreateDate")
.HasColumnType("datetime2");
b.Property<long?>("FieldId")
b.Property<long>("FieldId")
.HasColumnType("bigint");
b.Property<string>("FieldName")
......@@ -1034,13 +1034,13 @@ namespace IoTSharp.Data.SqlServer.Migrations
b.Property<string>("FieldValue")
.HasColumnType("nvarchar(max)");
b.Property<long?>("FieldValueType")
b.Property<long>("FieldValueType")
.HasColumnType("bigint");
b.Property<long?>("FromId")
b.Property<long>("FromId")
.HasColumnType("bigint");
b.Property<Guid>("TenantId")
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier");
b.HasKey("FieldValueId");
......@@ -1060,16 +1060,16 @@ namespace IoTSharp.Data.SqlServer.Migrations
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("FormId"), 1L, 1);
b.Property<long?>("BizId")
b.Property<long>("BizId")
.HasColumnType("bigint");
b.Property<Guid>("Creator")
.HasColumnType("uniqueidentifier");
b.Property<Guid>("CustomerId")
b.Property<Guid?>("CustomerId")
.HasColumnType("uniqueidentifier");
b.Property<long?>("FormCreator")
b.Property<long>("FormCreator")
.HasColumnType("bigint");
b.Property<string>("FormDesc")
......@@ -1084,7 +1084,7 @@ namespace IoTSharp.Data.SqlServer.Migrations
b.Property<string>("FormSchame")
.HasColumnType("nvarchar(max)");
b.Property<int?>("FormStatus")
b.Property<int>("FormStatus")
.HasColumnType("int");
b.Property<DateTime?>("FromCreateDate")
......@@ -1096,7 +1096,7 @@ namespace IoTSharp.Data.SqlServer.Migrations
b.Property<string>("ModelClass")
.HasColumnType("nvarchar(max)");
b.Property<Guid>("TenantId")
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier");
b.Property<string>("Url")
......@@ -1235,7 +1235,7 @@ namespace IoTSharp.Data.SqlServer.Migrations
b.Property<Guid?>("FlowRuleRuleId")
.HasColumnType("uniqueidentifier");
b.Property<int?>("NodeStatus")
b.Property<int>("NodeStatus")
.HasColumnType("int");
b.Property<string>("OperationDesc")
......@@ -1460,7 +1460,7 @@ namespace IoTSharp.Data.SqlServer.Migrations
b.Property<Guid>("Creator")
.HasColumnType("uniqueidentifier");
b.Property<Guid>("CustomerId")
b.Property<Guid?>("CustomerId")
.HasColumnType("uniqueidentifier");
b.Property<string>("EventDesc")
......@@ -1481,7 +1481,7 @@ namespace IoTSharp.Data.SqlServer.Migrations
b.Property<string>("EventTag")
.HasColumnType("nvarchar(max)");
b.Property<Guid>("TenantId")
b.Property<Guid?>("TenantId")
.HasColumnType("uniqueidentifier");
b.Property<int>("Type")
......@@ -2023,15 +2023,11 @@ namespace IoTSharp.Data.SqlServer.Migrations
{
b.HasOne("IoTSharp.Data.Customer", "Customer")
.WithMany()
.HasForeignKey("CustomerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
.HasForeignKey("CustomerId");
b.HasOne("IoTSharp.Data.Tenant", "Tenant")
.WithMany()
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
.HasForeignKey("TenantId");
b.Navigation("Customer");
......@@ -2042,15 +2038,11 @@ namespace IoTSharp.Data.SqlServer.Migrations
{
b.HasOne("IoTSharp.Data.Customer", "Customer")
.WithMany()
.HasForeignKey("CustomerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
.HasForeignKey("CustomerId");
b.HasOne("IoTSharp.Data.Tenant", "Tenant")
.WithMany()
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
.HasForeignKey("TenantId");
b.Navigation("Customer");
......@@ -2061,15 +2053,11 @@ namespace IoTSharp.Data.SqlServer.Migrations
{
b.HasOne("IoTSharp.Data.Customer", "Customer")
.WithMany()
.HasForeignKey("CustomerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
.HasForeignKey("CustomerId");
b.HasOne("IoTSharp.Data.Tenant", "Tenant")
.WithMany()
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
.HasForeignKey("TenantId");
b.Navigation("Customer");
......@@ -2188,15 +2176,11 @@ namespace IoTSharp.Data.SqlServer.Migrations
{
b.HasOne("IoTSharp.Data.Customer", "Customer")
.WithMany()
.HasForeignKey("CustomerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
.HasForeignKey("CustomerId");
b.HasOne("IoTSharp.Data.Tenant", "Tenant")
.WithMany()
.HasForeignKey("TenantId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
.HasForeignKey("TenantId");
b.Navigation("Customer");
......
......@@ -326,31 +326,22 @@ namespace IoTSharp.Controllers
public ApiResult<bool> SaveDiagram(ModelWorkFlow m)
{
var profile = this.GetUserProfile();
var activity = JsonConvert.DeserializeObject<IoTSharp.Models.Rule.Activity>(m.Biz);
var activity = JsonConvert.DeserializeObject<Activity>(m.Biz);
var CreatorId = Guid.NewGuid();
var CreateDate = DateTime.Now;
var rule = _context.FlowRules.FirstOrDefault(c => c.RuleId == activity.RuleId);
rule.DefinitionsXml = m.Xml;
rule.Creator = profile.Id.ToString();
rule.CreateId = CreatorId;
// _context.Flows.RemoveRange(_context.Flows.Where(c => c.FlowRule.RuleId == rule.RuleId).ToList());
_context.Flows.Where(c => c.FlowRule.RuleId == rule.RuleId).ToList().ForEach(c =>
_context.Flows.Where(c => c.FlowRule.RuleId == rule.RuleId).ForEach(c =>
{
c.FlowStatus = -1;
});
_context.SaveChanges();
_context.FlowRules.Update(rule);
_context.SaveChanges();
if (activity.BaseBpmnObjects != null)
{
_context.Flows.AddRange(activity.BaseBpmnObjects.Select(c => new Flow
var fw = activity.BaseBpmnObjects.Select(c => new Flow
{
FlowRule = rule,
Flowname = c.BizObject.Flowname,
......@@ -362,14 +353,15 @@ namespace IoTSharp.Controllers
CreateId = CreatorId,
Createor = profile.Id,
CreateDate = CreateDate,
Tenant = new Tenant() { Id = profile.Tenant }
}).ToList());
});
fw.ForEach(f => _context.JustFill(this, f));
_context.Flows.AddRange(fw);
_context.SaveChanges();
}
if (activity.StartEvents != null)
{
_context.Flows.AddRange(activity.StartEvents.Select(c => new Flow
var fw = activity.StartEvents.Select(c => new Flow
{
FlowRule = rule,
Flowname = c.BizObject.Flowname,
......@@ -379,14 +371,15 @@ namespace IoTSharp.Controllers
CreateId = CreatorId,
Createor = profile.Id,
CreateDate = CreateDate,
Tenant = new Tenant() { Id = profile.Tenant },
}).ToList());
});
fw.ForEach(f => _context.JustFill(this, f));
_context.Flows.AddRange(fw);
_context.SaveChanges();
}
if (activity.EndEvents != null)
{
_context.Flows.AddRange(activity.EndEvents.Select(c => new Flow
var fw = activity.EndEvents.Select(c => new Flow
{
FlowRule = rule,
Flowname = c.BizObject.Flowname,
......@@ -396,14 +389,15 @@ namespace IoTSharp.Controllers
CreateId = CreatorId,
Createor = profile.Id,
CreateDate = CreateDate,
Tenant = new Tenant() { Id = profile.Tenant },
}).ToList());
});
fw.ForEach(f => _context.JustFill(this, f));
_context.Flows.AddRange(fw);
_context.SaveChanges();
}
if (activity.SequenceFlows != null)
{
_context.Flows.AddRange(activity.SequenceFlows.Select(c => new Flow
var fw = activity.SequenceFlows.Select(c => new Flow
{
FlowRule = rule,
Flowname = c.BizObject.Flowname,
......@@ -417,14 +411,15 @@ namespace IoTSharp.Controllers
NodeProcessParams = c.BizObject.NodeProcessParams,
Createor = profile.Id,
CreateDate = CreateDate,
Tenant = new Tenant() { Id = profile.Tenant },
}).ToList());
});
fw.ForEach(f => _context.JustFill(this, f));
_context.Flows.AddRange(fw);
_context.SaveChanges();
}
if (activity.Tasks != null)
{
_context.Flows.AddRange(activity.Tasks.Select(c => new Flow
var fw = activity.Tasks.Select(c => new Flow
{
FlowRule = rule,
Flowname = c.BizObject.Flowname,
......@@ -438,14 +433,15 @@ namespace IoTSharp.Controllers
CreateId = CreatorId,
Createor = profile.Id,
CreateDate = CreateDate,
Tenant = new Tenant() { Id = profile.Tenant },
}).ToList());
});
fw.ForEach(f => _context.JustFill(this, f));
_context.Flows.AddRange(fw);
_context.SaveChanges();
}
if (activity.DataInputAssociations != null)
{
_context.Flows.AddRange(activity.DataInputAssociations.Select(c => new Flow
var fw = activity.DataInputAssociations.Select(c => new Flow
{
FlowRule = rule,
Flowname = c.BizObject.Flowname,
......@@ -455,14 +451,15 @@ namespace IoTSharp.Controllers
CreateId = CreatorId,
Createor = profile.Id,
CreateDate = CreateDate,
Tenant = new Tenant() { Id = profile.Tenant },
}).ToList());
});
fw.ForEach(f => _context.JustFill(this, f));
_context.Flows.AddRange(fw);
_context.SaveChanges();
}
if (activity.DataOutputAssociations != null)
{
_context.Flows.AddRange(activity.DataOutputAssociations.Select(c => new Flow
var fw = activity.DataOutputAssociations.Select(c => new Flow
{
FlowRule = rule,
Flowname = c.BizObject.Flowname,
......@@ -472,14 +469,15 @@ namespace IoTSharp.Controllers
CreateId = CreatorId,
Createor = profile.Id,
CreateDate = CreateDate,
Tenant = new Tenant() { Id = profile.Tenant },
}).ToList());
});
fw.ForEach(f => _context.JustFill(this, f));
_context.Flows.AddRange(fw);
_context.SaveChanges();
}
if (activity.TextAnnotations != null)
{
_context.Flows.AddRange(activity.TextAnnotations.Select(c => new Flow
var fw = activity.TextAnnotations.Select(c => new Flow
{
FlowRule = rule,
Flowname = c.BizObject.Flowname,
......@@ -489,14 +487,15 @@ namespace IoTSharp.Controllers
CreateId = CreatorId,
Createor = profile.Id,
CreateDate = CreateDate,
Tenant = new Tenant() { Id = profile.Tenant },
}).ToList());
});
fw.ForEach(f => _context.JustFill(this, f));
_context.Flows.AddRange(fw);
_context.SaveChanges();
}
if (activity.Containers != null)
{
_context.Flows.AddRange(activity.Containers.Select(c => new Flow
var fw = activity.Containers.Select(c => new Flow
{
FlowRule = rule,
Flowname = c.BizObject.Flowname,
......@@ -506,8 +505,9 @@ namespace IoTSharp.Controllers
CreateId = CreatorId,
Createor = profile.Id,
CreateDate = CreateDate,
Tenant = new Tenant() { Id = profile.Tenant },
}).ToList());
});
fw.ForEach(f => _context.JustFill(this, f));
_context.Flows.AddRange(fw);
_context.SaveChanges();
}
......@@ -523,14 +523,13 @@ namespace IoTSharp.Controllers
CreateId = CreatorId,
Createor = profile.Id,
CreateDate = CreateDate,
Tenant = new Tenant() { Id = profile.Tenant },
}).ToList());
_context.SaveChanges();
}
if (activity.DataStoreReferences != null)
{
_context.Flows.AddRange(activity.DataStoreReferences.Select(c => new Flow
var fw = activity.DataStoreReferences.Select(c => new Flow
{
FlowRule = rule,
Flowname = c.BizObject.Flowname,
......@@ -540,14 +539,15 @@ namespace IoTSharp.Controllers
CreateId = CreatorId,
Createor = profile.Id,
CreateDate = CreateDate,
Tenant = new Tenant() { Id = profile.Tenant },
}).ToList());
});
fw.ForEach(f => _context.JustFill(this, f));
_context.Flows.AddRange(fw);
_context.SaveChanges();
}
if (activity.Lane != null)
{
_context.Flows.AddRange(activity.Lane.Select(c => new Flow
var fw = activity.Lane.Select(c => new Flow
{
FlowRule = rule,
Flowname = c.BizObject.Flowname,
......@@ -557,14 +557,15 @@ namespace IoTSharp.Controllers
CreateId = CreatorId,
Createor = profile.Id,
CreateDate = CreateDate,
Tenant = new Tenant() { Id = profile.Tenant },
}).ToList());
});
fw.ForEach(f => _context.JustFill(this, f));
_context.Flows.AddRange(fw);
_context.SaveChanges();
}
if (activity.LaneSet != null)
{
_context.Flows.AddRange(activity.LaneSet.Select(c => new Flow
var fws = activity.LaneSet.Select(c => new Flow
{
FlowRule = rule,
Flowname = c.BizObject.Flowname,
......@@ -573,9 +574,10 @@ namespace IoTSharp.Controllers
FlowStatus = 1,
CreateId = CreatorId,
Createor = profile.Id,
CreateDate = CreateDate,
Tenant = new Tenant() { Id = profile.Tenant },
}).ToList());
CreateDate = CreateDate
});
fws.ForEach(f => _context.JustFill(this, f));
_context.Flows.AddRange(fws);
_context.SaveChanges();
}
return new ApiResult<bool>(ApiCode.Success, "Ok", true);
......@@ -1086,11 +1088,10 @@ namespace IoTSharp.Controllers
var list = result.Select(c => new FlowOperation
{
AddDate = c.AddDate,
BaseEvent = new BaseEvent() { EventId = c.BaseEvent.EventId },
BizId = c.BizId,
Data = c.Data,
Flow = new Flow() { FlowId = c.Flow.FlowId },
FlowRule = new FlowRule() { RuleId = c.FlowRule.RuleId },
Flow = c.Flow,
FlowRule = c.FlowRule,
NodeStatus = c.NodeStatus,
OperationDesc = c.OperationDesc,
OperationId = new Guid(),
......
......@@ -380,11 +380,11 @@
<returns></returns>
</member>
<member name="M:IoTSharp.Controllers.DictionaryController.Delete(System.Int32)">
<summary>
<summary>
</summary>
<param name="id"></param>
<returns></returns>
</summary>
<param name="id"></param>
<returns></returns>
</member>
<member name="M:IoTSharp.Controllers.DictionaryGroupController.Save(IoTSharp.Data.BaseDictionaryGroup)">
<summary>
......@@ -401,11 +401,11 @@
<returns></returns>
</member>
<member name="M:IoTSharp.Controllers.DynamicFormInfoController.Save(IoTSharp.Data.DynamicFormInfo)">
<summary>
<summary>
</summary>
<param name="m"></param>
<returns></returns>
</summary>
<param name="m"></param>
<returns></returns>
</member>
<member name="T:IoTSharp.Controllers.InstallerController">
<summary>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册