This commit is contained in:
he
2023-02-13 11:15:27 +08:00
parent d5f72ca7de
commit dcd9121e4c
6 changed files with 205 additions and 1 deletions
@@ -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
{
/// <summary> DefaultShortcutKeyView 列表视图模型 </summary>
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<DefaultShortcutKeyItem> ShortcutKeyList { get; set; }
}
public class DefaultShortcutKeyItem
{
public string Keyboardkey { get; set; }
public int ShortcutKeyEnum { get; set; }
}
///<summary>DefaultShortcutKeyQuery 列表查询参数模型</summary>
public class DefaultShortcutKeyQuery
{
public int ImageToolType { get; set; }
}
///<summary> DefaultShortcutKeyAddOrEdit 列表查询参数模型</summary>
public class DefaultShortcutKeyAddOrEdit
{
public Guid Id { get; set; }
public string Keyboardkey { get; set; }
public int ShortcutKeyEnum { get; set; }
public int ImageToolType { get; set; }
}
}
@@ -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
{
/// <summary>
/// 快捷键服务
/// </summary>
[ApiExplorerSettings(GroupName = "Reading")]
public class ShortcutKeyService: BaseService
{
private readonly IRepository<Dictionary> _dictionaryRepository;
private readonly IRepository<DefaultShortcutKey> _defaultShortcutKeyRepository;
public ShortcutKeyService(
IRepository<Dictionary> DictionaryRepository,
IRepository<DefaultShortcutKey> defaultShortcutKeyRepository
)
{
_dictionaryRepository = DictionaryRepository;
_defaultShortcutKeyRepository = defaultShortcutKeyRepository;
}
/// <summary>
/// 获取默认快捷键
/// </summary>
/// <param name="inQuery"></param>
/// <returns></returns>
[HttpPost]
public async Task<List<DefaultShortcutKeyView>> 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;
}
/// <summary>
/// 获取医生快捷键
/// </summary>
/// <param name="inQuery"></param>
/// <returns></returns>
[HttpPost]
public async Task<List<DefaultShortcutKeyView>> 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;
}
/// <summary>
/// 设置默认快捷键
/// </summary>
/// <param name="inDto"></param>
/// <returns></returns>
[HttpPost]
public async Task<bool> 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();
}
}
}
@@ -16,6 +16,8 @@ namespace IRaCIS.Core.Application.Service
//是否英文环境
var isEn_Us=false;
CreateMap<DefaultShortcutKey, DefaultShortcutKeyView>();
CreateMap<ReadingPeriodSetAddOrEdit, ReadingPeriodSet>();
CreateMap<AddOrUpdateTumorAssessmentInDto, TumorAssessment>();