增加同时获取多个字典类型数据接口

This commit is contained in:
2023-11-06 18:08:22 +08:00
parent 261a917bab
commit 6a2154edd9
9 changed files with 66 additions and 89 deletions

View File

@@ -1,5 +1,13 @@
<Project>
<PropertyGroup>
<SolutionDir>$(MSBuildThisFileDirectory)</SolutionDir>
<LangVersion>latest</LangVersion>
<NoWarn>$(NoWarn);CS1591;</NoWarn>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DebugType>none</DebugType>
<DebugSymbols>false</DebugSymbols>
</PropertyGroup>
</Project>

View File

@@ -22,7 +22,6 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "解决方案项", "解决方案项", "{7876D0A1-7141-4904-8A3B-88DF61BEE7EE}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
clear_bin_obj.cmd = clear_bin_obj.cmd
common.props = common.props
Directory.Build.props = Directory.Build.props
dotnet.ruleset = dotnet.ruleset
@@ -295,14 +294,14 @@ Global
{DB646C4B-D6FB-44CB-A8F6-C0F6AA83AB8A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DB646C4B-D6FB-44CB-A8F6-C0F6AA83AB8A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DB646C4B-D6FB-44CB-A8F6-C0F6AA83AB8A}.Release|Any CPU.Build.0 = Release|Any CPU
{DB646C4B-D6FB-44CB-A8F6-C0F6AA83AB8A}.tianyi|Any CPU.ActiveCfg = tianyi|Any CPU
{DB646C4B-D6FB-44CB-A8F6-C0F6AA83AB8A}.tianyi|Any CPU.Build.0 = tianyi|Any CPU
{DB646C4B-D6FB-44CB-A8F6-C0F6AA83AB8A}.tianyi|Any CPU.ActiveCfg = Debug|Any CPU
{DB646C4B-D6FB-44CB-A8F6-C0F6AA83AB8A}.tianyi|Any CPU.Build.0 = Debug|Any CPU
{0282541C-4295-4A2A-A826-54E9C69718D9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0282541C-4295-4A2A-A826-54E9C69718D9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0282541C-4295-4A2A-A826-54E9C69718D9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0282541C-4295-4A2A-A826-54E9C69718D9}.Release|Any CPU.Build.0 = Release|Any CPU
{0282541C-4295-4A2A-A826-54E9C69718D9}.tianyi|Any CPU.ActiveCfg = tianyi|Any CPU
{0282541C-4295-4A2A-A826-54E9C69718D9}.tianyi|Any CPU.Build.0 = tianyi|Any CPU
{0282541C-4295-4A2A-A826-54E9C69718D9}.tianyi|Any CPU.ActiveCfg = Debug|Any CPU
{0282541C-4295-4A2A-A826-54E9C69718D9}.tianyi|Any CPU.Build.0 = Debug|Any CPU
{08A36D02-DC53-4895-9E1C-E02BC1BBA890}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{08A36D02-DC53-4895-9E1C-E02BC1BBA890}.Debug|Any CPU.Build.0 = Debug|Any CPU
{08A36D02-DC53-4895-9E1C-E02BC1BBA890}.Release|Any CPU.ActiveCfg = Release|Any CPU

View File

@@ -1,76 +0,0 @@
@echo off&chcp 936>nul&setlocal enabledelayedexpansion
title <20><>ɾ<EFBFBD><C9BE>bin<69><6E>obj<62>ļ<EFBFBD><C4BC>С<EFBFBD>
echo;
if [%1] equ [] (set fp=%~dp0) else (set fp=%1)
set fp="%fp%" & set fp=%fp:"=%
if "%fp%" neq "" if "%fp:~-1%" neq "\" set fp=%fp%\
set nowPath="%fp%"
set /a findFileCount=0
set /a findFolderCount=0
set /a findAllCount=0
set /a delFileCount=0
set /a delFolderCount=0
set /a fileSize=0
set delFileOrFolder=*.vshost.*,bin,obj,.vs
echo; &echo <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ¼<C4BF><C2BC>%nowPath%
echo; &echo ɾ<><C9BE>ָ<EFBFBD><D6B8>Ŀ¼<C4BF>µģ<C2B5>
set delType=%delFileOrFolder%
:loop
for /f "tokens=1* delims=," %%a in ("%delType%") do echo %%a &set delType=%%b
if defined delType goto :loop
:: echo; &echo <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD><CBB3><EFBFBD><EFBFBD>رմ<D8B1><D5B4>ڡ<EFBFBD> &pause>nul
:: echo; &echo --------------------------------------------------
echo <20><>ɾ<EFBFBD><C9BE><EFBFBD>б<EFBFBD><D0B1><EFBFBD>
rem search delete specify file or folder(such as:*.pdb,*.vshost.*)
::for /r %nowPath% %%i in (*.pdb,*.vshost.*) do (echo del "%%i")
for /r %nowPath% %%i in (%delFileOrFolder%) do (IF EXIST "%%i" (echo "%%i"&IF EXIST "%%i\.\" (set /a findFolderCount+=1) else set /a findFileCount+=1
set fs=0&(for /f "tokens=3* delims= " %%a in ('dir "%%i" /a-d /s /-c ^| find /i "<22><><EFBFBD>ļ<EFBFBD>"') do set fs=%%a)&call :bigNumAdd !fileSize! !fs! fileSize
))
set /a findAllCount=%findFolderCount%+%findFileCount%
echo;&if %findAllCount% equ 0 echo [file or folder not found] &goto end
call :numToThousand %fileSize% fileSize
echo <20><><EFBFBD>ҵ<EFBFBD>%findAllCount%<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>%findFileCount%<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD>У<EFBFBD>%findFolderCount%<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܹ<EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><EFBFBD>%fileSize% bytes<65><73>
echo --------------------------------------------------
set /p var=<EFBFBD>Ƿ<EFBFBD>ȷ<EFBFBD><EFBFBD>ɾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD>У<EFBFBD>[Y/N]:
if /i "%var%"=="Y" (goto DelFileAndFolder) else goto cancelDel
:DelFileAndFolder
rem delete specify file or folder(such as:obj,bin,*.pdb,*.vshost.*)
::for /r %nowPath% %%i in (%delFileOrFolder%) do (IF EXIST "%%i" IF EXIST "%%i\.\" (echo "%%i\.\") ELSE echo "%%i")
for /r %nowPath% %%i in (%delFileOrFolder%) do (IF EXIST "%%i" (echo Deleting file "%%i"&IF EXIST "%%i\.\" (RD /s /q "%%i" &set /a delFolderCount+=1) else del "%%i" &set /a delFileCount+=1))
echo; &echo [Delete completed] delete %delFileCount% files, delete %delFolderCount% folders, total size %fileSize% bytes &echo;
goto end
:cancelDel
echo; &echo [Cancel deletion] &echo;
:end
Pause
goto :eof
::<3A><><EFBFBD><EFBFBD><EFBFBD>ӷ<EFBFBD> call _ADD <<3C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>> <<3C><><EFBFBD><EFBFBD>> [<5B><><EFBFBD>ر<EFBFBD><D8B1><EFBFBD>]
::<3A>ֱ<EFBFBD>֧<EFBFBD><D6A7>ʮ<EFBFBD><CAAE><EFBFBD>Ƶ<EFBFBD>64λ<34><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֺ<EFBFBD>64λС<CEBB><D0A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,һ<>μ<EFBFBD><CEBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0.01<EFBFBD><EFBFBD>
:bigNumAdd <<3C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>> <<3C><><EFBFBD><EFBFBD>> [<5B><><EFBFBD>ر<EFBFBD><D8B1><EFBFBD>] // by jack on 2021-09-03
(setlocal enabledelayedexpansion
set L=&for /l %%a in (1,1,8) do set L=!L!00000000
for /f "tokens=1-3 delims=." %%a in ("!L!%1.!L!") do set at=%%a&set aw=%%b%%c
for /f "tokens=1-3 delims=." %%a in ("!L!%2.!L!") do set bt=%%a&set bw=%%b%%c
set a=!at:~-64!!aw:~,64!&set b=!bt:~-64!!bw:~,64!&set e=&set v=200000000
for /l %%a in (8,8,128)do set/a v=1!b:~-%%a,8!+1!a:~-%%a,8!+!v:~-9,-8!-2&set e=!v:~-8!!e!
set e=!e:0= !&for /f "tokens=*" %%a in ("!e:~,-64!_.!e:~64!") do set e=%%~nxa
set e=!e:_=!&for %%a in ("!e: =0!") do endlocal&(if %3.==. (echo %%~a) else set %3=%%~a)
exit/b)
::<3A><><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD>ת<EFBFBD><D7AA>ǧ<EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>ʾ
:numToThousand <<3C><><EFBFBD>ֲ<EFBFBD><D6B2><EFBFBD>> [<5B><><EFBFBD>ر<EFBFBD><D8B1><EFBFBD>]
(setlocal enabledelayedexpansion&set n=%~1
set len=0&for /l %%i in (0,1,1000) do if "!n:~%%i,1!."=="." set len=%%i&goto :breakFor
:breakFor
set nv=&for /l %%a in (1,1,%len%)do (set nv=!n:~-%%a,1!!nv!&set/a m=%%a%%3&if !m!==0 if not %%a==%len% set nv=,!nv!)
endlocal&(if %2.==. (echo %nv%) else set %2=%nv%)
exit/b)

View File

@@ -1,5 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="$(SolutionDir)\common.props" />
<!--<Import Project="$(SolutionDir)\common.props" />-->
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>

View File

@@ -16,6 +16,12 @@ public interface IDictionaryTypeService
/// <returns></returns>
Task<List<DictionaryTypeEntity>> GetList();
/// <summary>
/// 获取部分列表.
/// </summary>
/// <returns></returns>
Task<List<DictionaryTypeEntity>> GetListMany(string[] ids);
/// <summary>
/// 信息.
/// </summary>

View File

@@ -95,6 +95,26 @@ public class DictionaryDataService : IDictionaryDataService, IDynamicApiControll
}
}
/// <summary>
/// 获取部分数据字典列表(多个分类).
/// </summary>
[HttpGet("Many")]
public async Task<dynamic> GetListMany(string[] dictionaryTypeIds)
{
var dictionaryData = await _repository.AsQueryable().Where(d => d.DeleteMark == null && d.EnabledMark == 1 && dictionaryTypeIds.Contains(d.DictionaryTypeId))
.OrderBy(o => o.SortCode).OrderBy(o => o.CreatorTime, OrderByType.Desc).OrderBy(o => o.LastModifyTime, OrderByType.Desc).ToListAsync();
var dictionaryType = await _dictionaryTypeService.GetListMany(dictionaryTypeIds);
var data = dictionaryType.Adapt<List<DictionaryDataAllListOutput>>();
data.ForEach(dataall =>
{
if (dataall.isTree == 1)
dataall.dictionaryList = dictionaryData.FindAll(d => d.DictionaryTypeId == dataall.id).Adapt<List<DictionaryDataTreeOutput>>().ToTree();
else
dataall.dictionaryList = dictionaryData.FindAll(d => d.DictionaryTypeId == dataall.id).Adapt<List<DictionaryDataListOutput>>();
});
return new { list = data };
}
/// <summary>
/// 获取所有数据字典列表(分类+内容).
/// </summary>

View File

@@ -165,13 +165,22 @@ public class DictionaryTypeService : IDictionaryTypeService, IDynamicApiControll
/// <summary>
/// 列表.
/// </summary>
/// <returns></returns>
[NonAction]
public async Task<List<DictionaryTypeEntity>> GetList()
{
return await _repository.AsQueryable().Where(x => x.DeleteMark == null).OrderBy(x => x.SortCode).OrderBy(x => x.CreatorTime, OrderByType.Desc).ToListAsync();
}
/// <summary>
/// 列表.
/// </summary>
[NonAction]
public async Task<List<DictionaryTypeEntity>> GetListMany(string[] ids)
{
return await _repository.AsQueryable().Where(x => x.DeleteMark == null && ids.Contains(x.Id)).OrderBy(x => x.SortCode).OrderBy(x => x.CreatorTime, OrderByType.Desc).ToListAsync();
}
/// <summary>
/// 递归获取所有分类.
/// </summary>

View File

@@ -8,14 +8,14 @@ using Tnb.Vengine.DataAccess;
namespace Tnb.Vengine.Domain
{
public class OutputParser
public class VmQueryParser
{
private readonly IDataAccess _dataAccess;
private readonly Vmodel _root;
private List<string> _outputs;
private Dictionary<string, OutputSelect> _selectProps = new Dictionary<string, OutputSelect>();
private Dictionary<string, Vmodel?> _navModels = new Dictionary<string, Vmodel?>();
public OutputParser(IDataAccess dataAccess, Vmodel rootModel, string output)
public VmQueryParser(IDataAccess dataAccess, Vmodel rootModel, string output)
{
_dataAccess = dataAccess;
_root = rootModel;
@@ -54,6 +54,10 @@ namespace Tnb.Vengine.Domain
private async Task LoadNavModel()
{
foreach (var selVm in _selectProps.Values)
{
//if(selVm.navModel != null)
}
var navProps = _root.navProps.Where(a => _selectProps.Values.Any(b => b.vmPath.StartsWith(a.code + "."))).ToList();
await LoadVmodelNavigateAsync(navProps);
}
@@ -74,8 +78,8 @@ namespace Tnb.Vengine.Domain
internal class OutputSelect
{
public string vmId { get; set; } = string.Empty;
public string vmCode { get; set; } = string.Empty;
public Vmodel? navModel { get; set; }
public string navPath { get; set; } = string.Empty;
public string vmPath { get; set; } = string.Empty;
public eNavigateType navType { get; set; } = eNavigateType.None;
public List<string> navPaths { get; set; } = new List<string>();
@@ -89,9 +93,13 @@ namespace Tnb.Vengine.Domain
}
public OutputSelect(Vmodel model)
{
vmId = model.id;
vmCode = model.vmCode;
vmPath = Vmodel.MAIN_ALIES;
}
}
internal class NavigateVmodel
{
public Vmodel? navModel { get; set; }
public string navPath { get; set; }
}
}

View File

@@ -139,6 +139,9 @@ public partial class Vmodel : Entity
public string fullCode
{ get { return areaCode + "/" + vmCode; } }
[SugarColumn(IsIgnore = true)]
public Vmodel? parent { get; set; }
/// <summary>
/// 主键
/// </summary>