Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
EShop
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tsai
EShop
Commits
af143ef3
Commit
af143ef3
authored
May 02, 2020
by
gdlcf88
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added history application services
parent
cd6f6254
Changes
17
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
2776 additions
and
0 deletions
+2776
-0
GetProductDetailHistoryListDto.cs
...uctDetailHistories/Dtos/GetProductDetailHistoryListDto.cs
+10
-0
ProductDetailHistoryDto.cs
...ts/ProductDetailHistories/Dtos/ProductDetailHistoryDto.cs
+14
-0
IProductDetailHistoryAppService.cs
...ProductDetailHistories/IProductDetailHistoryAppService.cs
+19
-0
GetProductHistoryListDto.cs
...roducts/ProductHistories/Dtos/GetProductHistoryListDto.cs
+10
-0
ProductHistoryDto.cs
...EShop/Products/ProductHistories/Dtos/ProductHistoryDto.cs
+14
-0
IProductDetailHistoryAppService.cs
...ducts/ProductHistories/IProductDetailHistoryAppService.cs
+18
-0
ProductDetailHistoryAppService.cs
.../ProductDetailHistories/ProductDetailHistoryAppService.cs
+53
-0
ProductHistoryAppService.cs
...hop/Products/ProductHistories/ProductHistoryAppService.cs
+53
-0
ProductsApplicationAutoMapperProfile.cs
...bp/EShop/Products/ProductsApplicationAutoMapperProfile.cs
+5
-0
IProductDetailHistoryRepository.cs
...ProductDetailHistories/IProductDetailHistoryRepository.cs
+4
-0
IProductHistoryRepository.cs
...op/Products/ProductHistories/IProductHistoryRepository.cs
+4
-0
ProductsDbContextModelCreatingExtensions.cs
...FrameworkCore/ProductsDbContextModelCreatingExtensions.cs
+4
-0
ProductDetailHistoryRepository.cs
.../ProductDetailHistories/ProductDetailHistoryRepository.cs
+19
-0
ProductHistoryRepository.cs
...hop/Products/ProductHistories/ProductHistoryRepository.cs
+19
-0
20200502095135_AddedHistoryEntityIndexes.Designer.cs
...ions/20200502095135_AddedHistoryEntityIndexes.Designer.cs
+2473
-0
20200502095135_AddedHistoryEntityIndexes.cs
...ns/Migrations/20200502095135_AddedHistoryEntityIndexes.cs
+49
-0
EasyMallMigrationsDbContextModelSnapshot.cs
...ns/Migrations/EasyMallMigrationsDbContextModelSnapshot.cs
+8
-0
No files found.
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/ProductDetailHistories/Dtos/GetProductDetailHistoryListDto.cs
0 → 100644
View file @
af143ef3
using
System
;
using
Volo.Abp.Application.Dtos
;
namespace
EasyAbp.EShop.Products.ProductDetailHistories.Dtos
{
public
class
GetProductDetailHistoryListDto
:
PagedAndSortedResultRequestDto
{
public
Guid
ProductDetailId
{
get
;
set
;
}
}
}
\ No newline at end of file
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/ProductDetailHistories/Dtos/ProductDetailHistoryDto.cs
0 → 100644
View file @
af143ef3
using
System
;
using
Volo.Abp.Application.Dtos
;
namespace
EasyAbp.EShop.Products.ProductDetailHistories.Dtos
{
public
class
ProductDetailHistoryDto
:
EntityDto
<
Guid
>
{
public
Guid
ProductDetailId
{
get
;
set
;
}
public
DateTime
ModificationTime
{
get
;
set
;
}
public
string
SerializedDto
{
get
;
set
;
}
}
}
\ No newline at end of file
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/ProductDetailHistories/IProductDetailHistoryAppService.cs
0 → 100644
View file @
af143ef3
using
System
;
using
System.Threading.Tasks
;
using
EasyAbp.EShop.Products.ProductDetailHistories.Dtos
;
using
Volo.Abp.Application.Dtos
;
using
Volo.Abp.Application.Services
;
namespace
EasyAbp.EShop.Products.ProductDetailHistories
{
public
interface
IProductDetailHistoryAppService
:
ICrudAppService
<
ProductDetailHistoryDto
,
Guid
,
GetProductDetailHistoryListDto
,
object
,
object
>
{
Task
<
ProductDetailHistoryDto
>
GetByTimeAsync
(
Guid
productId
,
DateTime
modificationTime
);
}
}
\ No newline at end of file
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/ProductHistories/Dtos/GetProductHistoryListDto.cs
0 → 100644
View file @
af143ef3
using
System
;
using
Volo.Abp.Application.Dtos
;
namespace
EasyAbp.EShop.Products.ProductHistories.Dtos
{
public
class
GetProductHistoryListDto
:
PagedAndSortedResultRequestDto
{
public
Guid
ProductId
{
get
;
set
;
}
}
}
\ No newline at end of file
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/ProductHistories/Dtos/ProductHistoryDto.cs
0 → 100644
View file @
af143ef3
using
System
;
using
Volo.Abp.Application.Dtos
;
namespace
EasyAbp.EShop.Products.ProductHistories.Dtos
{
public
class
ProductHistoryDto
:
EntityDto
<
Guid
>
{
public
Guid
ProductId
{
get
;
set
;
}
public
DateTime
ModificationTime
{
get
;
set
;
}
public
string
SerializedDto
{
get
;
set
;
}
}
}
\ No newline at end of file
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/ProductHistories/IProductDetailHistoryAppService.cs
0 → 100644
View file @
af143ef3
using
System
;
using
System.Threading.Tasks
;
using
EasyAbp.EShop.Products.ProductHistories.Dtos
;
using
Volo.Abp.Application.Services
;
namespace
EasyAbp.EShop.Products.ProductHistories
{
public
interface
IProductHistoryAppService
:
ICrudAppService
<
ProductHistoryDto
,
Guid
,
GetProductHistoryListDto
,
object
,
object
>
{
Task
<
ProductHistoryDto
>
GetByTimeAsync
(
Guid
productId
,
DateTime
modificationTime
);
}
}
\ No newline at end of file
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/ProductDetailHistories/ProductDetailHistoryAppService.cs
0 → 100644
View file @
af143ef3
using
System
;
using
System.Linq
;
using
System.Threading.Tasks
;
using
EasyAbp.EShop.Products.Authorization
;
using
EasyAbp.EShop.Products.ProductDetailHistories.Dtos
;
using
Volo.Abp
;
using
Volo.Abp.Application.Services
;
namespace
EasyAbp.EShop.Products.ProductDetailHistories
{
public
class
ProductDetailHistoryAppService
:
CrudAppService
<
ProductDetailHistory
,
ProductDetailHistoryDto
,
Guid
,
GetProductDetailHistoryListDto
,
object
,
object
>,
IProductDetailHistoryAppService
{
protected
override
string
GetListPolicyName
{
get
;
set
;
}
=
ProductsPermissions
.
Products
.
Default
;
private
readonly
IProductDetailHistoryRepository
_repository
;
public
ProductDetailHistoryAppService
(
IProductDetailHistoryRepository
repository
)
:
base
(
repository
)
{
_repository
=
repository
;
}
protected
override
IQueryable
<
ProductDetailHistory
>
CreateFilteredQuery
(
GetProductDetailHistoryListDto
input
)
{
return
base
.
CreateFilteredQuery
(
input
).
Where
(
x
=>
x
.
ProductDetailId
==
input
.
ProductDetailId
);
}
public
async
Task
<
ProductDetailHistoryDto
>
GetByTimeAsync
(
Guid
productId
,
DateTime
modificationTime
)
{
await
CheckGetPolicyAsync
();
return
MapToGetOutputDto
(
await
_repository
.
GetAsync
(
productId
,
modificationTime
));
}
[
RemoteService
(
false
)]
public
override
Task
<
ProductDetailHistoryDto
>
CreateAsync
(
object
input
)
{
throw
new
NotImplementedException
();
}
[
RemoteService
(
false
)]
public
override
Task
<
ProductDetailHistoryDto
>
UpdateAsync
(
Guid
id
,
object
input
)
{
throw
new
NotImplementedException
();
}
[
RemoteService
(
false
)]
public
override
Task
DeleteAsync
(
Guid
id
)
{
throw
new
NotImplementedException
();
}
}
}
\ No newline at end of file
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/ProductHistories/ProductHistoryAppService.cs
0 → 100644
View file @
af143ef3
using
System
;
using
System.Linq
;
using
System.Threading.Tasks
;
using
EasyAbp.EShop.Products.Authorization
;
using
EasyAbp.EShop.Products.ProductHistories.Dtos
;
using
Volo.Abp
;
using
Volo.Abp.Application.Services
;
namespace
EasyAbp.EShop.Products.ProductHistories
{
public
class
ProductHistoryAppService
:
CrudAppService
<
ProductHistory
,
ProductHistoryDto
,
Guid
,
GetProductHistoryListDto
,
object
,
object
>,
IProductHistoryAppService
{
protected
override
string
GetListPolicyName
{
get
;
set
;
}
=
ProductsPermissions
.
Products
.
Default
;
private
readonly
IProductHistoryRepository
_repository
;
public
ProductHistoryAppService
(
IProductHistoryRepository
repository
)
:
base
(
repository
)
{
_repository
=
repository
;
}
protected
override
IQueryable
<
ProductHistory
>
CreateFilteredQuery
(
GetProductHistoryListDto
input
)
{
return
base
.
CreateFilteredQuery
(
input
).
Where
(
x
=>
x
.
ProductId
==
input
.
ProductId
);
}
public
async
Task
<
ProductHistoryDto
>
GetByTimeAsync
(
Guid
productId
,
DateTime
modificationTime
)
{
await
CheckGetPolicyAsync
();
return
MapToGetOutputDto
(
await
_repository
.
GetAsync
(
productId
,
modificationTime
));
}
[
RemoteService
(
false
)]
public
override
Task
<
ProductHistoryDto
>
CreateAsync
(
object
input
)
{
throw
new
NotImplementedException
();
}
[
RemoteService
(
false
)]
public
override
Task
<
ProductHistoryDto
>
UpdateAsync
(
Guid
id
,
object
input
)
{
throw
new
NotImplementedException
();
}
[
RemoteService
(
false
)]
public
override
Task
DeleteAsync
(
Guid
id
)
{
throw
new
NotImplementedException
();
}
}
}
\ No newline at end of file
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/ProductsApplicationAutoMapperProfile.cs
View file @
af143ef3
...
...
@@ -10,6 +10,9 @@ using AutoMapper;
using
EasyAbp.EShop.Products.ProductDetails
;
using
EasyAbp.EShop.Products.ProductDetails.Dtos
;
using
EasyAbp.EShop.Products.ProductDetailHistories
;
using
EasyAbp.EShop.Products.ProductDetailHistories.Dtos
;
using
EasyAbp.EShop.Products.ProductHistories
;
using
EasyAbp.EShop.Products.ProductHistories.Dtos
;
using
Volo.Abp.AutoMapper
;
namespace
EasyAbp.EShop.Products
...
...
@@ -44,6 +47,8 @@ namespace EasyAbp.EShop.Products
CreateMap
<
CreateUpdateProductTypeDto
,
ProductType
>(
MemberList
.
Source
);
CreateMap
<
ProductCategory
,
ProductCategoryDto
>();
CreateMap
<
CreateUpdateProductCategoryDto
,
ProductCategory
>(
MemberList
.
Source
);
CreateMap
<
ProductHistory
,
ProductHistoryDto
>();
CreateMap
<
ProductDetailHistory
,
ProductDetailHistoryDto
>();
}
}
}
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/ProductDetailHistories/IProductDetailHistoryRepository.cs
View file @
af143ef3
using
System
;
using
System.Threading
;
using
System.Threading.Tasks
;
using
Volo.Abp.Domain.Repositories
;
namespace
EasyAbp.EShop.Products.ProductDetailHistories
{
public
interface
IProductDetailHistoryRepository
:
IRepository
<
ProductDetailHistory
,
Guid
>
{
Task
<
ProductDetailHistory
>
GetAsync
(
Guid
productDetailId
,
DateTime
modificationTime
,
CancellationToken
cancellationToken
=
default
);
}
}
\ No newline at end of file
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/ProductHistories/IProductHistoryRepository.cs
View file @
af143ef3
using
System
;
using
System.Threading
;
using
System.Threading.Tasks
;
using
Volo.Abp.Domain.Repositories
;
namespace
EasyAbp.EShop.Products.ProductHistories
{
public
interface
IProductHistoryRepository
:
IRepository
<
ProductHistory
,
Guid
>
{
Task
<
ProductHistory
>
GetAsync
(
Guid
productId
,
DateTime
modificationTime
,
CancellationToken
cancellationToken
=
default
);
}
}
\ No newline at end of file
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.EntityFrameworkCore/EasyAbp/EShop/Products/EntityFrameworkCore/ProductsDbContextModelCreatingExtensions.cs
View file @
af143ef3
...
...
@@ -118,6 +118,8 @@ namespace EasyAbp.EShop.Products.EntityFrameworkCore
b
.
ToTable
(
options
.
TablePrefix
+
"ProductHistories"
,
options
.
Schema
);
b
.
ConfigureByConvention
();
/* Configure more properties here */
b
.
HasIndex
(
x
=>
x
.
ProductId
);
b
.
HasIndex
(
x
=>
x
.
ModificationTime
);
});
builder
.
Entity
<
ProductDetailHistory
>(
b
=>
...
...
@@ -125,6 +127,8 @@ namespace EasyAbp.EShop.Products.EntityFrameworkCore
b
.
ToTable
(
options
.
TablePrefix
+
"ProductDetailHistories"
,
options
.
Schema
);
b
.
ConfigureByConvention
();
/* Configure more properties here */
b
.
HasIndex
(
x
=>
x
.
ProductDetailId
);
b
.
HasIndex
(
x
=>
x
.
ModificationTime
);
});
}
}
...
...
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.EntityFrameworkCore/EasyAbp/EShop/Products/ProductDetailHistories/ProductDetailHistoryRepository.cs
View file @
af143ef3
using
System
;
using
System.Linq
;
using
System.Threading
;
using
System.Threading.Tasks
;
using
EasyAbp.EShop.Products.EntityFrameworkCore
;
using
Microsoft.EntityFrameworkCore
;
using
Volo.Abp.Domain.Entities
;
using
Volo.Abp.Domain.Repositories.EntityFrameworkCore
;
using
Volo.Abp.EntityFrameworkCore
;
...
...
@@ -10,5 +15,19 @@ namespace EasyAbp.EShop.Products.ProductDetailHistories
public
ProductDetailHistoryRepository
(
IDbContextProvider
<
ProductsDbContext
>
dbContextProvider
)
:
base
(
dbContextProvider
)
{
}
public
async
Task
<
ProductDetailHistory
>
GetAsync
(
Guid
productDetailId
,
DateTime
modificationTime
,
CancellationToken
cancellationToken
=
default
)
{
var
entity
=
await
GetQueryable
()
.
Where
(
x
=>
x
.
ModificationTime
==
modificationTime
&&
x
.
ProductDetailId
==
productDetailId
)
.
FirstOrDefaultAsync
(
cancellationToken
);
if
(
entity
==
null
)
{
throw
new
EntityNotFoundException
(
typeof
(
ProductDetailHistory
),
new
{
productDetailId
,
modificationTime
});
}
return
entity
;
}
}
}
\ No newline at end of file
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.EntityFrameworkCore/EasyAbp/EShop/Products/ProductHistories/ProductHistoryRepository.cs
View file @
af143ef3
using
System
;
using
System.Linq
;
using
System.Threading
;
using
System.Threading.Tasks
;
using
EasyAbp.EShop.Products.EntityFrameworkCore
;
using
Microsoft.EntityFrameworkCore
;
using
Volo.Abp.Domain.Entities
;
using
Volo.Abp.Domain.Repositories.EntityFrameworkCore
;
using
Volo.Abp.EntityFrameworkCore
;
...
...
@@ -10,5 +15,19 @@ namespace EasyAbp.EShop.Products.ProductHistories
public
ProductHistoryRepository
(
IDbContextProvider
<
ProductsDbContext
>
dbContextProvider
)
:
base
(
dbContextProvider
)
{
}
public
async
Task
<
ProductHistory
>
GetAsync
(
Guid
productId
,
DateTime
modificationTime
,
CancellationToken
cancellationToken
=
default
)
{
var
entity
=
await
GetQueryable
()
.
Where
(
x
=>
x
.
ModificationTime
==
modificationTime
&&
x
.
ProductId
==
productId
)
.
FirstOrDefaultAsync
(
cancellationToken
);
if
(
entity
==
null
)
{
throw
new
EntityNotFoundException
(
typeof
(
ProductHistory
),
new
{
productId
,
modificationTime
});
}
return
entity
;
}
}
}
\ No newline at end of file
samples/EasyMall/aspnet-core/src/EasyMall.EntityFrameworkCore.DbMigrations/Migrations/20200502095135_AddedHistoryEntityIndexes.Designer.cs
0 → 100644
View file @
af143ef3
This diff is collapsed.
Click to expand it.
samples/EasyMall/aspnet-core/src/EasyMall.EntityFrameworkCore.DbMigrations/Migrations/20200502095135_AddedHistoryEntityIndexes.cs
0 → 100644
View file @
af143ef3
using
Microsoft.EntityFrameworkCore.Migrations
;
namespace
EasyMall.Migrations
{
public
partial
class
AddedHistoryEntityIndexes
:
Migration
{
protected
override
void
Up
(
MigrationBuilder
migrationBuilder
)
{
migrationBuilder
.
CreateIndex
(
name
:
"IX_ProductsProductHistories_ModificationTime"
,
table
:
"ProductsProductHistories"
,
column
:
"ModificationTime"
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_ProductsProductHistories_ProductId"
,
table
:
"ProductsProductHistories"
,
column
:
"ProductId"
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_ProductsProductDetailHistories_ModificationTime"
,
table
:
"ProductsProductDetailHistories"
,
column
:
"ModificationTime"
);
migrationBuilder
.
CreateIndex
(
name
:
"IX_ProductsProductDetailHistories_ProductDetailId"
,
table
:
"ProductsProductDetailHistories"
,
column
:
"ProductDetailId"
);
}
protected
override
void
Down
(
MigrationBuilder
migrationBuilder
)
{
migrationBuilder
.
DropIndex
(
name
:
"IX_ProductsProductHistories_ModificationTime"
,
table
:
"ProductsProductHistories"
);
migrationBuilder
.
DropIndex
(
name
:
"IX_ProductsProductHistories_ProductId"
,
table
:
"ProductsProductHistories"
);
migrationBuilder
.
DropIndex
(
name
:
"IX_ProductsProductDetailHistories_ModificationTime"
,
table
:
"ProductsProductDetailHistories"
);
migrationBuilder
.
DropIndex
(
name
:
"IX_ProductsProductDetailHistories_ProductDetailId"
,
table
:
"ProductsProductDetailHistories"
);
}
}
}
samples/EasyMall/aspnet-core/src/EasyMall.EntityFrameworkCore.DbMigrations/Migrations/EasyMallMigrationsDbContextModelSnapshot.cs
View file @
af143ef3
...
...
@@ -163,6 +163,10 @@ namespace EasyMall.Migrations
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"ModificationTime"
);
b
.
HasIndex
(
"ProductDetailId"
);
b
.
ToTable
(
"ProductsProductDetailHistories"
);
});
...
...
@@ -245,6 +249,10 @@ namespace EasyMall.Migrations
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"ModificationTime"
);
b
.
HasIndex
(
"ProductId"
);
b
.
ToTable
(
"ProductsProductHistories"
);
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment