通用文档管理
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
//--------------------------------------------------------------------
|
||||
// 此代码由T4模板自动生成 byzhouhang 20210918
|
||||
// 生成时间 2022-03-31 13:18:56
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
using IRaCIS.Core.Domain.Models;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using IRaCIS.Core.Application.Interfaces;
|
||||
using IRaCIS.Core.Application.ViewModel;
|
||||
namespace IRaCIS.Core.Application.Service
|
||||
{
|
||||
/// <summary>
|
||||
/// CommonDocumentService
|
||||
/// </summary>
|
||||
[ApiExplorerSettings(GroupName = "Common")]
|
||||
public class CommonDocumentService : BaseService, ICommonDocumentService
|
||||
{
|
||||
|
||||
private readonly IRepository<CommonDocument> _commonDocumentRepository;
|
||||
|
||||
public CommonDocumentService(IRepository<CommonDocument> commonDocumentRepository)
|
||||
{
|
||||
_commonDocumentRepository = commonDocumentRepository;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<List<CommonDocumentView>> GetCommonDocumentList(CommonDocumentQuery queryCommonDocument)
|
||||
{
|
||||
|
||||
|
||||
var commonDocumentQueryable = _commonDocumentRepository.ProjectTo<CommonDocumentView>(_mapper.ConfigurationProvider);
|
||||
|
||||
return await commonDocumentQueryable.ToListAsync();
|
||||
}
|
||||
|
||||
|
||||
public async Task<IResponseOutput> AddOrUpdateCommonDocument(CommonDocumentAddOrEdit addOrEditCommonDocument)
|
||||
{
|
||||
var verifyExp1 = new EntityVerifyExp<CommonDocument>()
|
||||
{
|
||||
VerifyExp = t => t.Code == addOrEditCommonDocument.Code,
|
||||
VerifyMsg = "Document Code Can not Repeat."
|
||||
};
|
||||
|
||||
var entity = await _commonDocumentRepository.InsertOrUpdateAsync(addOrEditCommonDocument, true, verifyExp1);
|
||||
|
||||
return ResponseOutput.Ok(entity.Id.ToString());
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
//--------------------------------------------------------------------
|
||||
// 此代码由T4模板自动生成 byzhouhang 20210918
|
||||
// 生成时间 2022-03-31 13:18:48
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
|
||||
//--------------------------------------------------------------------
|
||||
using System;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using System.Collections.Generic;
|
||||
namespace IRaCIS.Core.Application.ViewModel
|
||||
{
|
||||
/// <summary> CommonDocumentView 列表视图模型 </summary>
|
||||
public class CommonDocumentView : CommonDocumentAddOrEdit
|
||||
{
|
||||
|
||||
//public string FileType { get; set; } = String.Empty;
|
||||
//public string ModuleType { get; set; } = String.Empty;
|
||||
|
||||
|
||||
|
||||
public DateTime CreateTime { get; set; }
|
||||
public DateTime UpdateTime { get; set; }
|
||||
|
||||
}
|
||||
|
||||
///<summary>CommonDocumentQuery 列表查询参数模型</summary>
|
||||
public class CommonDocumentQuery
|
||||
{
|
||||
public Guid? FileTypeId { get; set; }
|
||||
public Guid? ModuleId { get; set; }
|
||||
public string Name { get; set; } = String.Empty;
|
||||
|
||||
public string Code { get; set; } = String.Empty;
|
||||
|
||||
}
|
||||
|
||||
///<summary> CommonDocumentAddOrEdit 列表查询参数模型</summary>
|
||||
public class CommonDocumentAddOrEdit
|
||||
{
|
||||
public Guid? Id { get; set; }
|
||||
public string Name { get; set; } = String.Empty;
|
||||
public string Path { get; set; } = String.Empty;
|
||||
public string Description { get; set; } = String.Empty;
|
||||
public bool IsDeleted { get; set; }
|
||||
public string Code { get; set; } = String.Empty;
|
||||
public Guid FileTypeId { get; set; }
|
||||
public Guid ModuleId { get; set; }
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
//--------------------------------------------------------------------
|
||||
// 此代码由T4模板自动生成 byzhouhang 20210918
|
||||
// 生成时间 2022-03-31 13:18:53
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
|
||||
//--------------------------------------------------------------------
|
||||
|
||||
using IRaCIS.Core.Application.ViewModel;
|
||||
namespace IRaCIS.Core.Application.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// ICommonDocumentService
|
||||
/// </summary>
|
||||
public interface ICommonDocumentService
|
||||
{
|
||||
|
||||
|
||||
Task<List<CommonDocumentView>> GetCommonDocumentList(CommonDocumentQuery queryCommonDocument);
|
||||
|
||||
Task<IResponseOutput> AddOrUpdateCommonDocument(CommonDocumentAddOrEdit addOrEditCommonDocument);
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -42,6 +42,12 @@ namespace IRaCIS.Core.Application.Service
|
||||
CreateMap<Dictionary, BasicDicSelect>()
|
||||
.ForMember(o => o.ParentCode, t => t.MapFrom(u => u.Parent.Code));
|
||||
|
||||
|
||||
CreateMap<CommonDocument, CommonDocumentView>();
|
||||
|
||||
CreateMap<CommonDocument, CommonDocumentAddOrEdit>().ReverseMap();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user