|
@@ -2,8 +2,8 @@
|
|
|
using Exam.Infrastructure.Data.Interface;
|
|
|
using FluentValidation;
|
|
|
using Hotline.Repository.SqlSugar.Exam.Core.Constants;
|
|
|
-using Hotline.Repository.SqlSugar.Extensions;
|
|
|
-using Hotline.Repository.SqlSugar.Interface;
|
|
|
+using Hotline.Repository.SqlSugar.Exam.Extensions;
|
|
|
+using Hotline.Repository.SqlSugar.Exam.Interface;
|
|
|
using Mapster;
|
|
|
using MapsterMapper;
|
|
|
using Microsoft.AspNetCore.Http;
|
|
@@ -14,11 +14,11 @@ using XF.Domain.Authentications;
|
|
|
using XF.Domain.Entities;
|
|
|
using XF.Domain.Repository;
|
|
|
|
|
|
-namespace Exam.Insfrastructure.Service.Service
|
|
|
+namespace Hotline.Repository.SqlSugar.Exam.Service
|
|
|
{
|
|
|
- public class ApiService<T,TAdd, TUpdate, TDBContext> : IApiService<TAdd,TUpdate, T>
|
|
|
+ public class ApiService<T, TAdd, TUpdate, TDBContext> : IApiService<TAdd, TUpdate, T>
|
|
|
where TAdd : IAddRequest
|
|
|
- where TUpdate: IActionRequest
|
|
|
+ where TUpdate : IActionRequest
|
|
|
where T : class, IEntity<string>, IHasCreationTime, IDataPermission, new()
|
|
|
where TDBContext : SugarUnitOfWork, new()
|
|
|
{
|
|
@@ -36,14 +36,14 @@ namespace Exam.Insfrastructure.Service.Service
|
|
|
|
|
|
public T Entity { get; set; }
|
|
|
|
|
|
- public ApiService(IExamRepository<T, TDBContext> repository,IMapper mapper,ISessionContext sessionContext = null)
|
|
|
+ public ApiService(IExamRepository<T, TDBContext> repository, IMapper mapper, ISessionContext sessionContext = null)
|
|
|
{
|
|
|
_repository = repository;
|
|
|
_validator = _repository.Validator;
|
|
|
_mapper = mapper;
|
|
|
- this._sessionContext = sessionContext;
|
|
|
+ _sessionContext = sessionContext;
|
|
|
_uow = _repository.UOW;
|
|
|
- }
|
|
|
+ }
|
|
|
#endregion
|
|
|
|
|
|
#region public method
|
|
@@ -53,7 +53,7 @@ namespace Exam.Insfrastructure.Service.Service
|
|
|
_isStartTrain = true;
|
|
|
}
|
|
|
|
|
|
- public InsertNavTaskInit<T,T> AddNav(T entity)
|
|
|
+ public InsertNavTaskInit<T, T> AddNav(T entity)
|
|
|
{
|
|
|
return _repository.AddNav(entity);
|
|
|
}
|
|
@@ -74,7 +74,7 @@ namespace Exam.Insfrastructure.Service.Service
|
|
|
/// <param name="entity"></param>
|
|
|
/// <param name="operationConstant"></param>
|
|
|
/// <returns></returns>
|
|
|
- public async Task Complete(T entity,string operationConstant)
|
|
|
+ public async Task Complete(T entity, string operationConstant)
|
|
|
{
|
|
|
if (_isStartTrain)
|
|
|
{
|
|
@@ -93,7 +93,7 @@ namespace Exam.Insfrastructure.Service.Service
|
|
|
await CompleteAdd(entity);
|
|
|
break;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -265,7 +265,7 @@ namespace Exam.Insfrastructure.Service.Service
|
|
|
{
|
|
|
var entity = await _repository.GetAsync(actionRequest.Id);
|
|
|
|
|
|
- entity = _mapper.Map<TUpdate, T>(actionRequest,entity);
|
|
|
+ entity = _mapper.Map(actionRequest, entity);
|
|
|
|
|
|
entity.ToUpdate(_sessionContext);
|
|
|
|
|
@@ -292,7 +292,7 @@ namespace Exam.Insfrastructure.Service.Service
|
|
|
var ids = actionRequests.Select(x => x.Id).ToList();
|
|
|
var entities = await _repository.QueryAsync(x => ids.Contains(x.Id));
|
|
|
|
|
|
- entities = _mapper.Map<List<TUpdate>, List<T>>(actionRequests,entities);
|
|
|
+ entities = _mapper.Map(actionRequests, entities);
|
|
|
|
|
|
entities.ToUpdate(_sessionContext);
|
|
|
if (_isStartTrain)
|