Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
SeriaWei committed Oct 13, 2024
2 parents 12040ec + 22b774d commit d1a677c
Show file tree
Hide file tree
Showing 79 changed files with 931 additions and 496 deletions.
4 changes: 2 additions & 2 deletions Database/SQLite/ZKEACMS.sqlite.sql
Original file line number Diff line number Diff line change
Expand Up @@ -984,7 +984,7 @@ CREATE TABLE [CMS_Page] (
, [ParentId] nvarchar(100) NULL
, [PageName] nvarchar(100) NULL
, [IsHomePage] bit NOT NULL
, [Url] nvarchar(255) NULL
, [Url] nvarchar(255) NULL COLLATE NOCASE
, [LayoutId] nvarchar(100) NULL
, [Title] nvarchar(255) NULL
, [Content] ntext NULL
Expand Down Expand Up @@ -1177,7 +1177,7 @@ CREATE TABLE [Article] (
, FOREIGN KEY ([ArticleTypeID]) REFERENCES [ArticleType] ([ID]) ON DELETE NO ACTION ON UPDATE NO ACTION
);
CREATE TABLE [ApplicationSetting] (
[SettingKey] nvarchar(50) NOT NULL
[SettingKey] nvarchar(50) NOT NULL COLLATE NOCASE
, [Value] ntext NULL
, [Title] nvarchar(200) NULL
, [Description] nvarchar(500) NULL
Expand Down
150 changes: 150 additions & 0 deletions Database/Update/4.1/Enterprise.MsSql.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
IF NOT EXISTS (SELECT *
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA = 'dbo'
AND TABLE_NAME = 'ArticleTypeRelation')
BEGIN
CREATE TABLE [dbo].[ArticleTypeRelation](
[ArticleId] [nvarchar](100) NOT NULL,
[ArticleTypeId] [nvarchar](100) NOT NULL,
CONSTRAINT [PK_ArticleTypeRelation] PRIMARY KEY CLUSTERED
(
[ArticleId] ASC,
[ArticleTypeId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
TRUNCATE TABLE [dbo].[ArticleTypeRelation]
GO
INSERT INTO [dbo].[ArticleTypeRelation] (ArticleId, ArticleTypeId)
SELECT DISTINCT ISNULL(ContentID,ID),ArticleTypeID FROM dbo.[Article]
GO

IF NOT EXISTS (SELECT *
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA = 'dbo'
AND TABLE_NAME = 'CMS_WidgetArticleTypeRelation')
BEGIN
CREATE TABLE [dbo].[CMS_WidgetArticleTypeRelation](
[WidgetId] [nvarchar](100) NOT NULL,
[ArticleTypeId] [int] NOT NULL,
CONSTRAINT [PK_CMS_WidgetArticleTypeRelation] PRIMARY KEY CLUSTERED
(
[WidgetId] ASC,
[ArticleTypeId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
TRUNCATE TABLE dbo.CMS_WidgetArticleTypeRelation
GO
INSERT INTO [dbo].[CMS_WidgetArticleTypeRelation](WidgetId,ArticleTypeId)
SELECT T0.ID, T1.ID FROM dbo.ArticleListWidget T0
INNER JOIN dbo.ArticleType T1 ON T0.ArticleTypeID = T1.ID OR T0.ArticleTypeID =T1.ParentID
UNION
SELECT T0.ID, T1.ID FROM dbo.ArticleTopWidget T0
INNER JOIN dbo.ArticleType T1 ON T0.ArticleTypeID = T1.ID OR T0.ArticleTypeID =T1.ParentID
UNION
SELECT T0.ID, T1.ID FROM dbo.ArticleTypeWidget T0
INNER JOIN dbo.ArticleType T1 ON T0.ArticleTypeID = T1.ID OR T0.ArticleTypeID = T1.ParentID
GO


IF NOT EXISTS (SELECT *
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA = 'dbo'
AND TABLE_NAME = 'ProductCategoryRelation')
BEGIN
CREATE TABLE [dbo].[ProductCategoryRelation](
[ProductId] [nvarchar](100) NOT NULL,
[ProductCategoryId] [nvarchar](100) NOT NULL,
CONSTRAINT [PK_ProductCategoryRelation] PRIMARY KEY CLUSTERED
(
[ProductId] ASC,
[ProductCategoryId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
TRUNCATE TABLE [dbo].[ProductCategoryRelation]
GO
INSERT INTO [dbo].[ProductCategoryRelation] (ProductId, ProductCategoryId)
SELECT DISTINCT ISNULL(ContentID,ID), ProductCategoryID FROM dbo.[Product]
GO

IF NOT EXISTS (SELECT *
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA = 'dbo'
AND TABLE_NAME = 'CMS_WidgetProductCategoryRelation')
BEGIN
CREATE TABLE [dbo].[CMS_WidgetProductCategoryRelation](
[WidgetId] [nvarchar](100) NOT NULL,
[ProductCategoryId] [int] NOT NULL,
CONSTRAINT [PK_CMS_WidgetProductCategoryRelation] PRIMARY KEY CLUSTERED
(
[WidgetId] ASC,
[ProductCategoryId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
TRUNCATE TABLE dbo.[CMS_WidgetProductCategoryRelation]
GO
INSERT INTO [dbo].[CMS_WidgetProductCategoryRelation](WidgetId, ProductCategoryId)
SELECT T0.ID, T1.ID FROM dbo.ProductListWidget T0
INNER JOIN dbo.ProductCategory T1 ON T0.ProductCategoryID = T1.ID OR T0.ProductCategoryID =T1.ParentID
UNION
SELECT T0.ID, T1.ID FROM dbo.ProductCategoryWidget T0
INNER JOIN dbo.ProductCategory T1 ON T0.ProductCategoryID = T1.ID OR T0.ProductCategoryID = T1.ParentID
GO

IF NOT EXISTS (SELECT *
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA = 'dbo'
AND TABLE_NAME = 'VideoTypeRelation')
BEGIN
CREATE TABLE [dbo].[VideoTypeRelation](
[VideoId] [nvarchar](100) NOT NULL,
[VideoTypeId] [nvarchar](100) NOT NULL,
CONSTRAINT [PK_VideoTypeRelation] PRIMARY KEY CLUSTERED
(
[VideoId] ASC,
[VideoTypeId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
TRUNCATE TABLE [dbo].[VideoTypeRelation]
GO
INSERT INTO [dbo].[VideoTypeRelation] (VideoId, VideoTypeId)
SELECT DISTINCT ISNULL(ContentID,ID),VideoTypeID FROM dbo.[Video]
GO

IF NOT EXISTS (SELECT *
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA = 'dbo'
AND TABLE_NAME = 'CMS_WidgetVideoTypeRelation')
BEGIN
CREATE TABLE [dbo].[CMS_WidgetVideoTypeRelation](
[WidgetId] [nvarchar](100) NOT NULL,
[VideoTypeId] [int] NOT NULL,
CONSTRAINT [PK_CMS_WidgetVideoTypeRelation] PRIMARY KEY CLUSTERED
(
[WidgetId] ASC,
[VideoTypeId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
END
GO
TRUNCATE TABLE dbo.CMS_WidgetVideoTypeRelation
GO
INSERT INTO [dbo].[CMS_WidgetVideoTypeRelation](WidgetId,VideoTypeId)
SELECT T0.ID, T1.ID FROM dbo.VideoListWidget T0
INNER JOIN dbo.VideoType T1 ON T0.VideoTypeID = T1.ID OR T0.VideoTypeID =T1.ParentID
UNION
SELECT T0.ID, T1.ID FROM dbo.VideoTopWidget T0
INNER JOIN dbo.VideoType T1 ON T0.VideoTypeID = T1.ID OR T0.VideoTypeID =T1.ParentID
UNION
SELECT T0.ID, T1.ID FROM dbo.VideoTypeWidget T0
INNER JOIN dbo.VideoType T1 ON T0.VideoTypeID = T1.ID OR T0.VideoTypeID = T1.ParentID
GO
83 changes: 83 additions & 0 deletions Database/Update/4.1/Enterprise.MySql.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
CREATE TABLE IF NOT EXISTS `ArticleTypeRelation` (
`ArticleId` VARCHAR(100) NOT NULL,
`ArticleTypeId` VARCHAR(100) NOT NULL,
PRIMARY KEY (`ArticleId`, `ArticleTypeId`)
);

DELETE FROM `ArticleTypeRelation`;

INSERT INTO `ArticleTypeRelation` (ArticleId, ArticleTypeId)
SELECT DISTINCT IFNULL(ContentID, ID), ArticleTypeID FROM `Article`;

CREATE TABLE IF NOT EXISTS `CMS_WidgetArticleTypeRelation` (
`WidgetId` VARCHAR(100) NOT NULL,
`ArticleTypeId` INT NOT NULL,
PRIMARY KEY (`WidgetId`, `ArticleTypeId`)
);

DELETE FROM `CMS_WidgetArticleTypeRelation`;

INSERT INTO `CMS_WidgetArticleTypeRelation` (WidgetId, ArticleTypeId)
SELECT T0.ID, T1.ID FROM `ArticleListWidget` T0
INNER JOIN `ArticleType` T1 ON T0.ArticleTypeID = T1.ID OR T0.ArticleTypeID = T1.ParentID
UNION
SELECT T0.ID, T1.ID FROM `ArticleTopWidget` T0
INNER JOIN `ArticleType` T1 ON T0.ArticleTypeID = T1.ID OR T0.ArticleTypeID = T1.ParentID
UNION
SELECT T0.ID, T1.ID FROM `ArticleTypeWidget` T0
INNER JOIN `ArticleType` T1 ON T0.ArticleTypeID = T1.ID OR T0.ArticleTypeID = T1.ParentID;

CREATE TABLE IF NOT EXISTS `ProductCategoryRelation` (
`ProductId` VARCHAR(100) NOT NULL,
`ProductCategoryId` VARCHAR(100) NOT NULL,
PRIMARY KEY (`ProductId`, `ProductCategoryId`)
);

DELETE FROM `ProductCategoryRelation`;

INSERT INTO `ProductCategoryRelation` (ProductId, ProductCategoryId)
SELECT DISTINCT IFNULL(ContentID, ID), ProductCategoryID FROM `Product`;

CREATE TABLE IF NOT EXISTS `CMS_WidgetProductCategoryRelation` (
`WidgetId` VARCHAR(100) NOT NULL,
`ProductCategoryId` INT NOT NULL,
PRIMARY KEY (`WidgetId`, `ProductCategoryId`)
);

DELETE FROM `CMS_WidgetProductCategoryRelation`;

INSERT INTO `CMS_WidgetProductCategoryRelation` (WidgetId, ProductCategoryId)
SELECT T0.ID, T1.ID FROM `ProductListWidget` T0
INNER JOIN `ProductCategory` T1 ON T0.ProductCategoryID = T1.ID OR T0.ProductCategoryID = T1.ParentID
UNION
SELECT T0.ID, T1.ID FROM `ProductCategoryWidget` T0
INNER JOIN `ProductCategory` T1 ON T0.ProductCategoryID = T1.ID OR T0.ProductCategoryID = T1.ParentID;

CREATE TABLE IF NOT EXISTS `VideoTypeRelation` (
`VideoId` VARCHAR(100) NOT NULL,
`VideoTypeId` VARCHAR(100) NOT NULL,
PRIMARY KEY (`VideoId`, `VideoTypeId`)
);

DELETE FROM `VideoTypeRelation`;

INSERT INTO `VideoTypeRelation` (VideoId, VideoTypeId)
SELECT DISTINCT IFNULL(ContentID, ID), VideoTypeID FROM `Video`;

CREATE TABLE IF NOT EXISTS `CMS_WidgetVideoTypeRelation` (
`WidgetId` VARCHAR(100) NOT NULL,
`VideoTypeId` INT NOT NULL,
PRIMARY KEY (`WidgetId`, `VideoTypeId`)
);

DELETE FROM `CMS_WidgetVideoTypeRelation`;

INSERT INTO `CMS_WidgetVideoTypeRelation` (WidgetId, VideoTypeId)
SELECT T0.ID, T1.ID FROM `VideoListWidget` T0
INNER JOIN `VideoType` T1 ON T0.VideoTypeID = T1.ID OR T0.VideoTypeID = T1.ParentID
UNION
SELECT T0.ID, T1.ID FROM `VideoTopWidget` T0
INNER JOIN `VideoType` T1 ON T0.VideoTypeID = T1.ID OR T0.VideoTypeID = T1.ParentID
UNION
SELECT T0.ID, T1.ID FROM `VideoTypeWidget` T0
INNER JOIN `VideoType` T1 ON T0.VideoTypeID = T1.ID OR T0.VideoTypeID = T1.ParentID;
83 changes: 83 additions & 0 deletions Database/Update/4.1/Enterprise.Sqlite.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
CREATE TABLE IF NOT EXISTS ArticleTypeRelation (
ArticleId TEXT NOT NULL,
ArticleTypeId TEXT NOT NULL,
PRIMARY KEY (ArticleId, ArticleTypeId)
);

DELETE FROM ArticleTypeRelation;

INSERT INTO ArticleTypeRelation (ArticleId, ArticleTypeId)
SELECT DISTINCT IFNULL(ContentID, ID), ArticleTypeID FROM Article;

CREATE TABLE IF NOT EXISTS CMS_WidgetArticleTypeRelation (
WidgetId TEXT NOT NULL,
ArticleTypeId INTEGER NOT NULL,
PRIMARY KEY (WidgetId, ArticleTypeId)
);

DELETE FROM CMS_WidgetArticleTypeRelation;

INSERT INTO CMS_WidgetArticleTypeRelation (WidgetId, ArticleTypeId)
SELECT T0.ID, T1.ID FROM ArticleListWidget T0
INNER JOIN ArticleType T1 ON T0.ArticleTypeID = T1.ID OR T0.ArticleTypeID = T1.ParentID
UNION
SELECT T0.ID, T1.ID FROM ArticleTopWidget T0
INNER JOIN ArticleType T1 ON T0.ArticleTypeID = T1.ID OR T0.ArticleTypeID = T1.ParentID
UNION
SELECT T0.ID, T1.ID FROM ArticleTypeWidget T0
INNER JOIN ArticleType T1 ON T0.ArticleTypeID = T1.ID OR T0.ArticleTypeID = T1.ParentID;

CREATE TABLE IF NOT EXISTS ProductCategoryRelation (
ProductId TEXT NOT NULL,
ProductCategoryId TEXT NOT NULL,
PRIMARY KEY (ProductId, ProductCategoryId)
);

DELETE FROM ProductCategoryRelation;

INSERT INTO ProductCategoryRelation (ProductId, ProductCategoryId)
SELECT DISTINCT IFNULL(ContentID, ID), ProductCategoryID FROM Product;

CREATE TABLE IF NOT EXISTS CMS_WidgetProductCategoryRelation (
WidgetId TEXT NOT NULL,
ProductCategoryId INTEGER NOT NULL,
PRIMARY KEY (WidgetId, ProductCategoryId)
);

DELETE FROM CMS_WidgetProductCategoryRelation;

INSERT INTO CMS_WidgetProductCategoryRelation (WidgetId, ProductCategoryId)
SELECT T0.ID, T1.ID FROM ProductListWidget T0
INNER JOIN ProductCategory T1 ON T0.ProductCategoryID = T1.ID OR T0.ProductCategoryID = T1.ParentID
UNION
SELECT T0.ID, T1.ID FROM ProductCategoryWidget T0
INNER JOIN ProductCategory T1 ON T0.ProductCategoryID = T1.ID OR T0.ProductCategoryID = T1.ParentID;

CREATE TABLE IF NOT EXISTS VideoTypeRelation (
VideoId TEXT NOT NULL,
VideoTypeId TEXT NOT NULL,
PRIMARY KEY (VideoId, VideoTypeId)
);

DELETE FROM VideoTypeRelation;

INSERT INTO VideoTypeRelation (VideoId, VideoTypeId)
SELECT DISTINCT IFNULL(ContentID, ID), VideoTypeID FROM Video;

CREATE TABLE IF NOT EXISTS CMS_WidgetVideoTypeRelation (
WidgetId TEXT NOT NULL,
VideoTypeId INTEGER NOT NULL,
PRIMARY KEY (WidgetId, VideoTypeId)
);

DELETE FROM CMS_WidgetVideoTypeRelation;

INSERT INTO CMS_WidgetVideoTypeRelation (WidgetId, VideoTypeId)
SELECT T0.ID, T1.ID FROM VideoListWidget T0
INNER JOIN VideoType T1 ON T0.VideoTypeID = T1.ID OR T0.VideoTypeID = T1.ParentID
UNION
SELECT T0.ID, T1.ID FROM VideoTopWidget T0
INNER JOIN VideoType T1 ON T0.VideoTypeID = T1.ID OR T0.VideoTypeID = T1.ParentID
UNION
SELECT T0.ID, T1.ID FROM VideoTypeWidget T0
INNER JOIN VideoType T1 ON T0.VideoTypeID = T1.ID OR T0.VideoTypeID = T1.ParentID;
Binary file added Database/Update/4.1/package.zip
Binary file not shown.
4 changes: 4 additions & 0 deletions Database/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@
{
"Version": "4.0",
"Resolved": "Update/4.0/package.zip"
},
{
"Version": "4.1",
"Resolved": "Update/4.1/package.zip"
}
]
}
2 changes: 1 addition & 1 deletion src/EasyFrameWork/EasyFrameWork.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@
<PackageReference Include="System.Reflection.Extensions" Version="4.3.0" />
<PackageReference Include="System.Reflection.TypeExtensions" Version="4.7.0" />
<PackageReference Include="System.Runtime.Loader" Version="4.3.0" />
<PackageReference Include="YamlDotNet" Version="16.1.0" />
<PackageReference Include="YamlDotNet" Version="16.1.3" />
</ItemGroup>
</Project>
21 changes: 21 additions & 0 deletions src/EasyFrameWork/Extend/ExtObject.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/* http://www.zkea.net/
* Copyright (c) ZKEASOFT. All rights reserved.
* http://www.zkea.net/licenses */

using Easy.Serializer;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Easy.Extend
{
public static class ExtObject
{
public static T Clone<T>(this T obj) where T : class
{
return JsonConverter.Deserialize<T>(JsonConverter.Serialize(obj));
}
}
}
Loading

0 comments on commit d1a677c

Please sign in to comment.