chore:目录重构

This commit is contained in:
陈淳
2023-04-15 17:35:22 +08:00
parent a612af4f68
commit fb27fb8aa4
238 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Module.DictionaryManager
{
/// <summary>
/// 常量定义
/// </summary>
public class DictionaryConst
{
}
}

View File

@@ -0,0 +1,50 @@
using Furion.DependencyInjection;
using Furion.DynamicApiController;
using Microsoft.AspNetCore.Mvc;
using SqlSugar;
using Yi.Framework.Infrastructure.Ddd.Dtos;
using Yi.Framework.Infrastructure.Ddd.Services;
using Yi.Framework.Module.DictionaryManager.Dtos.Dictionary;
using Yi.Framework.Module.DictionaryManager.Entities;
namespace Yi.Framework.Module.DictionaryManager
{
/// <summary>
/// Dictionary服务实现
/// </summary>
public class DictionaryService : CrudAppService<DictionaryEntity, DictionaryGetOutputDto, DictionaryGetListOutputDto, long, DictionaryGetListInputVo, DictionaryCreateInputVo, DictionaryUpdateInputVo>,
IDictionaryService,IDynamicApiController,ITransient
{
/// <summary>
/// 查询
/// </summary>
public override async Task<PagedResultDto<DictionaryGetListOutputDto>> GetListAsync(DictionaryGetListInputVo input)
{
RefAsync<int> total = 0;
var entities = await _DbQueryable.WhereIF(input.DictType is not null, x => x.DictType == input.DictType)
.WhereIF(input.DictLabel is not null, x => x.DictLabel!.Contains(input.DictLabel!))
.WhereIF(input.State is not null, x => x.State == input.State)
.ToPageListAsync(input.PageNum, input.PageSize, total);
return new PagedResultDto<DictionaryGetListOutputDto>
{
Total = total,
Items = await MapToGetListOutputDtosAsync(entities)
};
}
/// <summary>
/// 根据字典类型获取字典列表
/// </summary>
/// <param name="dicType"></param>
/// <returns></returns>
[Route("/api/dictionary/dic-type/{dicType}")]
public async Task<List<DictionaryGetListOutputDto>> GetDicType([FromRoute] string dicType)
{
var entities = await _repository.GetListAsync(u => u.DictType == dicType && u.State == true);
var result = await MapToGetListOutputDtosAsync(entities);
return result;
}
}
}

View File

@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Module.DictionaryManager
{
/// <summary>
/// 常量定义
/// </summary>
public class DictionaryTypeConst
{
}
}

View File

@@ -0,0 +1,37 @@
using Furion.DependencyInjection;
using Furion.DynamicApiController;
using SqlSugar;
using Yi.Framework.Infrastructure.Ddd.Dtos;
using Yi.Framework.Infrastructure.Ddd.Services;
using Yi.Framework.Module.DictionaryManager.Dtos.DictionaryType;
using Yi.Framework.Module.DictionaryManager.Entities;
namespace Yi.Framework.Module.DictionaryManager
{
/// <summary>
/// DictionaryType服务实现
/// </summary>
public class DictionaryTypeService : CrudAppService<DictionaryTypeEntity, DictionaryTypeGetOutputDto, DictionaryTypeGetListOutputDto, long, DictionaryTypeGetListInputVo, DictionaryTypeCreateInputVo, DictionaryTypeUpdateInputVo>,
IDictionaryTypeService, IDynamicApiController, ITransient
{
public async override Task<PagedResultDto<DictionaryTypeGetListOutputDto>> GetListAsync(DictionaryTypeGetListInputVo input)
{
RefAsync<int> total = 0;
var entities = await _DbQueryable.WhereIF(input.DictName is not null, x => x.DictName.Contains(input.DictName!))
.WhereIF(input.DictType is not null, x => x.DictType!.Contains(input.DictType!))
.WhereIF(input.State is not null, x => x.State == input.State)
.WhereIF(input.StartTime is not null && input.EndTime is not null, x => x.CreationTime >= input.StartTime && x.CreationTime <= input.EndTime)
.ToPageListAsync(input.PageNum, input.PageSize, total);
return new PagedResultDto<DictionaryTypeGetListOutputDto>
{
Total = total,
Items = await MapToGetListOutputDtosAsync(entities)
};
}
}
}

View File

@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Module.DictionaryManager.Dtos.Dictionary
{
/// <summary>
/// Dictionary输入创建对象
/// </summary>
public class DictionaryCreateInputVo
{
public long Id { get; set; }
public DateTime CreationTime { get; set; } = DateTime.Now;
public long? CreatorId { get; set; }
public string? Remark { get; set; }
public string? ListClass { get; set; }
public string? CssClass { get; set; }
public string DictType { get; set; } = string.Empty;
public string? DictLabel { get; set; }
public string DictValue { get; set; } = string.Empty;
public bool IsDefault { get; set; }
public bool State { get; set; }
}
}

View File

@@ -0,0 +1,11 @@
using Yi.Framework.Infrastructure.Ddd.Dtos;
namespace Yi.Framework.Module.DictionaryManager.Dtos.Dictionary
{
public class DictionaryGetListInputVo : PagedAndSortedResultRequestDto
{
public string? DictType { get; set; }
public string? DictLabel { get; set; }
public bool? State { get; set; }
}
}

View File

@@ -0,0 +1,19 @@
using Yi.Framework.Infrastructure.Ddd.Dtos.Abstract;
namespace Yi.Framework.Module.DictionaryManager.Dtos.Dictionary
{
public class DictionaryGetListOutputDto : IEntityDto<long>
{
public long Id { get; set; }
public DateTime CreationTime { get; set; } = DateTime.Now;
public long? CreatorId { get; set; }
public string? Remark { get; set; }
public string? ListClass { get; set; }
public string? CssClass { get; set; }
public string DictType { get; set; } = string.Empty;
public string? DictLabel { get; set; }
public string DictValue { get; set; } = string.Empty;
public bool IsDefault { get; set; }
public bool State { get; set; }
}
}

View File

@@ -0,0 +1,20 @@
using Yi.Framework.Infrastructure.Ddd.Dtos.Abstract;
namespace Yi.Framework.Module.DictionaryManager.Dtos.Dictionary
{
public class DictionaryGetOutputDto : IEntityDto<long>
{
public long Id { get; set; }
public DateTime CreationTime { get; set; } = DateTime.Now;
public long? CreatorId { get; set; }
public string? Remark { get; set; }
public string? ListClass { get; set; }
public string? CssClass { get; set; }
public string DictType { get; set; } = string.Empty;
public string? DictLabel { get; set; }
public string DictValue { get; set; } = string.Empty;
public bool IsDefault { get; set; }
public bool State { get; set; }
}
}

View File

@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Module.DictionaryManager.Dtos.Dictionary
{
public class DictionaryUpdateInputVo
{
public long Id { get; set; }
public DateTime CreationTime { get; set; } = DateTime.Now;
public long? CreatorId { get; set; }
public string? Remark { get; set; }
public string? ListClass { get; set; }
public string? CssClass { get; set; }
public string DictType { get; set; } = string.Empty;
public string? DictLabel { get; set; }
public string DictValue { get; set; } = string.Empty;
public bool IsDefault { get; set; }
public bool State { get; set; }
}
}

View File

@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Module.DictionaryManager.Dtos.DictionaryType
{
/// <summary>
/// DictionaryType输入创建对象
/// </summary>
public class DictionaryTypeCreateInputVo
{
public long Id { get; set; }
public DateTime CreationTime { get; set; } = DateTime.Now;
public long? CreatorId { get; set; }
public string DictName { get; set; } = string.Empty;
public string DictType { get; set; } = string.Empty;
public string? Remark { get; set; }
public bool State { get; set; }
}
}

View File

@@ -0,0 +1,13 @@
using Yi.Framework.Infrastructure.Ddd.Dtos;
namespace Yi.Framework.Module.DictionaryManager.Dtos.DictionaryType
{
public class DictionaryTypeGetListInputVo : PagedAllResultRequestDto
{
public string? DictName { get; set; }
public string? DictType { get; set; }
public string? Remark { get; set; }
public bool? State { get; set; }
}
}

View File

@@ -0,0 +1,16 @@
using Yi.Framework.Infrastructure.Ddd.Dtos.Abstract;
namespace Yi.Framework.Module.DictionaryManager.Dtos.DictionaryType
{
public class DictionaryTypeGetListOutputDto : IEntityDto<long>
{
public long Id { get; set; }
public DateTime CreationTime { get; set; } = DateTime.Now;
public long? CreatorId { get; set; }
public string DictName { get; set; } = string.Empty;
public string DictType { get; set; } = string.Empty;
public string? Remark { get; set; }
public bool State { get; set; }
}
}

View File

@@ -0,0 +1,16 @@
using Yi.Framework.Infrastructure.Ddd.Dtos.Abstract;
namespace Yi.Framework.Module.DictionaryManager.Dtos.DictionaryType
{
public class DictionaryTypeGetOutputDto : IEntityDto<long>
{
public long Id { get; set; }
public DateTime CreationTime { get; set; } = DateTime.Now;
public long? CreatorId { get; set; }
public string DictName { get; set; } = string.Empty;
public string DictType { get; set; } = string.Empty;
public string? Remark { get; set; }
public bool State { get; set; }
}
}

View File

@@ -0,0 +1,13 @@
namespace Yi.Framework.Module.DictionaryManager.Dtos.DictionaryType
{
public class DictionaryTypeUpdateInputVo
{
public long Id { get; set; }
public DateTime CreationTime { get; set; } = DateTime.Now;
public long? CreatorId { get; set; }
public string DictName { get; set; } = string.Empty;
public string DictType { get; set; } = string.Empty;
public string? Remark { get; set; }
public bool State { get; set; }
}
}

View File

@@ -0,0 +1,71 @@
using SqlSugar;
using Yi.Framework.Infrastructure.Data.Auditing;
using Yi.Framework.Infrastructure.Data.Entities;
using Yi.Framework.Infrastructure.Ddd.Entities;
namespace Yi.Framework.Module.DictionaryManager.Entities
{
[SugarTable("Dictionary")]
public class DictionaryEntity : AuditedObject, IEntity<long>, ISoftDelete, IOrderNum, IState
{
/// <summary>
/// 主键
/// </summary>
[SugarColumn(IsPrimaryKey = true)]
public long Id { get; set; }
/// <summary>
/// 逻辑删除
/// </summary>
public bool IsDeleted { get; set; }
/// <summary>
/// 排序
/// </summary>
public int OrderNum { get; set; } = 0;
/// <summary>
/// 状态
/// </summary>
public bool State { get; set; } = true;
/// <summary>
/// 描述
///</summary>
[SugarColumn(ColumnName = "Remark")]
public string? Remark { get; set; }
/// <summary>
/// tag类型
///</summary>
[SugarColumn(ColumnName = "ListClass")]
public string? ListClass { get; set; }
/// <summary>
/// tagClass
///</summary>
[SugarColumn(ColumnName = "CssClass")]
public string? CssClass { get; set; }
/// <summary>
/// 字典类型
///</summary>
[SugarColumn(ColumnName = "DictType")]
public string DictType { get; set; } = string.Empty;
/// <summary>
/// 字典标签
///</summary>
[SugarColumn(ColumnName = "DictLabel")]
public string? DictLabel { get; set; }
/// <summary>
/// 字典值
///</summary>
[SugarColumn(ColumnName = "DictValue")]
public string DictValue { get; set; } = string.Empty;
/// <summary>
/// 是否为该类型的默认值
///</summary>
[SugarColumn(ColumnName = "IsDefault")]
public bool IsDefault { get; set; }
}
}

View File

@@ -0,0 +1,50 @@
using SqlSugar;
using Yi.Framework.Infrastructure.Data.Auditing;
using Yi.Framework.Infrastructure.Data.Entities;
using Yi.Framework.Infrastructure.Ddd.Entities;
namespace Yi.Framework.Module.DictionaryManager.Entities
{
[SugarTable("DictionaryType")]
public class DictionaryTypeEntity : AuditedObject, IEntity<long>, ISoftDelete, IOrderNum
{
/// <summary>
/// 主键
/// </summary>
[SugarColumn(IsPrimaryKey = true)]
public long Id { get; set; }
/// <summary>
/// 逻辑删除
/// </summary>
public bool IsDeleted { get; set; }
/// <summary>
/// 排序
/// </summary>
public int OrderNum { get; set; } = 0;
/// <summary>
/// 状态
/// </summary>
public bool? State { get; set; } = true;
/// <summary>
/// 字典名称
///</summary>
[SugarColumn(ColumnName = "DictName")]
public string DictName { get; set; } = string.Empty;
/// <summary>
/// 字典类型
///</summary>
[SugarColumn(ColumnName = "DictType")]
public string DictType { get; set; } = string.Empty;
/// <summary>
/// 描述
///</summary>
[SugarColumn(ColumnName = "Remark")]
public string? Remark { get; set; }
}
}

View File

@@ -0,0 +1,13 @@
using Yi.Framework.Infrastructure.Ddd.Services.Abstract;
using Yi.Framework.Module.DictionaryManager.Dtos.Dictionary;
namespace Yi.Framework.Module.DictionaryManager
{
/// <summary>
/// Dictionary服务抽象
/// </summary>
public interface IDictionaryService : ICrudAppService<DictionaryGetOutputDto, DictionaryGetListOutputDto, long, DictionaryGetListInputVo, DictionaryCreateInputVo, DictionaryUpdateInputVo>
{
}
}

View File

@@ -0,0 +1,13 @@
using Yi.Framework.Infrastructure.Ddd.Services.Abstract;
using Yi.Framework.Module.DictionaryManager.Dtos.DictionaryType;
namespace Yi.Framework.Module.DictionaryManager
{
/// <summary>
/// DictionaryType服务抽象
/// </summary>
public interface IDictionaryTypeService : ICrudAppService<DictionaryTypeGetOutputDto, DictionaryTypeGetListOutputDto, long, DictionaryTypeGetListInputVo, DictionaryTypeCreateInputVo, DictionaryTypeUpdateInputVo>
{
}
}