From dcd9121e4c06f521419b6acbf3f6165e649f3c24 Mon Sep 17 00:00:00 2001 From: he <10978375@qq.com> Date: Mon, 13 Feb 2023 11:15:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dto/DefaultShortcutKeyViewModel.cs | 55 ++++++++++ .../Reading/ShortcutKey/ShortcutKeyService.cs | 100 ++++++++++++++++++ .../Service/Reading/_MapConfig.cs | 2 + .../Reading/ShortcutKey/DefaultShortcutKey.cs | 46 ++++++++ .../Context/IRaCISDBContext.cs | 1 + IRaCIS.Core.Test/DbHelper.ttinclude | 2 +- 6 files changed, 205 insertions(+), 1 deletion(-) create mode 100644 IRaCIS.Core.Application/Service/Reading/Dto/DefaultShortcutKeyViewModel.cs create mode 100644 IRaCIS.Core.Application/Service/Reading/ShortcutKey/ShortcutKeyService.cs create mode 100644 IRaCIS.Core.Domain/Reading/ShortcutKey/DefaultShortcutKey.cs diff --git a/IRaCIS.Core.Application/Service/Reading/Dto/DefaultShortcutKeyViewModel.cs b/IRaCIS.Core.Application/Service/Reading/Dto/DefaultShortcutKeyViewModel.cs new file mode 100644 index 00000000..3412dd38 --- /dev/null +++ b/IRaCIS.Core.Application/Service/Reading/Dto/DefaultShortcutKeyViewModel.cs @@ -0,0 +1,55 @@ +//-------------------------------------------------------------------- +// 此代码由T4模板自动生成 byzhouhang 20210918 +// 生成时间 2023-02-13 10:38:12 +// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 +//-------------------------------------------------------------------- +using System; +using IRaCIS.Core.Domain.Share; +using System.Collections.Generic; +namespace IRaCIS.Core.Application.ViewModel +{ + /// DefaultShortcutKeyView 列表视图模型 + public class DefaultShortcutKeyView + { + public Guid Id { get; set; } + public string Keyboardkey { get; set; } + public int ShortcutKeyEnum { get; set; } + public int ImageToolType { get; set; } + public DateTime CreateTime { get; set; } + public Guid CreateUserId { get; set; } + } + + + public class SetDefaultShortcutKey + { + public int ImageToolType { get; set; } + + public List ShortcutKeyList { get; set; } + } + + public class DefaultShortcutKeyItem + { + public string Keyboardkey { get; set; } + public int ShortcutKeyEnum { get; set; } + } + + + ///DefaultShortcutKeyQuery 列表查询参数模型 + public class DefaultShortcutKeyQuery + { + public int ImageToolType { get; set; } + } + + /// DefaultShortcutKeyAddOrEdit 列表查询参数模型 + public class DefaultShortcutKeyAddOrEdit + { + public Guid Id { get; set; } + public string Keyboardkey { get; set; } + public int ShortcutKeyEnum { get; set; } + public int ImageToolType { get; set; } + } + + +} + + diff --git a/IRaCIS.Core.Application/Service/Reading/ShortcutKey/ShortcutKeyService.cs b/IRaCIS.Core.Application/Service/Reading/ShortcutKey/ShortcutKeyService.cs new file mode 100644 index 00000000..1057ab96 --- /dev/null +++ b/IRaCIS.Core.Application/Service/Reading/ShortcutKey/ShortcutKeyService.cs @@ -0,0 +1,100 @@ +//-------------------------------------------------------------------- +// 此代码由T4模板自动生成 byzhouhang 20210918 +// 生成时间 2023-02-13 10:33:22 +// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 +//-------------------------------------------------------------------- + +using IRaCIS.Core.Domain.Models; +using Microsoft.AspNetCore.Mvc; +using IRaCIS.Core.Application.Interfaces; +using IRaCIS.Core.Application.ViewModel; +namespace IRaCIS.Core.Application.Service +{ + /// + /// 快捷键服务 + /// + [ApiExplorerSettings(GroupName = "Reading")] + public class ShortcutKeyService: BaseService + { + private readonly IRepository _dictionaryRepository; + private readonly IRepository _defaultShortcutKeyRepository; + + public ShortcutKeyService( + IRepository DictionaryRepository, + IRepository defaultShortcutKeyRepository + ) + { + _dictionaryRepository = DictionaryRepository; + _defaultShortcutKeyRepository = defaultShortcutKeyRepository; + } + + /// + /// 获取默认快捷键 + /// + /// + /// + [HttpPost] + public async Task> GetDefaultShortcutKeyList(DefaultShortcutKeyQuery inQuery) + { + var defaultShortcutKey = await _defaultShortcutKeyRepository.Where(x => x.ImageToolType == inQuery.ImageToolType).ToListAsync(); + var shortcutKeydic = await _dictionaryRepository.Where(x => x.Parent.Code == "ShortcutKey").ToListAsync(); + var result = shortcutKeydic.OrderBy(x=>x.ShowOrder).Select(x => new DefaultShortcutKeyView() + { + + Id = x.Id, + ImageToolType = inQuery.ImageToolType, + ShortcutKeyEnum = int.Parse(x.Code), + Keyboardkey = defaultShortcutKey.Where(y => y.ShortcutKeyEnum == int.Parse(x.Code)).Select(y => y.Keyboardkey).FirstOrDefault() ?? string.Empty, + }).ToList(); + return result; + } + + + /// + /// 获取医生快捷键 + /// + /// + /// + [HttpPost] + public async Task> GetDoctorShortcutKey(DefaultShortcutKeyQuery inQuery) + { + var defaultShortcutKey = await _defaultShortcutKeyRepository.Where(x => x.ImageToolType == inQuery.ImageToolType).ToListAsync(); + var shortcutKeydic = await _dictionaryRepository.Where(x => x.Parent.Code == "ShortcutKey").ToListAsync(); + var result = shortcutKeydic.OrderBy(x => x.ShowOrder).Select(x => new DefaultShortcutKeyView() + { + + Id = x.Id, + ImageToolType = inQuery.ImageToolType, + ShortcutKeyEnum = int.Parse(x.Code), + Keyboardkey = defaultShortcutKey.Where(y => y.ShortcutKeyEnum == int.Parse(x.Code)).Select(y => y.Keyboardkey).FirstOrDefault() ?? string.Empty, + }).ToList(); + return result; + } + + + /// + /// 设置默认快捷键 + /// + /// + /// + [HttpPost] + public async Task SetDefaultShortcutKey(SetDefaultShortcutKey inDto) + { + await _defaultShortcutKeyRepository.BatchDeleteNoTrackingAsync(x => x.ImageToolType == inDto.ImageToolType); + + await _defaultShortcutKeyRepository.AddRangeAsync(inDto.ShortcutKeyList.Select(x => new DefaultShortcutKey() + { + ImageToolType = inDto.ImageToolType, + Keyboardkey = x.Keyboardkey, + ShortcutKeyEnum = x.ShortcutKeyEnum + + })); + + return await _defaultShortcutKeyRepository.SaveChangesAsync(); + } + + + + + } +} diff --git a/IRaCIS.Core.Application/Service/Reading/_MapConfig.cs b/IRaCIS.Core.Application/Service/Reading/_MapConfig.cs index 97c58503..5a0ca516 100644 --- a/IRaCIS.Core.Application/Service/Reading/_MapConfig.cs +++ b/IRaCIS.Core.Application/Service/Reading/_MapConfig.cs @@ -16,6 +16,8 @@ namespace IRaCIS.Core.Application.Service //是否英文环境 var isEn_Us=false; + CreateMap(); + CreateMap(); CreateMap(); diff --git a/IRaCIS.Core.Domain/Reading/ShortcutKey/DefaultShortcutKey.cs b/IRaCIS.Core.Domain/Reading/ShortcutKey/DefaultShortcutKey.cs new file mode 100644 index 00000000..12d3c4ce --- /dev/null +++ b/IRaCIS.Core.Domain/Reading/ShortcutKey/DefaultShortcutKey.cs @@ -0,0 +1,46 @@ + +//-------------------------------------------------------------------- +// 此代码由T4模板自动生成 byzhouhang 20210918 +// 生成时间 2023-02-13 10:33:05 +// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。 +using System; +using IRaCIS.Core.Domain.Share; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +namespace IRaCIS.Core.Domain.Models +{ + /// + ///DefaultShortcutKey + /// + [Table("DefaultShortcutKey")] + public class DefaultShortcutKey : Entity, IAuditUpdate, IAuditAdd + { + /// + /// 对应的键盘按键 + /// + public string Keyboardkey { get; set; } = string.Empty; + + /// + /// 按键枚举 + /// + public int ShortcutKeyEnum { get; set; } + + /// + /// 影像工具类型 + /// + public int ImageToolType { get; set; } + + /// + /// CreateTime + /// + public DateTime CreateTime { get; set; } + + /// + /// CreateUserId + /// + public Guid CreateUserId { get; set; } + + } + + +} diff --git a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs index dd17dfda..21f869df 100644 --- a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs +++ b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs @@ -434,6 +434,7 @@ namespace IRaCIS.Core.Infra.EFCore #endregion + public virtual DbSet DefaultShortcutKey { get; set; } public virtual DbSet EmailNoticeConfig { get; set; } public virtual DbSet SystemBasicData { get; set; } diff --git a/IRaCIS.Core.Test/DbHelper.ttinclude b/IRaCIS.Core.Test/DbHelper.ttinclude index dd972c61..956e4eb0 100644 --- a/IRaCIS.Core.Test/DbHelper.ttinclude +++ b/IRaCIS.Core.Test/DbHelper.ttinclude @@ -4,7 +4,7 @@ public static readonly string ConnectionString = "Server=123.56.94.154,1433\\MSSQLSERVER;Database=IRaCIS_New_Tet;User ID=sa;Password=dev123456DEV;TrustServerCertificate=true"; public static readonly string DbDatabase = "IRaCIS_New_Tet"; //ַ,ƴ - public static readonly string TableName = "TrialCriterionDictionaryCode"; + public static readonly string TableName = "DefaultShortcutKey"; //ļ service Ƿҳ } #>