From 4133953b935071d38ec8386f8721a37810f5206d Mon Sep 17 00:00:00 2001 From: he <10978375@qq.com> Date: Mon, 13 Feb 2023 16:17:09 +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 | 19 ++++++-- .../Reading/ShortcutKey/ShortcutKeyService.cs | 46 +++++++++++-------- .../Reading/ShortcutKey/DefaultShortcutKey.cs | 12 ++++- 3 files changed, 53 insertions(+), 24 deletions(-) diff --git a/IRaCIS.Core.Application/Service/Reading/Dto/DefaultShortcutKeyViewModel.cs b/IRaCIS.Core.Application/Service/Reading/Dto/DefaultShortcutKeyViewModel.cs index 3412dd38..a7f55ff6 100644 --- a/IRaCIS.Core.Application/Service/Reading/Dto/DefaultShortcutKeyViewModel.cs +++ b/IRaCIS.Core.Application/Service/Reading/Dto/DefaultShortcutKeyViewModel.cs @@ -15,9 +15,14 @@ namespace IRaCIS.Core.Application.ViewModel 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 bool AltKey { get; set; } + + public bool CtrlKey { get; set; } + + public bool ShiftKey { get; set; } + + public bool MetaKey { get; set; } + } public class SetDefaultShortcutKey @@ -31,6 +36,14 @@ namespace IRaCIS.Core.Application.ViewModel { public string Keyboardkey { get; set; } public int ShortcutKeyEnum { get; set; } + + public bool AltKey { get; set; } + + public bool CtrlKey { get; set; } + + public bool ShiftKey { get; set; } + + public bool MetaKey { get; set; } } diff --git a/IRaCIS.Core.Application/Service/Reading/ShortcutKey/ShortcutKeyService.cs b/IRaCIS.Core.Application/Service/Reading/ShortcutKey/ShortcutKeyService.cs index 1057ab96..3ff06dcd 100644 --- a/IRaCIS.Core.Application/Service/Reading/ShortcutKey/ShortcutKeyService.cs +++ b/IRaCIS.Core.Application/Service/Reading/ShortcutKey/ShortcutKeyService.cs @@ -34,18 +34,36 @@ namespace IRaCIS.Core.Application.Service /// /// [HttpPost] - public async Task> GetDefaultShortcutKeyList(DefaultShortcutKeyQuery inQuery) + 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(); + + List result = new List(); + + shortcutKeydic.OrderBy(x => x.ShowOrder).ForEach(x => + { + var key= defaultShortcutKey.Where(y => y.ShortcutKeyEnum == int.Parse(x.Code)).FirstOrDefault(); + + var isnull = key == null; + + result.Add(new DefaultShortcutKeyView() + { + Id = x.Id, + ImageToolType = inQuery.ImageToolType, + ShortcutKeyEnum = int.Parse(x.Code), + Keyboardkey = isnull ? string.Empty : key.Keyboardkey, + AltKey = isnull ? false : key.AltKey, + CtrlKey = isnull ? false : key.CtrlKey, + MetaKey = isnull ? false : key.MetaKey, + ShiftKey = isnull ? false : key.ShiftKey + }) ; + + }); + + + return result; } @@ -58,17 +76,7 @@ namespace IRaCIS.Core.Application.Service [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; + return await this.GetDefaultShortcutKeyList(inQuery); } diff --git a/IRaCIS.Core.Domain/Reading/ShortcutKey/DefaultShortcutKey.cs b/IRaCIS.Core.Domain/Reading/ShortcutKey/DefaultShortcutKey.cs index 93bc1dee..e2a8496d 100644 --- a/IRaCIS.Core.Domain/Reading/ShortcutKey/DefaultShortcutKey.cs +++ b/IRaCIS.Core.Domain/Reading/ShortcutKey/DefaultShortcutKey.cs @@ -39,8 +39,16 @@ namespace IRaCIS.Core.Domain.Models /// CreateUserId /// public Guid CreateUserId { get; set; } - - } + + public bool AltKey { get; set; } + + public bool CtrlKey { get; set; } + + public bool ShiftKey { get; set; } + + public bool MetaKey { get; set; } + + } }