This commit is contained in:
2022-03-28 16:51:07 +08:00
parent 4fb48e11d2
commit d4ac1a3a7e
9 changed files with 466 additions and 149 deletions
@@ -0,0 +1,77 @@
//--------------------------------------------------------------------
// 此代码由T4模板自动生成 byzhouhang 20210918
// 生成时间 2022-03-28 16:43:52
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
//--------------------------------------------------------------------
using System;
using IRaCIS.Core.Domain.Share;
using System.Collections.Generic;
namespace IRaCIS.Core.Application.ViewModel
{
/// <summary> FrontAuditConfigView 列表视图模型 </summary>
public class FrontAuditConfigView
{
public Guid Id { get; set; }
public string Value { get; set; }
public string ValueCN { get; set; }
public string Description { get; set; }
public DateTime CreateTime { get; set; }
public Guid CreateUserId { get; set; }
public DateTime UpdateTime { get; set; }
public Guid UpdateUserId { get; set; }
public string Code { get; set; }
public Guid? ParentId { get; set; }
public bool IsEnable { get; set; }
public bool IsConfig { get; set; }
public int? ModuleTypeId { get; set; }
public string OptTypeId { get; set; }
public string ChildrenTypeId { get; set; }
}
///<summary>FrontAuditConfigQuery 列表查询参数模型</summary>
public class FrontAuditConfigQuery
{
///<summary> Value</summary>
public string Value { get; set; }
///<summary> ValueCN</summary>
public string ValueCN { get; set; }
///<summary> Description</summary>
public string Description { get; set; }
///<summary> Code</summary>
public string Code { get; set; }
///<summary> OptTypeId </summary>
public string OptTypeId { get; set; }
///<summary> ChildrenTypeId</summary>
public string ChildrenTypeId { get; set; }
}
///<summary> FrontAuditConfigAddOrEdit 列表查询参数模型</summary>
public class FrontAuditConfigAddOrEdit
{
public Guid Id { get; set; }
public string Value { get; set; }
public string ValueCN { get; set; }
public string Description { get; set; }
public DateTime CreateTime { get; set; }
public Guid CreateUserId { get; set; }
public DateTime UpdateTime { get; set; }
public Guid UpdateUserId { get; set; }
public string Code { get; set; }
public Guid? ParentId { get; set; }
public bool IsEnable { get; set; }
public bool IsConfig { get; set; }
public int? ModuleTypeId { get; set; }
public string OptTypeId { get; set; }
public string ChildrenTypeId { get; set; }
}
}
@@ -0,0 +1,66 @@
//--------------------------------------------------------------------
// 此代码由T4模板自动生成 byzhouhang 20210918
// 生成时间 2022-03-28 16:46:23
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
//--------------------------------------------------------------------
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>
/// FrontAuditConfigService
/// </summary>
[ApiExplorerSettings(GroupName = "Test")]
public class FrontAuditConfigService : BaseService, IFrontAuditConfigService
{
private readonly IRepository<FrontAuditConfig> _frontAuditConfigRepository;
public FrontAuditConfigService(IRepository<FrontAuditConfig> frontAuditConfigRepository)
{
_frontAuditConfigRepository = frontAuditConfigRepository;
}
public async Task<List<FrontAuditConfigView>> GetFrontAuditConfigList(FrontAuditConfigQuery queryFrontAuditConfig)
{
var frontAuditConfigQueryable = _repository.GetQueryable<FrontAuditConfig>()
.ProjectTo<FrontAuditConfigView>(_mapper.ConfigurationProvider);
return await frontAuditConfigQueryable.ToListAsync();
}
public async Task<IResponseOutput> AddOrUpdateFrontAuditConfig(FrontAuditConfigAddOrEdit addOrEditFrontAuditConfig)
{
// 在此处拷贝automapper 映射
//CreateMap<FrontAuditConfig, FrontAuditConfigView>();
// CreateMap< FrontAuditConfig,FrontAuditConfigAddOrEdit>().ReverseMap();
var entity = await _repository.InsertOrUpdateAsync<FrontAuditConfig, FrontAuditConfigAddOrEdit>(addOrEditFrontAuditConfig, true);
return ResponseOutput.Ok(entity.Id.ToString());
}
[HttpDelete("{frontAuditConfigId:guid}")]
public async Task<IResponseOutput> DeleteFrontAuditConfig(Guid frontAuditConfigId)
{
var success = await _repository.DeleteFromQueryAsync<FrontAuditConfig>(t => t.Id == frontAuditConfigId);
return ResponseOutput.Result(success);
}
}
}
@@ -0,0 +1,25 @@
//--------------------------------------------------------------------
// 此代码由T4模板自动生成 byzhouhang 20210918
// 生成时间 2022-03-28 16:46:20
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
//--------------------------------------------------------------------
using IRaCIS.Core.Application.ViewModel;
namespace IRaCIS.Core.Application.Interfaces
{
/// <summary>
/// IFrontAuditConfigService
/// </summary>
public interface IFrontAuditConfigService
{
Task<List<FrontAuditConfigView>> GetFrontAuditConfigList(FrontAuditConfigQuery queryFrontAuditConfig);
Task<IResponseOutput> AddOrUpdateFrontAuditConfig(FrontAuditConfigAddOrEdit addOrEditFrontAuditConfig);
Task<IResponseOutput> DeleteFrontAuditConfig(Guid frontAuditConfigId);
}
}