@@ -1,37 +0,0 @@
|
||||
using System;
|
||||
using IRaCIS.Core.Domain.Models;
|
||||
|
||||
namespace IRaCIS.Core.Test.GenerateContextModelFolder;
|
||||
|
||||
[Comment("后台 - 字典表(需要同步)")]
|
||||
[Table("Dictionary")]
|
||||
public partial class Dictionary: BaseFullAuditEntity
|
||||
{
|
||||
[StringLength(400)]
|
||||
public string ChildGroup { get; set; } = null!;
|
||||
|
||||
public string Code { get; set; } = null!;
|
||||
|
||||
public Guid? ConfigTypeId { get; set; }
|
||||
|
||||
[Comment(" 字典类型- 枚举|bool|下拉框")]
|
||||
public int DataTypeEnum { get; set; }
|
||||
|
||||
[StringLength(512)]
|
||||
public string Description { get; set; } = null!;
|
||||
|
||||
[Comment(" 是否字典类型配置")]
|
||||
public bool IsConfig { get; set; }
|
||||
|
||||
public bool IsEnable { get; set; }
|
||||
|
||||
public Guid? ParentId { get; set; }
|
||||
|
||||
public int ShowOrder { get; set; }
|
||||
|
||||
[StringLength(400)]
|
||||
public string Value { get; set; } = null!;
|
||||
|
||||
[StringLength(400)]
|
||||
public string ValueCN { get; set; } = null!;
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace IRaCIS.Core.Test.GenerateContextModelFolder;
|
||||
|
||||
public partial class TempContext : DbContext
|
||||
{
|
||||
public TempContext()
|
||||
{
|
||||
}
|
||||
|
||||
public TempContext(DbContextOptions<TempContext> options)
|
||||
: base(options)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual DbSet<Dictionary> Dictionaries { get; set; }
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
#warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see https://go.microsoft.com/fwlink/?LinkId=723263.
|
||||
=> optionsBuilder.UseSqlServer("Server=106.14.89.110,1435;Database=Test_IRC;User ID=sa;Password=xc@123456;TrustServerCertificate=true");
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.UseCollation("Chinese_PRC_CI_AS");
|
||||
|
||||
modelBuilder.Entity<Dictionary>(entity =>
|
||||
{
|
||||
entity.ToTable("Dictionary", tb => tb.HasComment("后台 - 字典表(需要同步)"));
|
||||
|
||||
entity.Property(e => e.Id).ValueGeneratedNever();
|
||||
entity.Property(e => e.ChildGroup).HasDefaultValue("");
|
||||
entity.Property(e => e.Code).HasDefaultValue("");
|
||||
entity.Property(e => e.DataTypeEnum).HasComment("字典类型- 枚举|bool|下拉框");
|
||||
entity.Property(e => e.IsConfig).HasComment("是否字典类型配置");
|
||||
entity.Property(e => e.IsEnable).HasDefaultValue(true);
|
||||
entity.Property(e => e.Value).HasDefaultValue("");
|
||||
entity.Property(e => e.ValueCN).HasDefaultValue("");
|
||||
});
|
||||
|
||||
OnModelCreatingPartial(modelBuilder);
|
||||
}
|
||||
|
||||
partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
|
||||
}
|
||||
@@ -11,32 +11,32 @@ namespace IRaCIS.Core.Application.ViewModel;
|
||||
|
||||
public class {{ TableNameView }} : {{ TableNameAddOrEdit }}
|
||||
{
|
||||
{% for field in ViewListFieldList %}
|
||||
public {{ field.CSharpType }} {{ field.FieldName }} { get; set; }
|
||||
{% for field in ViewListFieldList %}
|
||||
public {{ field.CSharpType }} {{ field.FieldName }} { get; set; }
|
||||
{% endfor %}
|
||||
}
|
||||
|
||||
|
||||
public class {{ TableNameAddOrEdit }}
|
||||
{
|
||||
{%- for field in AddOrUpdateFieldList -%}
|
||||
{% if field.IsPrimarykey %}
|
||||
public {{ field.CSharpType }}? {{ field.FieldName }} { get; set; }
|
||||
{% else %}
|
||||
public {{ field.CSharpType }} {{ field.FieldName }} { get; set; }
|
||||
{% endif %}
|
||||
{%- endfor -%}
|
||||
{%- for field in AddOrUpdateFieldList -%}
|
||||
{% if field.IsPrimarykey %}
|
||||
public {{ field.CSharpType }}? {{ field.FieldName }} { get; set; }
|
||||
{% else %}
|
||||
public {{ field.CSharpType }} {{ field.FieldName }} { get; set; }
|
||||
{% endif %}
|
||||
{%- endfor -%}
|
||||
}
|
||||
|
||||
public class {{ TableNameQuery }}
|
||||
{
|
||||
{%- for field in QueryListFieldList -%}
|
||||
{% if field.IsNullable and field.IsCSharpString == false %}
|
||||
public {{ field.CSharpType }} {{ field.FieldName }} { get; set; }
|
||||
{% else %}
|
||||
public {{ field.CSharpType }}? {{ field.FieldName }} { get; set; }
|
||||
{% endif %}
|
||||
{%- endfor -%}
|
||||
{%- for field in QueryListFieldList -%}
|
||||
{% if field.IsNullable and field.IsCSharpString == false %}
|
||||
public {{ field.CSharpType }} {{ field.FieldName }} { get; set; }
|
||||
{% else %}
|
||||
public {{ field.CSharpType }}? {{ field.FieldName }} { get; set; }
|
||||
{% endif %}
|
||||
{%- endfor -%}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -12,14 +12,14 @@ namespace IRaCIS.Core.Application.Interfaces;
|
||||
|
||||
public interface I{{TableName}}Service
|
||||
{
|
||||
{% if IsPaged %}
|
||||
Task<PageOutput<<{{TableNameView}}>> Get{{TableName}}List({{TableNameQuery}} inQuery);
|
||||
{% else %}
|
||||
Task<List<{{TableNameView}}>> Get{{TableName}}List({{TableNameQuery}} inQuery);
|
||||
{% endif %}
|
||||
Task<IResponseOutput> AddOrUpdate{{TableName}}({{TableNameAddOrEdit}} addOrEdit{{TableName}});
|
||||
{% if IsPaged %}
|
||||
Task<PageOutput<{{TableNameView}}> Get{{TableName}}List({{TableNameQuery}} inQuery);
|
||||
{% else %}
|
||||
Task<List<{{TableNameView}}>> Get{{TableName}}List({{TableNameQuery}} inQuery);
|
||||
{% endif %}
|
||||
Task<IResponseOutput> AddOrUpdate{{TableName}}({{TableNameAddOrEdit}} addOrEdit{{TableName}});
|
||||
|
||||
Task<IResponseOutput> Delete{{TableNameView}}(Guid {{LowercaseTableNameId}});
|
||||
Task<IResponseOutput> Delete{{TableNameView}}(Guid {{LowercaseTableNameId}});
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// 此代码由liquid模板自动生成 byzhouhang 20240909
|
||||
// 生成时间 2024-09-20 01:22:34Z
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
|
||||
//--------------------------------------------------------------------
|
||||
using IRaCIS.Core.Domain.Models;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using IRaCIS.Core.Application.Interfaces;
|
||||
using IRaCIS.Core.Application.ViewModel;
|
||||
using IRaCIS.Core.Infrastructure.Extention;
|
||||
using System.Threading.Tasks;
|
||||
using IRaCIS.Core.Infra.EFCore;
|
||||
namespace IRaCIS.Core.Application.Service;
|
||||
|
||||
[ ApiExplorerSettings(GroupName = "Test")]
|
||||
public class DictionaryService(IRepository<Dictionary> _dictionaryRepository): BaseService, IDictionaryService
|
||||
{
|
||||
|
||||
|
||||
[HttpPost]
|
||||
public async Task<PageOutput<DictionaryView>> GetDictionaryList(DictionaryQuery inQuery)
|
||||
{
|
||||
|
||||
var dictionaryQueryable =_dictionaryRepository
|
||||
.ProjectTo<DictionaryView>(_mapper.ConfigurationProvider);
|
||||
|
||||
var pageList= await dictionaryQueryable.ToPagedListAsync(inQuery);
|
||||
|
||||
return pageList;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public async Task<IResponseOutput> AddOrUpdateDictionary(DictionaryAddOrEdit addOrEditDictionary)
|
||||
{
|
||||
// 在此处拷贝automapper 映射
|
||||
|
||||
CreateMap<Dictionary, DictionaryView>();
|
||||
CreateMap<Dictionary,DictionaryAddOrEdit>().ReverseMap();
|
||||
|
||||
|
||||
var entity = await _dictionaryRepository.InsertOrUpdateAsync(addOrEditDictionary, true);
|
||||
|
||||
return ResponseOutput.Ok(entity.Id.ToString());
|
||||
|
||||
}
|
||||
|
||||
|
||||
[HttpDelete("{dictionaryId:guid}")]
|
||||
public async Task<IResponseOutput> DeleteDictionary(Guid dictionaryId)
|
||||
{
|
||||
var success = await _<#=char.ToLower(tableName[0]) + tableName.Substring(1)#>Repository.DeleteFromQueryAsync(t => t.Id == dictionaryId,true);
|
||||
return ResponseOutput.Ok();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,76 +0,0 @@
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// 此代码由liquid模板自动生成 byzhouhang 20240909
|
||||
// 生成时间 2024-09-20 01:22:37Z
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
|
||||
//--------------------------------------------------------------------
|
||||
using System;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using System.Collections.Generic;
|
||||
namespace IRaCIS.Core.Application.ViewModel;
|
||||
|
||||
public class DictionaryView : DictionaryAddOrEdit
|
||||
{
|
||||
|
||||
public DateTime CreateTime { get; set; }
|
||||
|
||||
public DateTime UpdateTime { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class DictionaryAddOrEdit
|
||||
{
|
||||
public Guid? Id { get; set; }
|
||||
|
||||
public string ChildGroup { get; set; }
|
||||
|
||||
public string Code { get; set; }
|
||||
|
||||
public Guid? ConfigTypeId { get; set; }
|
||||
|
||||
public DicDataTypeEnum DataTypeEnum { get; set; }
|
||||
|
||||
public string Description { get; set; }
|
||||
|
||||
public bool IsConfig { get; set; }
|
||||
|
||||
public bool IsEnable { get; set; }
|
||||
|
||||
public Guid? ParentId { get; set; }
|
||||
|
||||
public int ShowOrder { get; set; }
|
||||
|
||||
public string Value { get; set; }
|
||||
|
||||
public string ValueCN { get; set; }
|
||||
}
|
||||
|
||||
public class DictionaryQuery
|
||||
{
|
||||
public string? ChildGroup { get; set; }
|
||||
|
||||
public string? Code { get; set; }
|
||||
|
||||
public Guid? ConfigTypeId { get; set; }
|
||||
|
||||
public DicDataTypeEnum? DataTypeEnum { get; set; }
|
||||
|
||||
public string? Description { get; set; }
|
||||
|
||||
public bool? IsConfig { get; set; }
|
||||
|
||||
public bool? IsEnable { get; set; }
|
||||
|
||||
public Guid? ParentId { get; set; }
|
||||
|
||||
public int? ShowOrder { get; set; }
|
||||
|
||||
public string? Value { get; set; }
|
||||
|
||||
public string? ValueCN { get; set; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// 此代码由liquid模板自动生成 byzhouhang 20240909
|
||||
// 生成时间 2024-09-20 01:22:37Z
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
|
||||
//--------------------------------------------------------------------
|
||||
using System;
|
||||
using IRaCIS.Core.Infrastructure.Extention;
|
||||
using System.Threading.Tasks;
|
||||
using IRaCIS.Core.Application.ViewModel;
|
||||
namespace IRaCIS.Core.Application.Interfaces;
|
||||
|
||||
public interface IDictionaryService
|
||||
{
|
||||
|
||||
Task<PageOutput<<DictionaryView>> GetDictionaryList(DictionaryQuery inQuery);
|
||||
|
||||
Task<IResponseOutput> AddOrUpdateDictionary(DictionaryAddOrEdit addOrEditDictionary);
|
||||
|
||||
Task<IResponseOutput> DeleteDictionaryView(Guid dictionaryId);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user