commit 57557d81a4a5c897f64fb98e6b5719d3ec967289
Author: wyw <571921741@qq.com>
Date: Tue Apr 7 13:47:52 2026 +0800
新建
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000..3729ff0
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,25 @@
+**/.classpath
+**/.dockerignore
+**/.env
+**/.git
+**/.gitignore
+**/.project
+**/.settings
+**/.toolstarget
+**/.vs
+**/.vscode
+**/*.*proj.user
+**/*.dbmdl
+**/*.jfm
+**/azds.yaml
+**/bin
+**/charts
+**/docker-compose*
+**/Dockerfile*
+**/node_modules
+**/npm-debug.log
+**/obj
+**/secrets.dev.yaml
+**/values.dev.yaml
+LICENSE
+README.md
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..426d76d
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,398 @@
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+##
+## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
+
+# User-specific files
+*.rsuser
+*.suo
+*.user
+*.userosscache
+*.sln.docstates
+
+# User-specific files (MonoDevelop/Xamarin Studio)
+*.userprefs
+
+# Mono auto generated files
+mono_crash.*
+
+# Build results
+[Dd]ebug/
+[Dd]ebugPublic/
+[Rr]elease/
+[Rr]eleases/
+x64/
+x86/
+[Ww][Ii][Nn]32/
+[Aa][Rr][Mm]/
+[Aa][Rr][Mm]64/
+bld/
+[Bb]in/
+[Oo]bj/
+[Ll]og/
+[Ll]ogs/
+
+# Visual Studio 2015/2017 cache/options directory
+.vs/
+# Uncomment if you have tasks that create the project's static files in wwwroot
+#wwwroot/
+
+# Visual Studio 2017 auto generated files
+Generated\ Files/
+
+# MSTest test Results
+[Tt]est[Rr]esult*/
+[Bb]uild[Ll]og.*
+
+# NUnit
+*.VisualState.xml
+TestResult.xml
+nunit-*.xml
+
+# Build Results of an ATL Project
+[Dd]ebugPS/
+[Rr]eleasePS/
+dlldata.c
+
+# Benchmark Results
+BenchmarkDotNet.Artifacts/
+
+# .NET Core
+project.lock.json
+project.fragment.lock.json
+artifacts/
+
+# ASP.NET Scaffolding
+ScaffoldingReadMe.txt
+
+# StyleCop
+StyleCopReport.xml
+
+# Files built by Visual Studio
+*_i.c
+*_p.c
+*_h.h
+*.ilk
+*.meta
+*.obj
+*.iobj
+*.pch
+*.pdb
+*.ipdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.tmp
+*.tmp_proj
+*_wpftmp.csproj
+*.log
+*.tlog
+*.vspscc
+*.vssscc
+.builds
+*.pidb
+*.svclog
+*.scc
+
+# Chutzpah Test files
+_Chutzpah*
+
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opendb
+*.opensdf
+*.sdf
+*.cachefile
+*.VC.db
+*.VC.VC.opendb
+
+# Visual Studio profiler
+*.psess
+*.vsp
+*.vspx
+*.sap
+
+# Visual Studio Trace Files
+*.e2e
+
+# TFS 2012 Local Workspace
+$tf/
+
+# Guidance Automation Toolkit
+*.gpState
+
+# ReSharper is a .NET coding add-in
+_ReSharper*/
+*.[Rr]e[Ss]harper
+*.DotSettings.user
+
+# TeamCity is a build add-in
+_TeamCity*
+
+# DotCover is a Code Coverage Tool
+*.dotCover
+
+# AxoCover is a Code Coverage Tool
+.axoCover/*
+!.axoCover/settings.json
+
+# Coverlet is a free, cross platform Code Coverage Tool
+coverage*.json
+coverage*.xml
+coverage*.info
+
+# Visual Studio code coverage results
+*.coverage
+*.coveragexml
+
+# NCrunch
+_NCrunch_*
+.*crunch*.local.xml
+nCrunchTemp_*
+
+# MightyMoose
+*.mm.*
+AutoTest.Net/
+
+# Web workbench (sass)
+.sass-cache/
+
+# Installshield output folder
+[Ee]xpress/
+
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
+
+# Click-Once directory
+publish/
+
+# Publish Web Output
+*.[Pp]ublish.xml
+*.azurePubxml
+# Note: Comment the next line if you want to checkin your web deploy settings,
+# but database connection strings (with potential passwords) will be unencrypted
+*.pubxml
+*.publishproj
+
+# Microsoft Azure Web App publish settings. Comment the next line if you want to
+# checkin your Azure Web App publish settings, but sensitive information contained
+# in these scripts will be unencrypted
+PublishScripts/
+
+# NuGet Packages
+*.nupkg
+# NuGet Symbol Packages
+*.snupkg
+# The packages folder can be ignored because of Package Restore
+**/[Pp]ackages/*
+# except build/, which is used as an MSBuild target.
+!**/[Pp]ackages/build/
+# Uncomment if necessary however generally it will be regenerated when needed
+#!**/[Pp]ackages/repositories.config
+# NuGet v3's project.json files produces more ignorable files
+*.nuget.props
+*.nuget.targets
+
+# Microsoft Azure Build Output
+csx/
+*.build.csdef
+
+# Microsoft Azure Emulator
+ecf/
+rcf/
+
+# Windows Store app package directories and files
+AppPackages/
+BundleArtifacts/
+Package.StoreAssociation.xml
+_pkginfo.txt
+*.appx
+*.appxbundle
+*.appxupload
+
+# Visual Studio cache files
+# files ending in .cache can be ignored
+*.[Cc]ache
+# but keep track of directories ending in .cache
+!?*.[Cc]ache/
+
+# Others
+ClientBin/
+~$*
+*~
+*.dbmdl
+*.dbproj.schemaview
+*.jfm
+*.pfx
+*.publishsettings
+orleans.codegen.cs
+
+# Including strong name files can present a security risk
+# (https://github.com/github/gitignore/pull/2483#issue-259490424)
+#*.snk
+
+# Since there are multiple workflows, uncomment next line to ignore bower_components
+# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
+#bower_components/
+
+# RIA/Silverlight projects
+Generated_Code/
+
+# Backup & report files from converting an old project file
+# to a newer Visual Studio version. Backup files are not needed,
+# because we have git ;-)
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+UpgradeLog*.htm
+ServiceFabricBackup/
+*.rptproj.bak
+
+# SQL Server files
+*.mdf
+*.ldf
+*.ndf
+
+# Business Intelligence projects
+*.rdl.data
+*.bim.layout
+*.bim_*.settings
+*.rptproj.rsuser
+*- [Bb]ackup.rdl
+*- [Bb]ackup ([0-9]).rdl
+*- [Bb]ackup ([0-9][0-9]).rdl
+
+# Microsoft Fakes
+FakesAssemblies/
+
+# GhostDoc plugin setting file
+*.GhostDoc.xml
+
+# Node.js Tools for Visual Studio
+.ntvs_analysis.dat
+node_modules/
+
+# Visual Studio 6 build log
+*.plg
+
+# Visual Studio 6 workspace options file
+*.opt
+
+# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
+*.vbw
+
+# Visual Studio 6 auto-generated project file (contains which files were open etc.)
+*.vbp
+
+# Visual Studio 6 workspace and project file (working project files containing files to include in project)
+*.dsw
+*.dsp
+
+# Visual Studio 6 technical files
+*.ncb
+*.aps
+
+# Visual Studio LightSwitch build output
+**/*.HTMLClient/GeneratedArtifacts
+**/*.DesktopClient/GeneratedArtifacts
+**/*.DesktopClient/ModelManifest.xml
+**/*.Server/GeneratedArtifacts
+**/*.Server/ModelManifest.xml
+_Pvt_Extensions
+
+# Paket dependency manager
+.paket/paket.exe
+paket-files/
+
+# FAKE - F# Make
+.fake/
+
+# CodeRush personal settings
+.cr/personal
+
+# Python Tools for Visual Studio (PTVS)
+__pycache__/
+*.pyc
+
+# Cake - Uncomment if you are using it
+# tools/**
+# !tools/packages.config
+
+# Tabs Studio
+*.tss
+
+# Telerik's JustMock configuration file
+*.jmconfig
+
+# BizTalk build output
+*.btp.cs
+*.btm.cs
+*.odx.cs
+*.xsd.cs
+
+# OpenCover UI analysis results
+OpenCover/
+
+# Azure Stream Analytics local run output
+ASALocalRun/
+
+# MSBuild Binary and Structured Log
+*.binlog
+
+# NVidia Nsight GPU debugger configuration file
+*.nvuser
+
+# MFractors (Xamarin productivity tool) working folder
+.mfractor/
+
+# Local History for Visual Studio
+.localhistory/
+
+# Visual Studio History (VSHistory) files
+.vshistory/
+
+# BeatPulse healthcheck temp database
+healthchecksdb
+
+# Backup folder for Package Reference Convert tool in Visual Studio 2017
+MigrationBackup/
+
+# Ionide (cross platform F# VS Code tools) working folder
+.ionide/
+
+# Fody - auto-generated XML schema
+FodyWeavers.xsd
+
+# VS Code files for those working on multiple tools
+.vscode/*
+!.vscode/settings.json
+!.vscode/tasks.json
+!.vscode/launch.json
+!.vscode/extensions.json
+*.code-workspace
+
+# Local History for Visual Studio Code
+.history/
+
+# Windows Installer files from build outputs
+*.cab
+*.msi
+*.msix
+*.msm
+*.msp
+
+# JetBrains Rider
+*.sln.iml
diff --git a/APT.API/APT.API.csproj b/APT.API/APT.API.csproj
new file mode 100644
index 0000000..8b93573
--- /dev/null
+++ b/APT.API/APT.API.csproj
@@ -0,0 +1,36 @@
+
+
+
+ net6.0
+ InProcess
+ Linux
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/APT.API/APT.API.sln b/APT.API/APT.API.sln
new file mode 100644
index 0000000..469acde
--- /dev/null
+++ b/APT.API/APT.API.sln
@@ -0,0 +1,61 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.29806.167
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "APT.API", "APT.API.csproj", "{34B722F6-F94F-4013-A4B1-90883AFD9827}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "APT.DAL.Data", "..\APT.DAL.Data\APT.DAL.Data.csproj", "{416E9E2B-95BC-49FE-8E71-B8D362C5E4A1}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "APT.Domain", "..\APT.Domain\APT.Domain.csproj", "{930AFFDA-4BFE-423F-9F27-62919F09E7F0}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "APT.Infrastructure.Api", "..\APT.Infrastructure.Api\APT.Infrastructure.Api.csproj", "{F6A879CE-7319-479C-BA24-BF9DCB71A9A5}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "APT.Infrastructure.Core", "..\APT.Infrastructure.Core\APT.Infrastructure.Core.csproj", "{E93B3210-F2BC-49F5-91A6-5804839FE1DA}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "APT.Infrastructure.EF", "..\APT.Infrastructure.EF\APT.Infrastructure.EF.csproj", "{AAABC7E2-A68E-4F92-9D96-9E3FD874421B}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "APT.Migrations", "..\APT.Migrations\APT.Migrations.csproj", "{68FD728E-A9FE-4E1F-A4BE-EC0642B9C15B}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {34B722F6-F94F-4013-A4B1-90883AFD9827}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {34B722F6-F94F-4013-A4B1-90883AFD9827}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {34B722F6-F94F-4013-A4B1-90883AFD9827}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {34B722F6-F94F-4013-A4B1-90883AFD9827}.Release|Any CPU.Build.0 = Release|Any CPU
+ {416E9E2B-95BC-49FE-8E71-B8D362C5E4A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {416E9E2B-95BC-49FE-8E71-B8D362C5E4A1}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {416E9E2B-95BC-49FE-8E71-B8D362C5E4A1}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {416E9E2B-95BC-49FE-8E71-B8D362C5E4A1}.Release|Any CPU.Build.0 = Release|Any CPU
+ {930AFFDA-4BFE-423F-9F27-62919F09E7F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {930AFFDA-4BFE-423F-9F27-62919F09E7F0}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {930AFFDA-4BFE-423F-9F27-62919F09E7F0}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {930AFFDA-4BFE-423F-9F27-62919F09E7F0}.Release|Any CPU.Build.0 = Release|Any CPU
+ {F6A879CE-7319-479C-BA24-BF9DCB71A9A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {F6A879CE-7319-479C-BA24-BF9DCB71A9A5}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {F6A879CE-7319-479C-BA24-BF9DCB71A9A5}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {F6A879CE-7319-479C-BA24-BF9DCB71A9A5}.Release|Any CPU.Build.0 = Release|Any CPU
+ {E93B3210-F2BC-49F5-91A6-5804839FE1DA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {E93B3210-F2BC-49F5-91A6-5804839FE1DA}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {E93B3210-F2BC-49F5-91A6-5804839FE1DA}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {E93B3210-F2BC-49F5-91A6-5804839FE1DA}.Release|Any CPU.Build.0 = Release|Any CPU
+ {AAABC7E2-A68E-4F92-9D96-9E3FD874421B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {AAABC7E2-A68E-4F92-9D96-9E3FD874421B}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {AAABC7E2-A68E-4F92-9D96-9E3FD874421B}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {AAABC7E2-A68E-4F92-9D96-9E3FD874421B}.Release|Any CPU.Build.0 = Release|Any CPU
+ {68FD728E-A9FE-4E1F-A4BE-EC0642B9C15B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {68FD728E-A9FE-4E1F-A4BE-EC0642B9C15B}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {68FD728E-A9FE-4E1F-A4BE-EC0642B9C15B}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {68FD728E-A9FE-4E1F-A4BE-EC0642B9C15B}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {5040CE81-F008-43D7-AEFC-DF1FE1F5CEB6}
+ EndGlobalSection
+EndGlobal
diff --git a/APT.API/ActionMonitorAttribute.cs b/APT.API/ActionMonitorAttribute.cs
new file mode 100644
index 0000000..80356c2
--- /dev/null
+++ b/APT.API/ActionMonitorAttribute.cs
@@ -0,0 +1,54 @@
+using APT.Infrastructure.Core;
+using Microsoft.AspNetCore.Mvc.Filters;
+using System;
+using System.Diagnostics;
+using System.Net.Http;
+using System.Threading;
+using System.Threading.Tasks;
+
+
+
+namespace APT.Infrastructure.Api.WebFilters
+{
+
+ //public class WebApiTrackerAttribute : System.Web.Http.Filters.ActionFilterAttribute
+ //{
+ // public bool AllowMultiple => true;
+
+ // //public Task ExecuteActionFilterAsync(HttpActionContext actionContext, CancellationToken cancellationToken, Func> continuation)
+ // //{
+ // // throw new NotImplementedException();
+ // //}
+
+ // //public Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
+ // //{
+ // // throw new NotImplementedException();
+ // // var s = 1;
+ // //}
+
+ // public override void OnActionExecuting(HttpActionContext actionContext)
+ // {
+ // LoggerManager.GetLogger().Info("11111111111");
+ // base.OnActionExecuting(actionContext);
+ // }
+
+ // public override void OnActionExecuted(HttpActionExecutedContext actionExecutedContext)
+ // {
+ // LoggerManager.GetLogger().Info("2222222222222");
+ // base.OnActionExecuted(actionExecutedContext);
+ // }
+
+ // public override Task OnActionExecutingAsync(HttpActionContext actionContext, CancellationToken cancellationToken)
+ // {
+ // LoggerManager.GetLogger().Info("2222222222222");
+ // return base.OnActionExecutingAsync(actionContext, cancellationToken);
+ // }
+
+ // public override Task OnActionExecutedAsync(HttpActionExecutedContext actionExecutedContext, CancellationToken cancellationToken)
+ // {
+ // LoggerManager.GetLogger().Info("11111111111");
+ // return base.OnActionExecutedAsync(actionExecutedContext, cancellationToken);
+ // }
+
+ //}
+}
\ No newline at end of file
diff --git a/APT.API/App_Start/DIConfig.cs b/APT.API/App_Start/DIConfig.cs
new file mode 100644
index 0000000..fd184b0
--- /dev/null
+++ b/APT.API/App_Start/DIConfig.cs
@@ -0,0 +1,44 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using Autofac;
+using APT.Infrastructure.Core;
+using APT.Infrastructure.EF;
+
+using Microsoft.Extensions.Logging;
+using APT.Infrastructure.Core.Refctor;
+using System.Reflection;
+using Autofac.Extras.DynamicProxy;
+using APT.Infrastructure.Api;
+namespace APT.API
+{
+ public static class DIConfig
+ {
+ public static void RegisterComponents(this ContainerBuilder builder)
+ {
+ ReflectHelper.GetClassMethodAttr(typeof(EfDbContext));
+
+ builder.RegisterType().As().SingleInstance();
+ builder.RegisterType().As().SingleInstance();
+ builder.RegisterType().PropertiesAutowired();
+ //builder.RegisterType().PropertiesAutowired();
+
+ builder.RegisterType().As().InstancePerLifetimeScope();
+ builder.RegisterType().As().InstancePerLifetimeScope();
+
+ builder.RegisterType(typeof(DomainServiceBase)).As(typeof(IDomainService)).InstancePerLifetimeScope();
+ builder.RegisterType().As().InstancePerLifetimeScope()
+ .PropertiesAutowired();
+ //builder.RegisterType().As().InstancePerLifetimeScope()
+ // .PropertiesAutowired();
+
+ builder.RegisterType();
+ Assembly service = Assembly.Load("APT.API");
+ //Assembly iservice = Assembly.Load("APT.API.IService");
+ builder.RegisterAssemblyTypes(service).AsImplementedInterfaces()
+ .InstancePerLifetimeScope()
+ .EnableInterfaceInterceptors().InterceptedBy(typeof(LogInterceptor));
+ }
+ }
+}
diff --git a/APT.API/CombindedConnectionGenerator.cs b/APT.API/CombindedConnectionGenerator.cs
new file mode 100644
index 0000000..f227849
--- /dev/null
+++ b/APT.API/CombindedConnectionGenerator.cs
@@ -0,0 +1,66 @@
+using System;
+using System.Collections.Generic;
+using System.Net.Http;
+using APT.Infrastructure.Api;
+using APT.Infrastructure.EF;
+using Microsoft.Extensions.Configuration;
+
+namespace APT.API
+{
+ public class CombindedConnectionGenerator : IConnectionGenerator
+ {
+ static Lazy random = new Lazy();
+ private readonly IConfiguration configuration;
+ public string TenantKey => "";
+
+ public CombindedConnectionGenerator(IConfiguration configuration)
+ {
+ this.configuration = configuration;
+ }
+
+
+ public string GetConnection(TenantOption option, TenantInfo tenantInfo)
+ {
+ return tenantInfo.Conn;
+ //var webapiUrl = "http://localhost:5001/api/DbConfigs";
+ //var httpResponseMsg = new HttpResponseMessage();
+
+ //using (var httpClient = new HttpClient())
+ //{
+ // httpResponseMsg = httpClient.GetAsync(webapiUrl).Result;
+
+ // var retrnUrl = httpResponseMsg.Content.ReadAsStringAsync().Result;
+ // dynamic urls = Newtonsoft.Json.JsonConvert.DeserializeObject(retrnUrl);
+ // if (urls != null)
+ // {
+
+ // List connList = new List();
+ // foreach (dynamic url in urls)
+ // {
+ // if (url.name == span)
+ // {
+ // connList.Add(url.conn);
+ // }
+ // }
+ // if (connList.Count > 0)
+ // {
+ // var mod = (random.Value.Next(100) % connList.Count);
+ // return connList[mod];
+ // }
+ // }
+ //}
+
+ //if (span.Length > 4 && int.TryParse(span[5].ToString(), out var number))
+ //{
+ //var mod = (random.Value.Next(1000) % 3)+1;
+ // return configuration.GetConnectionString($"{option.ConnectionPrefix}{mod}");
+ //}
+ throw new NotSupportedException("Ϣ");
+ }//
+
+ public bool MatchTenantKey(string tenantKey)
+ {
+ return true;
+ }
+ }
+}
\ No newline at end of file
diff --git a/APT.API/Controllers/AptController.cs b/APT.API/Controllers/AptController.cs
new file mode 100644
index 0000000..a2736e2
--- /dev/null
+++ b/APT.API/Controllers/AptController.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using APT.Infrastructure.Core;
+using Microsoft.AspNetCore.Mvc;
+
+namespace APT.API
+{
+ [Log]
+ public class AptController : ControllerBase
+ {
+
+ }
+}
diff --git a/APT.API/Controllers/ValuesController.cs b/APT.API/Controllers/ValuesController.cs
new file mode 100644
index 0000000..81ef5e9
--- /dev/null
+++ b/APT.API/Controllers/ValuesController.cs
@@ -0,0 +1,311 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Linq.Expressions;
+using System.Threading.Tasks;
+
+using APT.Domain;
+using APT.Infrastructure.Api.WebFilters;
+using APT.Infrastructure.Core;
+using APT.Infrastructure.EF;
+using APT.Infrastructure.EF.Infrastructure;
+using Microsoft.AspNetCore.Mvc;
+using APT.Infrastructure.Api;
+namespace APT.API
+{
+ public class ValuesController : CommonApiController
+ {
+ private readonly EfDbContext efDbContext;
+
+ public ValuesController(EfDbContext storeDbContext)
+ {
+ this.efDbContext = storeDbContext;
+ //this.storeDbContext.Database.EnsureCreated();
+
+ //this.storeDbContext.Database.Migrate();
+ }
+ [HttpGet, Route("api/values")]
+
+ public JsonActionResult> Get()
+ {
+ var commonService = ServiceLocator.Instance.GetService();
+ ////////return commonService.UnitWork();
+ //var param = new CodeRuleParam()
+ //{
+ // CodeType = 1014,
+ // OrgId = new Guid("b043b28b-bbc3-c452-6052-4fba1457abfa"),
+ // Count = 1,
+ //};
+ ////var xx = commonService.GetRuleCodes(param);
+ var codeRule = new T_PF_CODE_RULE_SERIAL()
+ {
+ ID = Guid.NewGuid(),
+ CODE_TYPE = 3500,
+ ORG_ID = new Guid("b043b28b-bbc3-c452-6052-4fba1457abfa")
+
+ };
+
+ this.efDbContext.AddEntity(codeRule);
+ this.efDbContext.SaveChanges();
+
+ var db = this.efDbContext.GetEntity(t => t.CODE_TYPE == 3500, null);
+ //EfDbContext dbContext = new EfDbContext("User ID=postgres;Password=123456;Host=localhost;Port=5432;Database=Infracture_Test;CommandTimeout=1024;");
+ //var dbs = dbContext.GetEntity(t => t.CODE_TYPE == 3500, null);
+ ////Expression> expression = t => t.ORG_ID == param.OrgId
+ //// && t.CODE_TYPE == 1038;
+ ////expression = expression.And(t => t.DATE_VALUE == "20191016");
+ ////var pageFilter = new BasePageFilter(1, 1);
+ ////pageFilter.Sort = "NUM";
+ ////pageFilter.Order = DbOrder.DESC;
+ ////var maxDbCodeRuleSerial = this.GetOrderPageEntities(expression, pageFilter);
+ //ServiceLocator serviceLocator = ServiceLocator.Instance;
+ //var _connectionResolver = serviceLocator.GetService();
+ //var x1 = commonService.GetEntity(t => t.CODE_TYPE == 3500);
+
+ //x1.MODIFY_TIME = DateTime.Now;
+ //this.UpdateEntity(x1);
+
+ ////x1.STATUS = 2;
+
+ ////var x2 = commonService.GetEntity(t => t.CODE_TYPE == 3500 &&
+ //// t.ORG_ID == param.OrgId && t.STATUS == 0 && t.ID != x1.ID);
+ ////x2.STATUS = 2;
+ ////this.UpdateEntity(x2);
+
+ ////Dictionary bodyParams = new Dictionary();
+ ////bodyParams.Add("sn", "L1002497A000052");
+ ////bodyParams.Add("stationId", "FinallyFunctionTest");
+ ////Dictionary headParams = new Dictionary();
+ ////headParams.Add("Access-Token", "D2B471BAA84582052F9AD2EE49FFB3EE");
+
+ ////var ret = WebUtils.ExecuteByResolving("http://172.20.8.29:9001/api/TestData/GetTestData",
+ //// bodyParams, string.Empty, SendType.Get, headParams);
+
+ //var sttr = WitEntities(null, new KeywordFilter());
+ //return sttr;
+
+ var entity = new TestNoneBaseModel
+ {
+ ID = "Test",
+ Name = "Test"
+ };
+
+ var entities = new List
+ {
+ new TestNoneBaseModel
+ {
+ ID = "Test1",
+ Name = "Test1"
+ },
+ new TestNoneBaseModel
+ {
+ ID = "Test2",
+ Name = "Test2"
+ }
+ };
+
+ //var str = commonService.AddAndGetEntity_noneBase(entity);
+
+ //commonService.AddEntities_noneBase(entities);
+
+ var str1 = commonService.GetEntity_noneBase(o => o.ID == "Test");
+ var strall = commonService.GetEntities_noneBase(o => o.ID.StartsWith("Test"));
+
+
+ return null;
+ }
+ [HttpGet, Route("api/asynctest")]
+ public async Task> asynctest(string id)
+ {
+ return await SafeExecuteAsync(async () =>
+ {
+ await GetAsync();
+ return true;
+ });
+ }
+
+ private async Task GetAsync()
+ {
+ await this.GetPageEntitiesSync(t => t.CODE_TYPE == 3500, null);
+ return;
+ }
+
+ [HttpGet, Route("api/test")]
+
+ public ActionResult test()
+ {
+ var commonService = ServiceLocator.Instance.GetService();
+ ////////return commonService.UnitWork();
+ //var param = new CodeRuleParam()
+ //{
+ // CodeType = 1014,
+ // OrgId = new Guid("b043b28b-bbc3-c452-6052-4fba1457abfa"),
+ // Count = 1,
+ //};
+ ////var xx = commonService.GetRuleCodes(param);
+ var codeRule = new T_PF_CODE_RULE_SERIAL()
+ {
+ ID = Guid.NewGuid(),
+ CODE_TYPE = 3700,
+ ORG_ID = new Guid("b043b28b-bbc3-c452-6052-4fba1457abfa")
+
+ };
+ var codeRule1 = new T_PF_CODE_RULE_SERIAL()
+ {
+ ID = Guid.NewGuid(),
+ CODE_TYPE = 3700,
+ ORG_ID = new Guid("b043b28b-bbc3-c452-6052-4fba1457abfa")
+
+ };
+ commonService.UnifiedCommit(() =>
+ {
+ commonService.AddEntityNoCommit(codeRule);
+ commonService.AddEntityNoCommit(codeRule1);
+ });
+
+ //this.efDbContext.AddEntity(codeRule);
+ //this.efDbContext.SaveChanges();
+
+ var db = this.efDbContext.GetEntity(t => t.ID == codeRule.ID, null);
+
+
+
+ return true;
+ }
+ //[HttpGet]
+ //[Route("api/testError")]
+ //public JsonActionResult testError()
+ //{
+
+ // return SafeExecute(()=>{
+
+ // ThrowError("100000",100,200);
+ // return true;
+ // });
+ //}
+ /////
+ ///// 查询
+ /////
+ /////
+ /////
+ //[HttpPost]
+ //[Route("api/users")]
+ //public IActionResult Entities([FromBody]KeywordFilter filter)
+ //{
+ // return Ok(WitEntities(null, filter));
+ //}
+ /////
+ ///// 查询
+ /////
+ /////
+ /////
+ /////
+
+ //[HttpPost, Route("OrderEntities")]
+ //public JsonActionResult> OrderEntities([FromBody]KeywordFilter filter)
+ //{
+ // return WitOrderEntities(null, filter);
+ //}
+ /////
+ ///// 查询
+ /////
+ /////
+ /////
+ //[HttpPost, Route("Paged")]
+ //public PagedActionResult Paged([FromBody]KeywordPageFilter pageFilter)
+ //{
+ // return WitPaged(null, pageFilter);
+ //}
+ /////
+ ///// 查询
+ /////
+ /////
+ /////
+ //[HttpPost, Route("OrderPaged")]
+ //public async Task> OrderPaged([FromBody]KeywordPageFilter pageFilter)
+ //{
+ // return await WitOrderPagedSync(null, pageFilter);
+ //}
+ /////
+ ///// 删除
+ /////
+ /////
+ /////
+ //[HttpGet, Route("Delete")]
+ //public JsonActionResult Delete(string id)
+ //{
+ // return WitRealDelete(id);
+ //}
+
+ /////
+ ///// 更新
+ /////
+ /////
+ /////
+ //[HttpPost, Route("Update")]
+ //public JsonActionResult Update([FromBody]APT_Test_User entity)
+ //{
+ // return WitUpdate(entity);
+ //}
+
+ /////
+ ///// 批量删除
+ /////
+ /////
+ /////
+ //[HttpGet, Route("BatchDelete")]
+ //public JsonActionResult BatchDelete(string ids)
+ //{
+ // return WitRealBatchDelete(ids);
+ //}
+
+ /////
+ ///// 获得单条实体数据
+ /////
+ /////
+ /////
+ //[HttpPost, Route("Get")]
+ //public JsonActionResult Get([FromBody] KeywordFilter filter)
+ //{
+ // return WitEntity(null, filter);
+ //}
+ }
+
+ public class ExtTestResultModel
+ {
+ public int code { get; set; }
+ public bool success { get; set; }
+ public string message { get; set; }
+
+ public ICollection data { get; set; }
+ }
+ public class ExtTestResultDataModel
+ {
+ public string WORKORDER_ID { get; set; }
+ public string STATION_ID { get; set; }
+ public ICollection TestDataModels { get; set; }
+ }
+
+ public class ExtTestResultTestDataModel
+ {
+ public string SN { get; set; }
+ public string MAC { get; set; }
+ public DateTime TEST_TIME { get; set; }
+ public string TEST_STATE { get; set; }
+ public string PRODUCT_ID { get; set; }
+ public string WORKORDER_ID { get; set; }
+ public string STATION_ID { get; set; }
+
+ public ICollection ParamList { get; set; }
+ }
+
+ public class ExtTestResultTestDataParamModel
+ {
+ public string PARAM_ID { get; set; }
+ public string PARAM_NAME { get; set; }
+ public string PARAM_VALUE { get; set; }
+ public string LIMIT_MIN_VALUE { get; set; }
+ public string LIMIT_MAX_VALUE { get; set; }
+ }
+
+}
diff --git a/APT.API/Dockerfile b/APT.API/Dockerfile
new file mode 100644
index 0000000..83b18bb
--- /dev/null
+++ b/APT.API/Dockerfile
@@ -0,0 +1,28 @@
+#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.
+
+FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim AS base
+WORKDIR /app
+EXPOSE 80
+
+FROM mcr.microsoft.com/dotnet/core/sdk:3.1-buster AS build
+WORKDIR /src
+COPY ["APT.API/APT.API.csproj", "APT.API/"]
+COPY ["APT.Domain/APT.Domain.csproj", "APT.Domain/"]
+COPY ["APT.Infrastructure.EF/APT.Infrastructure.EF.csproj", "APT.Infrastructure.EF/"]
+COPY ["APT.Infrastructure.Core/APT.Infrastructure.Core.csproj", "APT.Infrastructure.Core/"]
+COPY ["Apt.Infrastructure.Utility/APT.Infrastructure.Utility.csproj", "Apt.Infrastructure.Utility/"]
+COPY ["APT.Infrastructure.Api/APT.Infrastructure.Api.csproj", "APT.Infrastructure.Api/"]
+COPY ["APT.DAL.Data/APT.DAL.Data.csproj", "APT.DAL.Data/"]
+COPY ["APT.Migrations/APT.Migrations.csproj", "APT.Migrations/"]
+RUN dotnet restore "APT.API/APT.API.csproj"
+COPY . .
+WORKDIR "/src/APT.API"
+RUN dotnet build "APT.API.csproj" -c Release -o /app/build
+
+FROM build AS publish
+RUN dotnet publish "APT.API.csproj" -c Release -o /app/publish
+
+FROM base AS final
+WORKDIR /app
+COPY --from=publish /app/publish .
+ENTRYPOINT ["dotnet", "APT.API.dll"]
\ No newline at end of file
diff --git a/APT.API/ILogTest.cs b/APT.API/ILogTest.cs
new file mode 100644
index 0000000..b175651
--- /dev/null
+++ b/APT.API/ILogTest.cs
@@ -0,0 +1,13 @@
+using Autofac.Extras.DynamicProxy;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace APT.API
+{
+ [Intercept(typeof(LogInterceptor))]
+ public interface ILogTest
+ {
+ }
+}
diff --git a/APT.API/LogAttribute.cs b/APT.API/LogAttribute.cs
new file mode 100644
index 0000000..9b7449d
--- /dev/null
+++ b/APT.API/LogAttribute.cs
@@ -0,0 +1,50 @@
+using APT.Infrastructure.Core;
+using log4net;
+using Microsoft.AspNetCore.Mvc.Controllers;
+using Microsoft.AspNetCore.Mvc.Filters;
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Web.Mvc;
+
+namespace APT.API
+{
+ public class LogAttribute : Attribute, IAsyncActionFilter
+ {
+ ///
+ /// 添加操作日志 liyouming
+ ///
+ ///
+ ///
+ ///
+ public async Task OnActionExecutionAsync(Microsoft.AspNetCore.Mvc.Filters.ActionExecutingContext context, ActionExecutionDelegate next)
+ {
+ string actionArguments = context.ActionArguments.ToJson();
+ var resultContext = await next();
+
+ string url = resultContext.HttpContext.Request.Host + resultContext.HttpContext.Request.Path + resultContext.HttpContext.Request.QueryString;
+
+ string method = resultContext.HttpContext.Request.Method;
+
+ dynamic result = resultContext.Result.GetType().Name == "EmptyResult" ? new { Value = "EmptyResult" } : resultContext.Result as dynamic;
+
+ var userHeads = resultContext.HttpContext.Request.Headers;
+ var userid = string.Empty;
+ var username = string.Empty;
+ if (userHeads.ContainsKey("userid"))
+ {
+ userid = userHeads["userid"].ToString();
+ }
+ if (userHeads.ContainsKey("username"))
+ {
+ username = userHeads["username"].ToString();
+ }
+ string response = JsonConvert.SerializeObject(result.Value);
+ var str = $"用户ID:[{userid}],姓名:[{username}],api地址:[{url}],方法:[{method}],接口参数:[{actionArguments}],应答:[{response}]";
+ LoggerManager.GetLogger("SQLLog").Info(str);
+ await next.Invoke();
+ }
+ }
+}
diff --git a/APT.API/LogInterceptor.cs b/APT.API/LogInterceptor.cs
new file mode 100644
index 0000000..a802cf8
--- /dev/null
+++ b/APT.API/LogInterceptor.cs
@@ -0,0 +1,28 @@
+using Autofac.Extras.DynamicProxy;
+using Castle.DynamicProxy;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace APT.API
+{
+ [Intercept(typeof(LogInterceptor))]
+ public class LogInterceptor: IInterceptor
+ {
+ public void Intercept(IInvocation invocation)
+ {
+ try
+ {
+ invocation.Proceed();
+ var s = invocation.Method.Name;
+ //LogManager.logger.Info(invocation.Method.Name);
+ }
+ catch (Exception ex)
+ {
+ var s = invocation.Method.Name;
+ //Dapper.Logger.LogHelper.logger.Error(invocation.Method.Name + " " + ex.ToString());
+ }
+ }
+ }
+}
diff --git a/APT.API/Program.cs b/APT.API/Program.cs
new file mode 100644
index 0000000..ecc3594
--- /dev/null
+++ b/APT.API/Program.cs
@@ -0,0 +1,19 @@
+using Microsoft.AspNetCore;
+using Microsoft.AspNetCore.Hosting;
+using Autofac.Extensions.DependencyInjection;
+
+namespace APT.API
+{
+ public class Program
+ {
+ public static void Main(string[] args)
+ {
+ CreateWebHostBuilder(args).Build().Run();
+ }
+
+ public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
+ WebHost.CreateDefaultBuilder(args)
+ .ConfigureServices(services => services.AddAutofac())
+ .UseStartup();
+ }
+}
diff --git a/APT.API/Properties/launchSettings.json b/APT.API/Properties/launchSettings.json
new file mode 100644
index 0000000..36b5f59
--- /dev/null
+++ b/APT.API/Properties/launchSettings.json
@@ -0,0 +1,36 @@
+{
+ "iisSettings": {
+ "windowsAuthentication": false,
+ "anonymousAuthentication": true,
+ "iisExpress": {
+ "applicationUrl": "http://localhost:57773",
+ "sslPort": 0
+ }
+ },
+ "$schema": "http://json.schemastore.org/launchsettings.json",
+ "profiles": {
+ "IIS Express": {
+ "commandName": "IISExpress",
+ "launchBrowser": true,
+ "launchUrl": "api/values",
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Development"
+ }
+ },
+ "APT.API": {
+ "commandName": "Project",
+ "launchBrowser": true,
+ "launchUrl": "api/values",
+ "environmentVariables": {
+ "ASPNETCORE_ENVIRONMENT": "Development"
+ },
+ "applicationUrl": "http://localhost:5000"
+ },
+ "Docker": {
+ "commandName": "Docker",
+ "launchBrowser": true,
+ "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/api/values",
+ "publishAllPorts": true
+ }
+ }
+}
\ No newline at end of file
diff --git a/APT.API/Startup.cs b/APT.API/Startup.cs
new file mode 100644
index 0000000..1d29511
--- /dev/null
+++ b/APT.API/Startup.cs
@@ -0,0 +1,122 @@
+using Autofac;
+using APT.Infrastructure.Core;
+using APT.Infrastructure.Core.Utils;
+using APT.Infrastructure.EF;
+using log4net;
+using log4net.Config;
+using Microsoft.AspNetCore.Builder;
+using Microsoft.AspNetCore.Hosting;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.Extensions.Configuration;
+using Microsoft.Extensions.DependencyInjection;
+using Microsoft.Extensions.DependencyInjection.Extensions;
+using System.IO;
+using APT.Infrastructure.Api.WebFilters;
+using Autofac.Extras.DynamicProxy;
+using APT.Infrastructure.EF.Infrastructure;
+using APT.Infrastructure.EF.Extensions;
+using APT.Infrastructure.Api;
+using ConfigurationManager = APT.Infrastructure.Api.ConfigurationManager;
+
+namespace APT.API
+{
+ public class Startup
+ {
+ public Startup(IConfiguration configuration)
+ {
+ Configuration = configuration;
+ var repository = LogManager.GetRepository
+ (System.Reflection.Assembly.GetEntryAssembly());
+ var fileInfo = new FileInfo("log4net.config");
+ if (!fileInfo.Exists)
+ fileInfo = new FileInfo(Path.Combine(System.AppContext.BaseDirectory, "log4net.config"));
+ XmlConfigurator.Configure(repository, fileInfo);
+ ConfigurationManager.Register(configuration);
+
+ InitUtils.Init();
+ }
+
+ public IConfiguration Configuration { get; }
+
+ // This method gets called by the runtime. Use this method to add services to the container.
+ public void ConfigureServices(IServiceCollection services)
+ {
+ services.AddScoped();
+ services.AddScoped();
+ services.AddScoped();
+
+ //services.AddPostgrePerConnection(settings =>
+ //{
+ // settings.ConnectionPrefix = "postgre_store";
+ //});
+
+ services.AddMvc(t=> {
+ t.EnableEndpointRouting = false;
+ });
+
+ // services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
+ services.TryAddSingleton();
+ //UpdateDatabase();
+ }
+ void setupDb(TenantSettings settings)
+ {
+ //settings.ConnectionPrefix = "de";
+ //settings.DbContextSetup = (serviceProvider, connectionString, optionsBuilder) =>
+ //{
+ // var tenant = serviceProvider.GetService();
+ // optionsBuilder
+ // .UseLazyLoadingProxies(false)
+ // .UseNpgsql(connectionString, builder =>
+ // {
+ // // not necessary, if you are not using the table or schema
+ // builder.TenantBuilderSetup(serviceProvider, settings, tenant);
+ // });
+ //};
+ }
+ // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
+ public void Configure(IApplicationBuilder app, IHostingEnvironment env)
+ {
+ if (env.IsDevelopment())
+ {
+ app.UseDeveloperExceptionPage();
+ }
+ else
+ {
+ // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
+ app.UseHsts();
+ }
+ app.UseMiddleware();
+ Infrastructure.Api.HttpContext.Register(app.ApplicationServices.
+ GetRequiredService()
+ );
+ app.Use(next => context => {
+ context.Request.EnableBuffering();
+ return next(context);
+ });
+
+
+
+ app.UseHttpsRedirection();
+ app.UseMvc();
+ }
+
+ private static void UpdateDatabase()
+ {
+ //using (var context = new MigrationContext())
+ //{
+ // context.Database.Migrate();
+ //}
+ }
+
+ public virtual void ConfigureContainer(ContainerBuilder builder)
+ {
+ builder.RegisterComponents();
+ //var builders = new ConfigurationBuilder()
+ //.AddJsonFile("appsettings.json");
+ //ConfigurationHelper.Configuration = builders.Build();
+
+ }
+ }
+}
diff --git a/APT.API/appsettings.Development.json b/APT.API/appsettings.Development.json
new file mode 100644
index 0000000..e203e94
--- /dev/null
+++ b/APT.API/appsettings.Development.json
@@ -0,0 +1,9 @@
+{
+ "Logging": {
+ "LogLevel": {
+ "Default": "Debug",
+ "System": "Information",
+ "Microsoft": "Information"
+ }
+ }
+}
diff --git a/APT.API/appsettings.json b/APT.API/appsettings.json
new file mode 100644
index 0000000..57ec4da
--- /dev/null
+++ b/APT.API/appsettings.json
@@ -0,0 +1,32 @@
+{
+ "ConnectionStrings": {
+ //"default": "Data Source=172.20.8.76:1521/DB1;User ID=\"dbo\";Password=mssdev"
+ //"default": "Database=Test1;Data Source=localhost;Port=3306;User Id=root;Password=123456;TreatTinyAsBoolean=true;",
+ //"default": "Data Source=172.20.8.76:1521/DB1;User Id=\"dbo\";Password=mssdev;Pooling=false;PERSIST SECURITY INFO=True;"
+ //"default": "Data Source=172.20.10.173;Initial Catalog=DBTest;User ID=sa;Password=Ldx123456"
+
+ //"default": "User ID=postgres;Password=123456;Host=172.20.8.48;Port=5432;Database=mes;CommandTimeout=1024;",
+ "default": "User ID=postgres;Password=123456;Host=localhost;Port=5432;Database=Infracture_Test;CommandTimeout=1024;",
+
+ "postgre_store1": "Server=127.0.0.1;Port=5432;Database=testdb1;User Id=postgres;Password=123456;",
+ "postgre_store2": "Server=127.0.0.1;Port=5432;Database=testdb2;User Id=postgres;Password=123456;",
+ "postgre_store3": "Server=127.0.0.1;Port=5432;Database=testdb3;User Id=postgres;Password=123456;"
+ },
+ "AppSettings": {
+ "DataBaseType": "postgresql",
+ "isSqlLog": "true",
+ "ConnApiUrl": "http://172.20.8.48/GetConn",
+ "ConnDataKey": "optenergy"
+
+ },
+ "AllowedHosts": "*",
+ "InflexdbConfig": {
+ "Url": "http://192.168.2.98:8087/",
+ "UserName": "optuser",
+ "PassWord": "optienergy",
+ "DbName": "opt",
+ "LogDbName": "OPTiEnergyLog",
+ "AppOnline": "optAppOnline"
+
+ }
+}
diff --git a/APT.API/log4net.config b/APT.API/log4net.config
new file mode 100644
index 0000000..1c5d484
--- /dev/null
+++ b/APT.API/log4net.config
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/APT.DAL.Data/APT.DAL.Data.csproj b/APT.DAL.Data/APT.DAL.Data.csproj
new file mode 100644
index 0000000..431b7cb
--- /dev/null
+++ b/APT.DAL.Data/APT.DAL.Data.csproj
@@ -0,0 +1,16 @@
+
+
+
+ netstandard2.1
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/APT.DAL.Data/CourseMap.cs b/APT.DAL.Data/CourseMap.cs
new file mode 100644
index 0000000..eb00696
--- /dev/null
+++ b/APT.DAL.Data/CourseMap.cs
@@ -0,0 +1,27 @@
+using APT.Domain;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Metadata.Builders;
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace APT.DAL.Data
+{
+ public class CourseMap : IEntityTypeConfiguration
+ {
+ public CourseMap(ModelBuilder builder)
+ {
+ builder.Entity()
+ .HasOne(o => o.TestUser)
+ .WithMany()
+ .HasForeignKey(o => o.UserID);
+ }
+
+ public virtual void Configure(EntityTypeBuilder builder)
+ {
+ builder.HasOne(o => o.TestUser)
+ .WithMany()
+ .HasForeignKey(o => o.UserID);
+ }
+ }
+}
diff --git a/APT.DAL.Data/PhoneMap.cs b/APT.DAL.Data/PhoneMap.cs
new file mode 100644
index 0000000..018b9f9
--- /dev/null
+++ b/APT.DAL.Data/PhoneMap.cs
@@ -0,0 +1,27 @@
+using APT.Domain;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Metadata.Builders;
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace APT.DAL.Data
+{
+ public class PhoneMap : IEntityTypeConfiguration
+ {
+ //public PhoneMap(ModelBuilder builder)
+ //{
+ // builder.Entity()
+ // .HasOne(o => o.TestUser)
+ // .WithMany()
+ // .HasForeignKey(o => o.TestUser_ID);
+ //}
+
+ public virtual void Configure(EntityTypeBuilder builder)
+ {
+ builder.HasOne(o => o.Nav_TestUser)
+ .WithMany()
+ .HasForeignKey(o => o.TestUser_ID);
+ }
+ }
+}
diff --git a/APT.DAL.Data/TestNoneBaseMap.cs b/APT.DAL.Data/TestNoneBaseMap.cs
new file mode 100644
index 0000000..cd039d7
--- /dev/null
+++ b/APT.DAL.Data/TestNoneBaseMap.cs
@@ -0,0 +1,16 @@
+using APT.Domain;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Metadata.Builders;
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace APT.DAL.Data
+{
+ public class TestNoneBaseMap : IEntityTypeConfiguration
+ {
+ public virtual void Configure(EntityTypeBuilder builder)
+ {
+ }
+ }
+}
diff --git a/APT.DAL.Data/UserMap.cs b/APT.DAL.Data/UserMap.cs
new file mode 100644
index 0000000..7254d7b
--- /dev/null
+++ b/APT.DAL.Data/UserMap.cs
@@ -0,0 +1,40 @@
+using APT.Domain;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Metadata.Builders;
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace APT.DAL.Data
+{
+ public class UserMap : IEntityTypeConfiguration
+ {
+ //public UserMap(ModelBuilder builder)
+ //{
+ // builder.Entity(c =>
+ // {
+ // c.HasMany(o => o.TestPhones)
+ // .WithOne(o => o.TestUser)
+ // .HasForeignKey(o => o.TestUser_ID);
+
+ // c.HasMany(o => o.Courses)
+ // .WithOne(o => o.TestUser)
+ // .HasForeignKey(o => o.UserID);
+ // });
+
+ // builder.Entity().Property(t => t.IS_DELETED).HasColumnType("bit(1)");
+ //}
+
+ public virtual void Configure(EntityTypeBuilder builder)
+ {
+
+ //builder.HasMany(o => o.TestPhones)
+ //.WithOne(o => o.Nav_TestUser)
+ //.HasForeignKey(o => o.TestUser_ID);
+
+ builder.HasMany(o => o.Courses)
+ .WithOne(o => o.TestUser)
+ .HasForeignKey(o => o.UserID);
+ }
+ }
+}
diff --git a/APT.Domain/APT.Domain.csproj b/APT.Domain/APT.Domain.csproj
new file mode 100644
index 0000000..7c5aab1
--- /dev/null
+++ b/APT.Domain/APT.Domain.csproj
@@ -0,0 +1,15 @@
+
+
+
+ netstandard2.1
+
+
+
+
+
+
+
+
+
+
+
diff --git a/APT.Domain/LDX_Test_Course.cs b/APT.Domain/LDX_Test_Course.cs
new file mode 100644
index 0000000..ddecb37
--- /dev/null
+++ b/APT.Domain/LDX_Test_Course.cs
@@ -0,0 +1,22 @@
+using APT.Infrastructure.Core;
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace APT.Domain
+{
+ public class APT_Test_Course : MesEntityBase
+ {
+ public string Name { get; set; }
+
+ public string TeacherName { get; set; }
+
+ public string ClassTime { get; set; }
+
+ public int Score { get; set; }
+
+ public Guid UserID { get; set; }
+
+ public virtual APT_Test_User TestUser { get; set; }
+ }
+}
diff --git a/APT.Domain/LDX_Test_Phone.cs b/APT.Domain/LDX_Test_Phone.cs
new file mode 100644
index 0000000..f2079e0
--- /dev/null
+++ b/APT.Domain/LDX_Test_Phone.cs
@@ -0,0 +1,22 @@
+using APT.Infrastructure.Core;
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace APT.Domain
+{
+ public class APT_Test_Phone : MesEntityBase
+ {
+ public string Brand { get; set; }
+
+ public string Model { get; set; }
+
+ public decimal Price { get; set; }
+
+ public Guid TestUser_ID { get; set; }
+
+ public int? Number { get; set; }
+
+ public virtual APT_Test_User Nav_TestUser { get; set; }
+ }
+}
diff --git a/APT.Domain/LDX_Test_User.cs b/APT.Domain/LDX_Test_User.cs
new file mode 100644
index 0000000..d949860
--- /dev/null
+++ b/APT.Domain/LDX_Test_User.cs
@@ -0,0 +1,18 @@
+using APT.Infrastructure.Core;
+using System.Collections.Generic;
+
+namespace APT.Domain
+{
+ public class APT_Test_User : MesEntityBase
+ {
+ public string Country { get; set; }
+
+ public string FirstName { get; set; }
+
+ public string LastName { get; set; }
+
+ /// public virtual ICollection TestPhones { get; set; }
+
+ public virtual ICollection Courses { get; set; }
+ }
+}
diff --git a/APT.Domain/ModelBase.cs b/APT.Domain/ModelBase.cs
new file mode 100644
index 0000000..9cd2e21
--- /dev/null
+++ b/APT.Domain/ModelBase.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace APT.Domain
+{
+ public class EntityBase
+ {
+ public Guid ID { get; set; } = Guid.NewGuid();
+
+ public DateTime CreatedTime { get; set; } = DateTime.Now;
+
+ public DateTime LastUpdated { get; set; } = DateTime.Now;
+ }
+}
diff --git a/APT.Domain/TestNoneBaseModel.cs b/APT.Domain/TestNoneBaseModel.cs
new file mode 100644
index 0000000..6d666f3
--- /dev/null
+++ b/APT.Domain/TestNoneBaseModel.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace APT.Domain
+{
+ public class TestNoneBaseModel
+ {
+ public string ID { get; set; }
+
+ public string Name { get; set; }
+ }
+}
diff --git a/APT.Frame.sln b/APT.Frame.sln
new file mode 100644
index 0000000..6cbc23d
--- /dev/null
+++ b/APT.Frame.sln
@@ -0,0 +1,73 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.30011.22
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "APT.API", "APT.API\APT.API.csproj", "{F87A3F72-7E1A-4F63-BE31-6F88199945F0}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "APT.DAL.Data", "APT.DAL.Data\APT.DAL.Data.csproj", "{8A846A4E-70E7-410B-BEC9-DA625E0A0B06}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "APT.Domain", "APT.Domain\APT.Domain.csproj", "{25554D0A-39CA-4E43-B514-ECC66C5A124F}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "APT.Infrastructure.Api", "APT.Infrastructure.Api\APT.Infrastructure.Api.csproj", "{0F778BA2-640D-4DBA-BF17-DBFE40D94C81}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "APT.Infrastructure.Core", "APT.Infrastructure.Core\APT.Infrastructure.Core.csproj", "{783359E8-9993-42E4-8CD9-D6D3C52B0085}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "APT.Infrastructure.EF", "APT.Infrastructure.EF\APT.Infrastructure.EF.csproj", "{AC74146E-9B8D-4B92-8096-E37E13A498E0}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "APT.Migrations", "APT.Migrations\APT.Migrations.csproj", "{CE1F054B-F743-4581-903A-2E5E1D99DC51}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "APT.Infrastructure.Utility", "Apt.Infrastructure.Utility\APT.Infrastructure.Utility.csproj", "{960E5BF4-8B74-4E81-91D8-ADCA8ABED8E1}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "APT.Infrastructure.Redis", "APT.Infrastructure.Redis\APT.Infrastructure.Redis.csproj", "{BD1F2435-9879-4F57-A3B2-5D61D1817CD5}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {F87A3F72-7E1A-4F63-BE31-6F88199945F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {F87A3F72-7E1A-4F63-BE31-6F88199945F0}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {F87A3F72-7E1A-4F63-BE31-6F88199945F0}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {F87A3F72-7E1A-4F63-BE31-6F88199945F0}.Release|Any CPU.Build.0 = Release|Any CPU
+ {8A846A4E-70E7-410B-BEC9-DA625E0A0B06}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {8A846A4E-70E7-410B-BEC9-DA625E0A0B06}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {8A846A4E-70E7-410B-BEC9-DA625E0A0B06}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {8A846A4E-70E7-410B-BEC9-DA625E0A0B06}.Release|Any CPU.Build.0 = Release|Any CPU
+ {25554D0A-39CA-4E43-B514-ECC66C5A124F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {25554D0A-39CA-4E43-B514-ECC66C5A124F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {25554D0A-39CA-4E43-B514-ECC66C5A124F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {25554D0A-39CA-4E43-B514-ECC66C5A124F}.Release|Any CPU.Build.0 = Release|Any CPU
+ {0F778BA2-640D-4DBA-BF17-DBFE40D94C81}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {0F778BA2-640D-4DBA-BF17-DBFE40D94C81}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {0F778BA2-640D-4DBA-BF17-DBFE40D94C81}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {0F778BA2-640D-4DBA-BF17-DBFE40D94C81}.Release|Any CPU.Build.0 = Release|Any CPU
+ {783359E8-9993-42E4-8CD9-D6D3C52B0085}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {783359E8-9993-42E4-8CD9-D6D3C52B0085}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {783359E8-9993-42E4-8CD9-D6D3C52B0085}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {783359E8-9993-42E4-8CD9-D6D3C52B0085}.Release|Any CPU.Build.0 = Release|Any CPU
+ {AC74146E-9B8D-4B92-8096-E37E13A498E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {AC74146E-9B8D-4B92-8096-E37E13A498E0}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {AC74146E-9B8D-4B92-8096-E37E13A498E0}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {AC74146E-9B8D-4B92-8096-E37E13A498E0}.Release|Any CPU.Build.0 = Release|Any CPU
+ {CE1F054B-F743-4581-903A-2E5E1D99DC51}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {CE1F054B-F743-4581-903A-2E5E1D99DC51}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {CE1F054B-F743-4581-903A-2E5E1D99DC51}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {CE1F054B-F743-4581-903A-2E5E1D99DC51}.Release|Any CPU.Build.0 = Release|Any CPU
+ {960E5BF4-8B74-4E81-91D8-ADCA8ABED8E1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {960E5BF4-8B74-4E81-91D8-ADCA8ABED8E1}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {960E5BF4-8B74-4E81-91D8-ADCA8ABED8E1}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {960E5BF4-8B74-4E81-91D8-ADCA8ABED8E1}.Release|Any CPU.Build.0 = Release|Any CPU
+ {BD1F2435-9879-4F57-A3B2-5D61D1817CD5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {BD1F2435-9879-4F57-A3B2-5D61D1817CD5}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {BD1F2435-9879-4F57-A3B2-5D61D1817CD5}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {BD1F2435-9879-4F57-A3B2-5D61D1817CD5}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {309AAC7D-8F7A-4037-A847-A42A651A48B6}
+ EndGlobalSection
+EndGlobal
diff --git a/APT.Infrastructure.Api/APT.Infrastructure.Api.csproj b/APT.Infrastructure.Api/APT.Infrastructure.Api.csproj
new file mode 100644
index 0000000..45ee91a
--- /dev/null
+++ b/APT.Infrastructure.Api/APT.Infrastructure.Api.csproj
@@ -0,0 +1,31 @@
+
+
+
+ netstandard2.1
+ 2.0.2.52
+ true
+ 2.0.0.52
+ 2.0.0.52
+
+
+
+ .\APT.Infrastructure.Api.xml
+ 3
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/APT.Infrastructure.Api/APT.Infrastructure.Api.xml b/APT.Infrastructure.Api/APT.Infrastructure.Api.xml
new file mode 100644
index 0000000..a10a196
--- /dev/null
+++ b/APT.Infrastructure.Api/APT.Infrastructure.Api.xml
@@ -0,0 +1,3293 @@
+
+
+
+ APT.Infrastructure.Api
+
+
+
+
+ 基类接口
+
+
+
+
+
+ 单元操作
+
+
+
+
+ 通过获取一条记录
+
+ ID
+
+
+
+
+ 通过获取一条记录
+
+ ID
+
+
+
+
+ 通过获取一条记录
+
+ ID
+
+
+
+
+ 排序后的所有记录
+
+ 排序方式
+ 条件
+ 分页参数
+ 导航属性
+
+
+
+
+ 获取所有记录
+
+
+
+
+
+
+
+
+ 分页查询
+
+ 过滤条件
+ 过滤实体fiter
+ 导航属性
+
+
+
+
+ 排序后分页查询
+
+ 排序条件
+ 过滤条件
+ 过滤实体fiter
+ 导航属性
+
+
+
+
+ 排序后分页查询
+
+ 排序条件
+ 过滤条件
+ 过滤实体fiter
+ 导航属性
+
+
+
+
+ 排序后分页查询
+
+ 排序条件
+ 过滤条件
+ 过滤实体fiter
+ 导航属性
+
+
+
+
+ 排序后分页查询
+
+ 排序条件
+ 过滤条件
+ 过滤实体fiter
+ 导航属性
+
+
+
+
+ 提交事务
+
+ 返回结果
+ 数据处理
+ 数据提交
+
+
+
+
+ 提交事务
+
+ 执行方法
+ 提交方法
+
+
+
+ 提交事务
+
+ 提交方法
+
+
+
+
+
+ 返回类型
+ 执行
+ 返回
+
+
+
+
+ 统一提交
+
+
+
+
+
+
+
+
+ 统一提交
+
+ 提交方法
+
+
+
+ 基类接口
+
+ 数据库类型
+
+
+
+ 添加一条记录
+
+
+
+
+
+
+ 更新一条记录
+
+
+
+
+
+
+ 按字段更新数据
+
+
+
+
+
+
+ 根据条件删除
+
+ 条件
+
+
+
+
+ 删除实体
+
+ 实体集合
+
+
+
+
+ 删除实体
+
+
+
+
+
+
+ 根据条件删除
+
+ 条件
+
+
+
+
+ 删除实体
+
+ 实体集合
+
+
+
+
+ 删除实体
+
+
+
+
+
+
+ 批量新增数据
+
+
+
+
+
+
+ 批量更新数据(效率快)
+
+
+
+
+
+
+ 获取条数
+
+
+
+
+
+
+
+ 通过ID删除
+
+
+
+
+
+
+ 通过ID删除
+
+
+
+
+
+
+ 通过ID字符串删除
+
+
+
+
+
+
+ 通过ID数组删除
+
+
+
+
+
+
+ 通过ID字符串删除
+
+
+
+
+
+
+ 通过ID数组删除
+
+
+
+
+
+
+ 树基类接口
+
+
+
+
+
+ 添加一条记录
+
+
+
+
+
+
+ 更新一条记录
+
+
+
+
+
+
+ 根据条件删除
+
+ 条件
+
+
+
+
+ 删除实体
+
+ 实体集合
+
+
+
+
+ 删除实体
+
+
+
+
+
+
+ 根据条件删除
+
+ 条件
+
+
+
+
+ 删除实体
+
+ 实体集合
+
+
+
+
+ 删除实体
+
+
+
+
+
+
+ 批量新增数据
+
+
+
+
+
+
+ 批量更新数据(效率快)
+
+
+
+
+
+
+ 获取条数
+
+
+
+
+
+
+
+ 通过ID删除
+
+
+
+
+
+
+ 通过ID删除
+
+
+
+
+
+
+ 通过ID字符串删除
+
+
+
+
+
+
+ 通过ID数组删除
+
+
+
+
+
+
+ 通过ID字符串删除
+
+
+
+
+
+
+ 通过ID数组删除
+
+
+
+
+
+
+ 获取树数据
+
+ lamble表达式
+ 过滤实体
+
+
+
+
+
+
+ 抛出错误
+
+
+
+
+
+ 为 基础操作 提供统一的返回格式,包含try / catch操作。
+
+ 返回值类型
+
+
+
+
+
+ 为 基础操作 提供统一的返回格式,包含try / catch操作。
+
+ 返回值类型
+
+
+
+
+
+ 为 基础操作 提供统一的返回格式,包含try / catch操作。
+
+ 返回值类型
+
+
+
+
+
+ 为取 分页数据 提供统一的返回格式,包含try / catch操作。
+
+ 返回值类型
+
+
+
+
+
+ 根据Request中的QueryString获得Linq表达式
+
+ 实体对象
+
+
+
+
+ 获取操作单元
+
+
+
+
+
+
+ 查询实体
+
+
+
+
+
+
+
+
+ 查询实体
+
+
+
+
+
+
+
+
+ 查询实体
+
+
+
+
+
+
+
+
+ 查询实体
+
+
+
+
+
+
+
+
+ 获取所有数据
+
+
+
+
+
+
+
+
+
+ 获取所有数据
+
+ 类型
+ 排序
+ lambd表达式
+ 过滤器
+ 需要关联查询的数据
+
+
+
+
+ 获取所有数据
+
+ 类型
+ lambd表达式
+ 过滤器
+ 需要关联查询的数据
+
+
+
+
+ 排序获取数据
+
+
+
+
+
+
+
+
+
+
+
+ 排序获取数据
+
+
+
+
+
+
+
+
+
+
+
+ 获取实体集合
+
+
+
+
+
+
+
+
+
+ 获取排序的实体集合
+
+
+
+
+
+
+
+
+
+ 分页查询
+
+
+
+
+
+
+
+
+
+
+
+ 获取排序的实体集合
+
+
+
+
+
+
+
+
+
+ 获取排序的实体集合
+
+
+
+
+
+
+
+
+
+ 获取排序的实体集合
+
+
+
+
+
+
+
+
+
+ 查询实体
+
+
+
+
+
+
+
+
+ 查询实体
+
+
+
+
+
+
+
+
+ 查询实体
+
+
+
+
+
+
+
+
+ 获取所有数据
+
+
+
+
+
+
+
+
+
+ 获取所有数据
+
+ 类型
+ 排序
+ lambd表达式
+ 过滤器
+ 需要关联查询的数据
+
+
+
+
+ 获取所有数据
+
+ 类型
+ 排序
+ lambd表达式
+ 过滤器
+ 需要关联查询的数据
+
+
+
+
+ 排序获取数据
+
+
+
+
+
+
+
+
+
+
+
+ 排序获取数据
+
+
+
+
+
+
+
+
+
+
+
+ 获取实体集合
+
+
+
+
+
+
+
+
+
+ 获取排序的实体集合
+
+
+
+
+
+
+
+
+
+ 获取排序的实体集合
+
+
+
+
+
+
+
+
+
+ 获取条数
+
+
+
+
+
+
+
+
+ 添加实体
+
+
+
+
+
+
+ 添加实体
+
+
+
+
+
+
+ 删除实体
+
+
+
+
+
+
+ 删除实体
+
+
+
+
+
+
+ 删除实体
+
+
+
+
+
+
+ 删除实体
+
+
+
+
+
+
+
+ 逻辑批量删除
+
+
+
+
+
+
+
+ 删除实体
+
+
+
+
+
+
+ 删除实体
+
+
+
+
+
+
+ 删除实体
+
+
+
+
+
+
+
+ 批量删除实体
+
+ id集合
+
+
+
+
+ 更新实体
+
+
+
+
+
+
+ 按字段更新实体
+
+
+
+
+
+
+ 批量添加实体
+
+ 实体集合
+
+
+
+
+ 批量更新实体
+
+ 实体集
+
+
+
+
+ 更具字段批量更新实体
+
+ 实体集
+
+
+
+
+ 批量保存实体
+
+ 批量保存
+
+
+
+
+ 添加实体
+
+
+
+
+
+
+ 删除实体
+
+
+
+
+
+
+ 删除实体
+
+
+
+
+
+
+ 删除实体
+
+
+
+
+
+
+ 删除实体
+
+
+
+
+
+
+
+ 逻辑批量删除
+
+
+
+
+
+
+
+ 更新实体
+
+
+
+
+
+
+ 批量添加实体
+
+ 实体集合
+
+
+
+
+ 更新实体
+
+
+
+
+
+
+ 批量添加实体
+
+ 实体集合
+
+
+
+
+ 批量更新实体
+
+ 实体集
+
+
+
+
+ 批量保存实体
+
+ 批量保存
+
+
+
+
+ 根据数据库连接新增数据
+
+
+ 实体数据
+ 加密连接
+
+
+
+ 根据数据库连接更新数据
+
+
+ 实体数据集合
+ 加密连接
+
+
+
+ 根据数据库连接更新数据
+
+
+ 实体数据
+ 加密连接
+ 更新字段
+
+
+
+ 根据数据库连接删除数据
+
+
+ 表达式
+ 加密连接
+
+
+
+ 根据数据库连接删除数据
+
+
+ 数据实体
+ 加密连接
+
+
+
+ 根据数据库连接删除数据
+
+
+ 主键
+ 加密连接
+
+
+
+ 根据数据库连接删除数据
+
+
+ 数据集合
+ 加密连接
+
+
+
+ 根据数据库连接新增数据
+
+
+ 数据集合
+ 加密连接
+
+
+
+ 根据数据库连接新增数据
+
+
+
+
+
+
+
+
+ 根据数据库租户新增数据
+
+
+ 实体数据
+ 加密租户
+
+
+
+ 根据数据库租户更新数据
+
+
+ 实体数据集合
+ 加密租户
+
+
+
+ 根据数据库租户更新数据
+
+
+ 实体数据
+ 加密租户
+ 更新字段
+
+
+
+ 根据数据库租户删除数据
+
+
+ 表达式
+ 加密租户
+
+
+
+ 根据数据库租户删除数据
+
+
+ 数据实体
+ 加密租户
+
+
+
+ 根据数据库租户删除数据
+
+
+ 主键
+ 加密租户
+
+
+
+ 根据数据库租户删除数据
+
+
+ 数据集合
+ 加密租户
+
+
+
+ 根据数据库租户新增数据
+
+
+ 数据集合
+ 加密租户
+
+
+
+ 根据数据库租户新增数据
+
+
+
+
+
+
+
+
+ 添加实体
+
+
+
+
+
+
+ 添加实体
+
+
+
+
+
+
+ 删除实体
+
+
+
+
+
+
+ 删除实体
+
+
+
+
+
+
+ 删除实体
+
+
+
+
+
+
+ 删除实体
+
+
+
+
+
+
+
+ 逻辑批量删除
+
+
+
+
+
+
+
+ 删除实体
+
+
+
+
+
+
+
+ 删除实体
+
+
+
+
+
+
+ 删除实体
+
+
+
+
+
+
+ 删除实体
+
+
+
+
+
+
+
+ 批量删除实体
+
+ id集合
+
+
+
+
+ 更新实体
+
+
+
+
+
+
+ 批量添加实体
+
+ 实体集合
+
+
+
+
+ 批量更新实体
+
+ 实体集
+
+
+
+
+ 批量保存实体
+
+ 批量保存
+
+
+
+
+ 添加实体
+
+
+
+
+
+
+ 添加实体
+
+
+
+
+
+
+ 删除实体
+
+
+
+
+
+
+ 删除实体
+
+
+
+
+
+
+ 删除实体
+
+
+
+
+
+
+ 删除实体
+
+
+
+
+
+
+
+ 逻辑批量删除
+
+
+
+
+
+
+
+ 删除实体
+
+
+
+
+
+
+
+ 删除实体
+
+
+
+
+
+
+ 删除实体
+
+
+
+
+
+
+ 删除实体
+
+
+
+
+
+
+
+ 批量删除实体
+
+ id集合
+
+
+
+
+ 更新实体
+
+
+
+
+
+
+ 批量添加实体
+
+ 实体集合
+
+
+
+
+ 批量更新实体
+
+ 实体集
+
+
+
+
+ 批量保存实体
+
+ 批量保存
+
+
+
+
+ 删除实体
+
+
+
+
+
+
+ 对数据库执行给定的 DDL/DML 命令。
+
+ /// 用于创建服务的实例类型
+ 命令字符串
+ 参数
+ 受影响的行数
+
+
+
+ 对数据库执行给定的 DDL/DML 命令。
+
+ 用于创建服务的实例类型
+ 事务行为
+ 命令字符串
+ 参数
+ 受影响的行数
+
+
+
+ 对数据库执行给定的 DDL/DML 命令返回reader。
+
+ 用于创建服务的实例类型
+ 命令字符串
+ reader委托
+
+
+
+ 对数据库执行给定的 DDL/DML 命令返回reader。
+
+ 用于创建服务的实例类型
+ 命令字符串
+ 参数
+ reader委托
+
+
+
+ 对数据库执行给定的 DDL/DML 命令返回reader。
+
+ 用于创建服务的实例类型
+ 命令类型
+ 命令字符串
+ 参数
+ reader委托
+
+
+
+ 创建一个原始 SQL 查询,该查询将返回给定类型的元素。
+
+ 用于创建服务的实例类型
+ 查询所返回对象的类型
+ SQL 查询字符串
+ 要应用于 SQL 查询字符串的参数
+
+
+
+
+ 对数据库执行给定的 DDL/DML 命令。
+
+ 命令类型
+ 命令字符串
+ 参数
+
+
+
+
+ 根据数据库连接对数据库执行给定的 DDL/DML 命令。
+
+ 数据库类型
+ 连接字符串
+ sql 类型
+ sql
+ 参数
+
+
+
+ 根据数据库连接对数据库执行给定的 DDL/DML 命令获取Reader。
+
+ 数据库类型
+ 连接字符串
+ sql 类型
+ sql
+ 参数
+ 执行委托
+
+
+
+ 根据数据库连接对数据库执行给定的 DDL/DML 命令获取Reader。
+
+ 数据库类型
+ 连接字符串
+ sql 类型
+ sql
+ 参数
+ 分页索引 从1开始
+ 每页条数 必填
+ 执行委托
+
+
+
+ 根据数据库连接对数据库执行给定的 DDL/DML 命令获取数据总条数。
+
+ 数据库类型
+ 连接字符串
+ sql 类型
+ sql
+ 参数
+ 数据总条数
+
+
+
+ 获取数据库连接对象
+
+ 数据库类型
+ 连接字符串
+
+
+
+ 获取数据库连接对象
+
+ 数据库类型
+ 连接字符串
+
+
+
+ 执行查询,并返回查询所返回的结果集中第一行的第一列。 所有其他的列和行将被忽略。
+
+ 数据库类型
+ 连接字符串
+ sql 类型
+ sql
+ 参数
+
+
+
+ 执行查询,并返回查询所返回的结果集中第一行的第一列。 所有其他的列和行将被忽略。
+
+ 数据库类型
+ 连接字符串
+ sql 类型
+ sql
+ 参数
+
+
+
+ 执行查询,并返回查询所返回的结果集中第一行的第一列。 所有其他的列和行将被忽略。
+
+ 数据库类型
+ 数据库连接对象
+ sql 类型
+ sql
+ 是否自动关闭连接
+ 参数
+
+
+
+ 执行查询,并返回查询所返回的结果集中第一行的第一列。 所有其他的列和行将被忽略。
+
+ 数据库类型
+ 数据库连接对象
+ sql 类型
+ sql
+ 是否自动关闭连接
+ 参数
+
+
+
+ 根据数据库连接对数据库执行给定的 DDL/DML 命令获取Reader。
+
+ 数据库类型
+ 连接对象
+ sql 类型
+ sql
+ 参数
+ 分页索引 从1开始
+ 每页条数 必填
+ 执行委托
+ 是否自动关闭连接
+
+
+
+ 根据数据库连接对数据库执行给定的 DDL/DML 命令获取Reader。
+
+ 数据库类型
+ 连接对象
+ sql 类型
+ sql
+ 参数
+ 分页索引 从1开始
+ 每页条数 必填
+ 执行委托
+ 是否自动关闭连接
+
+
+
+ 根据数据库连接对数据库执行给定的 DDL/DML 命令获取Reader。
+
+ 数据库类型
+ 连接对象
+ 指令类型
+ SQL语句
+ 参数
+ 委托
+ 是否自动关闭连接
+
+
+
+ 根据数据库连接对数据库执行给定的 DDL/DML 命令获取Reader。
+
+ 数据库类型
+ 连接对象
+ 指令类型
+ SQL语句
+ 参数
+ 委托
+ 是否自动关闭连接
+
+
+
+ 根据数据库连接对数据库执行给定的 DDL/DML 命令获取Reader。
+
+ 数据库类型
+ 连接对象
+ 指令类型
+ SQL语句
+ 参数
+ 委托
+ 是否自动关闭连接
+
+
+
+ 依赖注入接口,只有实现该接口才可以被注册到IoC容器中
+
+
+
+
+ 服务对象定位器
+
+
+
+
+ 服务对象定位器实例
+
+
+
+
+ 获取泛型服务对象
+
+ 服务对象的类型
+
+
+
+
+
+ 添加根节点过滤
+
+
+
+
+
+
+
+ webSocket 服务帮助类
+
+
+
+
+ 初始化WebSocket服务
+
+
+
+
+
+
+
+
+ 发生消息到所有用户
+
+
+
+
+
+ 发生消息到所有用户
+
+
+ 检查客户端有效性
+
+
+
+ 发送信息到所有用户
+
+
+
+
+
+ 发送信息到所有用户
+
+
+ 检查客户端有效性
+
+
+
+ 发送消息到指定用户
+
+
+
+
+
+
+ 发送消息到指定用户
+
+
+
+
+
+ TradeManageMessage 和 TradeManageMessage:MQ队列
+
+
+
+
+
+ TradeManageMessage 和 TradeManageMessage:MQ队列
+
+
+
+
+
+ 设置hash值
+
+
+
+
+
+
+
+
+ 根据表名,键名,获取hash值
+
+ 表名
+ 键名
+
+
+
+
+ 获取指定key中所有字段
+
+
+
+
+
+
+ 根据表名,键名,删除hash值
+
+ 表名
+ 键名
+
+
+
+
+
+ 保存一个对象
+
+
+
+
+
+
+
+
+
+ 获取单个key的值
+
+ Redis Key
+
+
+
+
+ 删除单个key
+
+ redis key
+ 是否删除成功
+
+
+
+ 判断key是否存储
+
+ redis key
+
+
+
+
+ 获取list的redis
+
+
+
+
+
+
+ 删除list中的某张表数据
+
+
+
+
+
+
+
+ 是否存在
+
+
+
+
+
+
+
+ 获取list中表的rediskey
+
+
+
+
+
+
+
+ 单例获取
+
+
+
+
+ 缓存获取
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 配置更改时
+
+
+
+
+
+
+ 发生错误时
+
+
+
+
+
+
+ 重新建立连接之前的错误
+
+
+
+
+
+
+ 连接失败 , 如果重新连接成功你将不会收到这个通知
+
+
+
+
+
+
+ 更改集群
+
+
+
+
+
+
+ redis类库错误
+
+
+
+
+
+
+ 缓存管理
+ 1.要可以查看所有的缓存
+ 2.要可以管理缓存中的数据,如清空,删除等
+ 3.可以预先加载
+
+
+
+
+ 判断某个数据是否已经被缓存
+
+
+
+
+
+
+
+ 移除hash中的某值
+
+
+
+
+
+
+
+ 从hash表获取数据
+
+
+
+
+
+
+
+
+ 获取所有KEY
+
+
+
+
+
+ 获取list的redis
+
+
+
+
+
+
+ 删除list中的某张表数据
+
+
+
+
+
+
+
+ 是否存在
+
+
+
+
+
+
+
+ 获取list中表的rediskey
+
+
+
+
+
+
+
+ Redis服务器
+
+
+
+
+ Redis密码
+
+
+
+
+ 系统自定义Key前缀
+
+
+
+
+ 逻辑删除
+
+
+
+
+
+
+ 逻辑删除
+
+
+
+
+
+
+ 逻辑删除
+
+
+
+
+
+
+ 逻辑批量删除
+
+
+
+
+
+
+
+ 逻辑删除
+
+
+
+
+
+
+ 更新
+
+ 实体
+ 是否成功
+
+
+
+ 批量更新
+
+ 实体集合
+ 是否成功
+
+
+
+ 批量更新(新增和保存一起)速度慢
+
+ 实体集合
+ 是否成功
+
+
+
+ 添加实体
+
+
+
+
+
+
+ 删除实体
+
+
+
+
+
+
+ 删除实体
+
+
+
+
+
+
+ 删除实体
+
+
+
+
+
+
+ 删除实体
+
+
+
+
+
+
+
+ 逻辑批量删除
+
+
+
+
+
+
+
+ 更新实体
+
+
+
+
+
+
+ 批量添加实体
+
+ 实体集合
+
+
+
+
+ 批量更新实体
+
+ 实体集
+
+
+
+
+ 批量保存实体
+
+ 批量保存
+
+
+
+
+ 查询实体
+
+
+
+
+
+
+
+
+ 查询实体
+
+
+
+
+
+
+
+
+ 查询实体
+
+
+
+
+
+
+
+
+ 获取所有数据
+
+
+
+
+
+
+
+
+
+ 获取所有数据
+
+ 类型
+ 排序
+ lambd表达式
+ 过滤器
+ 需要关联查询的数据
+
+
+
+
+ 获取所有数据
+
+ 类型
+ lambd表达式
+ 过滤器
+ 需要关联查询的数据
+
+
+
+
+ 排序获取数据
+
+
+
+
+
+
+
+
+
+
+
+ 排序获取数据
+
+
+
+
+
+
+
+
+
+
+
+ 提交事务
+
+ 提交方法
+
+
+
+ 逻辑删除
+
+
+
+
+
+
+ 逻辑删除
+
+
+
+
+
+
+ 逻辑删除
+
+
+
+
+
+
+ 逻辑批量删除
+
+
+
+
+
+
+
+ 逻辑删除
+
+
+
+
+
+
+ 更新
+
+ 实体
+ 是否成功
+
+
+
+ 批量更新
+
+ 实体集合
+ 是否成功
+
+
+
+ 批量更新
+
+ 实体集合
+ 是否成功
+
+
+
+ 更新
+
+ 实体
+ 是否成功
+
+
+
+ 批量更新(新增和保存一起)速度慢
+
+ 实体集合
+ 是否成功
+
+
+
+ 统一提交
+
+ 数据库方法
+
+
+
+ 批量添加实体
+
+ 实体集合
+
+
+
+
+ 添加实体
+
+
+
+
+
+
+ 删除实体
+
+
+
+
+
+
+ 删除实体
+
+
+
+
+
+
+ 删除实体
+
+
+
+
+
+
+ 删除实体
+
+
+
+
+
+
+
+ 逻辑批量删除
+
+
+
+
+
+
+
+ 更新实体
+
+
+
+
+
+
+ 批量更新实体
+
+ 实体集
+
+
+
+
+ 批量保存实体
+
+ 批量保存
+
+
+
+
+ 根据数据库连接新增数据
+
+
+ 实体数据
+ 加密连接
+
+
+
+ 根据数据库连接更新数据
+
+
+ 实体数据集合
+ 加密连接
+
+
+
+ 根据数据库连接更新数据
+
+
+ 实体数据
+ 加密连接
+ 更新字段
+
+
+
+ 根据数据库连接删除数据
+
+
+ 表达式
+ 加密连接
+
+
+
+ 根据数据库连接删除数据
+
+
+ 数据实体
+ 加密连接
+
+
+
+ 根据数据库连接删除数据
+
+
+ 主键
+ 加密连接
+
+
+
+ 根据数据库连接删除数据
+
+
+ 数据集合
+ 加密连接
+
+
+
+ 根据数据库连接新增数据
+
+
+ 数据集合
+ 加密连接
+
+
+
+ 根据数据库连接新增数据
+
+
+
+
+
+
+
+
+ 根据数据库连接新增数据
+
+
+ 实体数据
+ 加密连接
+
+
+
+ 根据数据库连接更新数据
+
+
+ 实体数据集合
+ 加密连接
+
+
+
+ 根据数据库连接更新数据
+
+
+ 实体数据
+ 加密连接
+ 更新字段
+
+
+
+ 根据数据库连接删除数据
+
+
+ 表达式
+ 加密连接
+
+
+
+ 根据数据库连接删除数据
+
+
+ 数据实体
+ 加密连接
+
+
+
+ 根据数据库连接删除数据
+
+
+ 主键
+ 加密连接
+
+
+
+ 根据数据库连接删除数据
+
+
+ 数据集合
+ 加密连接
+
+
+
+ 根据数据库连接新增数据
+
+
+ 数据集合
+ 加密连接
+
+
+
+ 根据数据库连接新增数据
+
+
+
+
+
+
+
+
+ 领域服务基类
+
+ 领域实体仓储对象
+ 领域实体
+ 领域实体主键类型
+
+
+
+ 对数据库执行给定的 DDL/DML 命令。
+
+ 命令字符串
+ 参数
+ 受影响的行数
+
+
+
+ 对数据库执行给定的 DDL/DML 命令。
+
+ 事务行为
+ 命令字符串
+ 参数
+ 受影响的行数
+
+
+
+ 对数据库执行给定的 DDL/DML 命令返回reader。
+
+ 命令字符串
+ reader委托
+
+
+
+ 对数据库执行给定的 DDL/DML 命令返回reader。
+
+ 命令字符串
+ 参数
+ reader委托
+
+
+
+ 对数据库执行给定的 DDL/DML 命令返回reader。
+
+ 命令类型
+ 命令字符串
+ 参数
+ reader委托
+
+
+
+ 创建一个原始 SQL 查询,该查询将返回给定类型的元素。
+
+ 查询所返回对象的类型
+ SQL 查询字符串
+ 要应用于 SQL 查询字符串的参数
+
+
+
+
+ 获取数据库连接对象
+
+ 数据库类型
+ 连接字符串
+
+
+
+ 对数据库执行给定的 DDL/DML 命令。
+
+ 命令类型
+ 命令字符串
+ 参数
+
+
+
+
+ 根据数据库连接对数据库执行给定的 DDL/DML 命令。
+
+ 数据库类型
+ 连接字符串
+ sql 类型
+ sql
+ 参数
+
+
+
+ 根据数据库连接对数据库执行给定的 DDL/DML 命令获取Reader。
+
+ 数据库类型
+ 连接字符串
+ sql 类型
+ sql
+ 参数
+ 执行委托
+
+
+
+ 执行查询,并返回查询所返回的结果集中第一行的第一列。 所有其他的列和行将被忽略。
+
+ 数据库类型
+ 连接字符串
+ sql 类型
+ sql
+ 参数
+
+
+
+ 执行查询,并返回查询所返回的结果集中第一行的第一列。 所有其他的列和行将被忽略。
+
+ 数据库类型
+ 数据库连接对象
+ sql 类型
+ sql
+ 是否自动关闭连接
+ 参数
+
+
+
+ 根据数据库连接对数据库执行给定的 DDL/DML 命令获取Reader。
+
+ 数据库类型
+ 连接对象
+ 指令类型
+ SQL语句
+ 参数
+ 委托
+ 是否自动关闭连接
+
+
+
+ 根据数据库连接对数据库执行给定的 DDL/DML 命令获取Reader。
+
+ 数据库类型
+ 连接字符串
+ sql 类型
+ sql
+ 参数
+ 分页索引 从1开始
+ 每页条数 必填
+ 执行委托
+
+
+
+ 根据数据库连接对数据库执行给定的 DDL/DML 命令获取Reader。
+
+ 数据库类型
+ 连接对象
+ sql 类型
+ sql
+ 参数
+ 分页索引 从1开始
+ 每页条数 必填
+ 执行委托
+ 是否自动关闭连接
+
+
+
+ 根据数据库连接对数据库执行给定的 DDL/DML 命令获取数据总条数。
+
+ 数据库类型
+ 连接字符串
+ sql 类型
+ sql
+ 参数
+ 数据总条数
+
+
+
+ 通用接口,可以调用基类方法
+
+
+
+
+
+ 查询实体
+
+
+
+
+
+
+
+
+ 查询实体
+
+
+
+
+
+
+
+
+ 查询实体
+
+
+
+
+
+
+
+
+ 查询实体
+
+
+
+
+
+
+
+
+ 查询实体
+
+
+
+
+
+
+
+
+ 获取所有数据
+
+
+
+
+
+
+
+
+
+ 获取所有数据
+
+ 类型
+ 排序
+ lambd表达式
+ 过滤器
+ 需要关联查询的数据
+
+
+ 获取所有数据
+
+ 类型
+ 排序
+ lambd表达式
+ 过滤器
+ 需要关联查询的数据
+
+
+
+
+ 获取所有数据
+
+ 类型
+ lambd表达式
+ 过滤器
+ 需要关联查询的数据
+
+
+
+
+ 排序获取数据
+
+
+
+
+
+
+
+
+
+
+
+ 排序获取数据
+
+
+
+
+
+
+
+
+
+
+
+ 添加实体
+
+
+
+
+
+
+ 删除实体
+
+
+
+
+
+
+ 删除实体
+
+
+
+
+
+
+ 删除实体
+
+
+
+
+
+
+ 删除实体
+
+
+
+
+
+
+
+ 逻辑批量删除
+
+
+
+
+
+
+
+
+ 按字段更新数据
+
+
+
+
+
+
+
+
+ 根据字段批量更新实体
+
+
+
+
+
+
+
+
+ 批量添加实体
+
+ 实体集合
+
+
+
+
+ 批量更新实体
+
+ 实体集
+
+
+
+
+ 批量保存实体
+
+ 批量保存
+
+
+
+
+ 添加实体
+
+
+
+
+
+
+ 删除实体
+
+
+
+
+
+
+ 删除实体
+
+
+
+
+
+
+ 删除实体
+
+
+
+
+
+
+ 删除实体
+
+
+
+
+
+
+
+ 逻辑批量删除
+
+
+
+
+
+
+
+ 更新实体
+
+
+
+
+
+
+ 批量添加实体
+
+ 实体集合
+
+
+
+
+ 批量更新实体
+
+ 实体集
+
+
+
+
+ 批量保存实体
+
+ 批量保存
+
+
+
+
+ 批量添加实体
+
+ 实体集合
+
+
+
+
+ 添加实体
+
+
+
+
+
+
+ 删除实体
+
+
+
+
+
+
+ 删除实体
+
+
+
+
+
+
+ 删除实体
+
+
+
+
+
+
+ 删除实体
+
+
+
+
+
+
+
+ 逻辑批量删除
+
+
+
+
+
+
+
+ 更新实体
+
+
+
+
+
+
+ 批量更新实体
+
+ 实体集
+
+
+
+
+ 批量保存实体
+
+ 批量保存
+
+
+
+
+ 逻辑删除
+
+
+
+
+
+
+ 逻辑删除
+
+
+
+
+
+
+ 逻辑删除
+
+
+
+
+
+
+ 逻辑批量删除
+
+
+
+
+
+
+
+ 逻辑删除
+
+
+
+
+
+
+ 更新
+
+ 实体
+ 是否成功
+
+
+
+ 批量更新
+
+ 实体集合
+ 是否成功
+
+
+
+ 更新
+
+ 实体
+ 是否成功
+
+
+
+ 批量更新
+
+ 实体集合
+ 是否成功
+
+
+
+ 批量更新(新增和保存一起)速度慢
+
+ 实体集合
+ 是否成功
+
+
+
+ 统一提交
+
+ 数据库方法
+
+
+
+ 领域服务接口
+
+
+
+
+
+
+
+ 对数据库执行给定的 DDL/DML 命令。
+
+ 命令字符串
+ 参数
+ 受影响的行数
+
+
+
+ 对数据库执行给定的 DDL/DML 命令。
+
+ 事务行为
+ 命令字符串
+ 参数
+ 受影响的行数
+
+
+
+ 对数据库执行给定的 DDL/DML 命令返回reader。
+
+ 命令字符串
+ reader委托
+
+
+
+ 对数据库执行给定的 DDL/DML 命令返回reader。
+
+ 命令字符串
+ 参数
+ reader委托
+
+
+
+ 对数据库执行给定的 DDL/DML 命令返回reader。
+
+ 命令类型
+ 命令字符串
+ 参数
+ reader委托
+
+
+
+ 创建一个原始 SQL 查询,该查询将返回给定类型的元素。
+
+ 查询所返回对象的类型
+ SQL 查询字符串
+ 要应用于 SQL 查询字符串的参数
+
+
+
+
+ 对数据库执行给定的 DDL/DML 命令。
+
+ 命令类型
+ 命令字符串
+ 参数
+
+
+
+
+ 获取数据库连接对象
+
+ 数据库类型
+ 连接字符串
+
+
+
+ 执行查询,并返回查询所返回的结果集中第一行的第一列。 所有其他的列和行将被忽略。
+
+ 数据库类型
+ 连接字符串
+ sql 类型
+ sql
+ 参数
+
+
+
+ 执行查询,并返回查询所返回的结果集中第一行的第一列。 所有其他的列和行将被忽略。
+
+ 数据库类型
+ 数据库连接对象
+ sql 类型
+ sql
+ 参数
+ 是否关闭连接
+
+
+
+ 根据数据库连接对数据库执行给定的 DDL/DML 命令获取Reader。
+
+ 数据库类型
+ 连接对象
+ sql 类型
+ sql
+ 参数
+ 分页索引 从1开始
+ 每页条数 必填
+ 执行委托
+ 是否关闭连接
+
+
+
+ 根据数据库连接对数据库执行给定的 DDL/DML 命令获取Reader。
+
+ 数据库类型
+ 连接对象
+ 指令类型
+ SQL语句
+ 参数
+ 是否关闭连接
+ 委托
+
+
+
+ 根据数据库连接对数据库执行给定的 DDL/DML 命令。
+
+ 数据库类型
+ 连接字符串
+ sql 类型
+ sql
+ 参数
+
+
+
+ 根据数据库连接对数据库执行给定的 DDL/DML 命令。
+
+ 数据库类型
+ 连接字符串
+ sql 类型
+ sql
+ 参数
+
+
+
+ 根据数据库连接对数据库执行给定的 DDL/DML 命令获取Reader。
+
+ 数据库类型
+ 连接字符串
+ sql 类型
+ sql
+ 参数
+ 执行委托
+
+
+
+ 根据数据库连接对数据库执行给定的 DDL/DML 命令获取Reader。
+
+ 数据库类型
+ 连接字符串
+ sql 类型
+ sql
+ 参数
+ 分页索引 从1开始
+ 每页条数 必填
+ 执行委托
+
+
+
+ 根据数据库连接对数据库执行给定的 DDL/DML 命令获取数据总条数。
+
+ 数据库类型
+ 连接字符串
+ sql 类型
+ sql
+ 参数
+ 数据总条数
+
+
+
+ 当前会话
+
+
+
+
+ 日志记录器
+
+
+
+
+ 是否使用Redis
+
+
+
+
+ 微信Token
+
+
+
+
+ 部门ID
+
+
+
+
+ 自定义变量1
+
+
+
+
+ 自定义变量2
+
+
+
+
+ 自定义变量3
+
+
+
+
+ 自定义变量4
+
+
+
+
+ 自定义变量5
+
+
+
+
+ 权限缓存
+
+
+
+
+ 地址
+
+
+
+
+ 用户
+
+
+
+
+ 密码
+
+
+
+
+ 源标签历史数据
+
+
+
+
+ 纠错数据表
+
+
+
+
+ Log
+
+
+
+
+
+
+
+
+
+ 用量
+
+
+
+
+ 价格
+
+
+
+
+ 价格
+
+
+
+
diff --git a/APT.Infrastructure.Api/Api/APTApiController.cs b/APT.Infrastructure.Api/Api/APTApiController.cs
new file mode 100644
index 0000000..db6bdb6
--- /dev/null
+++ b/APT.Infrastructure.Api/Api/APTApiController.cs
@@ -0,0 +1,1009 @@
+using Microsoft.EntityFrameworkCore;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Linq.Expressions;
+using System.Threading.Tasks;
+using APT.Infrastructure.Core;
+namespace APT.Infrastructure.Api
+{
+
+ ///
+ /// 基类接口
+ ///
+ ///
+ public abstract class APTApiControllerBase : CommonApiController where T : MesEntityBase, new()
+ {
+ private IUnitOfWork _UnitOfWork;
+ ///
+ /// 单元操作
+ ///
+ protected IUnitOfWork UnitOfWork
+ {
+ get
+ {
+ if (_UnitOfWork == null)
+ {
+ _UnitOfWork = GetUnitOfWork();
+ }
+ return _UnitOfWork;
+ }
+ }
+
+ ///
+ /// 通过获取一条记录
+ ///
+ /// ID
+ ///
+ protected JsonActionResult WitEntity(string id, params string[] param)
+ {
+
+ return SafeExecute(() =>
+ {
+ return base.GetEntity(id, param);
+ });
+ }
+ ///
+ /// 通过获取一条记录
+ ///
+ /// ID
+ ///
+ protected JsonActionResult WitEntity(Expression> expression, params string[] param)
+ {
+
+ return SafeExecute(() =>
+ {
+ return base.GetEntity(expression, param);
+ });
+ }
+ ///
+ /// 通过获取一条记录
+ ///
+ /// ID
+ ///
+ protected JsonActionResult WitEntity(Expression> expression, BaseFilter filter, params string[] param)
+ {
+
+ return SafeExecute(() =>
+ {
+ return base.GetEntity(expression, filter, param);
+ });
+ }
+ ///
+ /// 排序后的所有记录
+ ///
+ /// 排序方式
+ /// 条件
+ /// 分页参数
+ /// 导航属性
+ ///
+ protected JsonActionResult> WitActionOrderEntities(Action> orderBy, Expression> expression, BaseFilter fiter, params string[] param)
+ {
+ return SafeExecute>(() =>
+ {
+ return base.ActionOrderEntities(orderBy, expression, fiter, param);
+ });
+ }
+ ///
+ /// 获取所有记录
+ ///
+ ///
+ ///
+ ///
+ ///
+ protected JsonActionResult> WitEntities(Expression> expression, BaseFilter fiter, params string[] param)
+ {
+ return SafeExecute>(() =>
+ {
+ return base.GetEntities(expression, fiter, param);
+ });
+ }
+ ///
+ /// 分页查询
+ ///
+ /// 过滤条件
+ /// 过滤实体fiter
+ /// 导航属性
+ ///
+ protected PagedActionResult WitPaged(Expression> expression, BasePageFilter fiter, params string[] param)
+ {
+ return SafeGetPagedData((result) =>
+ {
+ var page = base.GetPageEntities(expression, fiter, param);
+ result.Data = page.Data;
+ result.TotalCount = page.TotalCount;
+ });
+ }
+ ///
+ /// 排序后分页查询
+ ///
+ /// 排序条件
+ /// 过滤条件
+ /// 过滤实体fiter
+ /// 导航属性
+ ///
+ protected async Task> WitActionOrderPagedSync(Action> orderBy, Expression> expression, BasePageFilter fiter, params string[] param)
+ {
+ return SafeGetPagedData(async (result) =>
+ {
+ var page = await base.ActionOrderPageEntitiesSync(orderBy, expression, fiter, param);
+ result.Data = page.Data;
+ result.TotalCount = page.TotalCount;
+ });
+ }
+ ///
+ /// 排序后分页查询
+ ///
+ /// 排序条件
+ /// 过滤条件
+ /// 过滤实体fiter
+ /// 导航属性
+ ///
+ protected async Task> WitOrderPagedSync(Expression> expression, BasePageFilter fiter, params string[] param)
+ {
+ return SafeGetPagedData(async (result) =>
+ {
+ var page = await base.GetOrderPageEntitiesSync(expression, fiter, param);
+ result.Data = page.Data;
+ result.TotalCount = page.TotalCount;
+ });
+ }
+ ///
+ /// 排序后分页查询
+ ///
+ /// 排序条件
+ /// 过滤条件
+ /// 过滤实体fiter
+ /// 导航属性
+ ///
+ protected PagedActionResult WitActionOrderPaged(Action> orderBy, Expression> expression, BasePageFilter fiter, params string[] param)
+ {
+ return SafeGetPagedData((result) =>
+ {
+ var page = base.ActionOrderPageEntities(orderBy, expression, fiter, param);
+ result.Data = page.Data;
+ result.TotalCount = page.TotalCount;
+ });
+ }
+
+ protected PagedActionResult WitActionOrderPaged(Expression> expression, BasePageFilter pageFilter, string[] selectField,
+ params string[] paths) where T : MesEntityBase, new()
+ {
+ return SafeGetPagedData((result) =>
+ {
+ var page = base.GetOrderPageEntities(expression, pageFilter, selectField,paths);
+ result.Data = page.Data;
+ result.TotalCount = page.TotalCount;
+ });
+ }
+ ///
+ /// 排序后分页查询
+ ///
+ /// 排序条件
+ /// 过滤条件
+ /// 过滤实体fiter
+ /// 导航属性
+ ///
+ protected PagedActionResult WitOrderPaged(Expression> expression, BasePageFilter fiter, params string[] param)
+ {
+ return SafeGetPagedData((result) =>
+ {
+ var page = base.GetOrderPageEntities(expression, fiter, param);
+ result.Data = page.Data;
+ result.TotalCount = page.TotalCount;
+ });
+ }
+
+ protected JsonActionResult> WitOrderEntities(Expression> expression, string sort, string order, BaseFilter fiter, params string[] param)
+ {
+ return SafeExecute>(() =>
+ {
+ return base.GetOrderEntities(expression, fiter, sort, order, param);
+ });
+ }
+ protected JsonActionResult> WitOrderEntities(Expression> expression, BaseFilter fiter, params string[] param)
+ {
+ return SafeExecute>(() =>
+ {
+ return base.GetOrderEntities(expression, fiter, param);
+ });
+ }
+
+ ///
+ /// 提交事务
+ ///
+ /// 返回结果
+ /// 数据处理
+ /// 数据提交
+ ///
+ protected JsonActionResult WitCommitTransaction(Action execAction, Func comitAction)
+ {
+ var result = new JsonActionResult();
+ try
+ {
+ if (execAction != null)
+ {
+ execAction();
+ }
+ UnitOfWork.BeginTransaction();
+ result.Data = comitAction();
+ UnitOfWork.CommitTransaction();
+ }
+ catch (CodeException ex)
+ {
+ try
+ {
+ UnitOfWork.RollbackTransaction();
+ }
+ catch (Exception ex1)
+ {
+ LoggerManager.GetLogger().Info("rollback Error" + ex1.ToString());
+ }
+
+ result.IsSuccessful = false;
+ result.ErrorMessage = GetErrorMsg(ex);
+ result.Code = ex.Code;
+ LoggerManager.GetLogger().Error(result.ErrorMessage);
+ }
+ catch (Exception ex)
+ {
+ try
+ {
+ UnitOfWork.RollbackTransaction();
+ }
+ catch (Exception ex1)
+ {
+ LoggerManager.GetLogger().Info("rollback Error" + ex1.ToString());
+ }
+ LoggerManager.GetLogger().Error(ex.ToString());
+ result.IsSuccessful = false;
+ result.ErrorMessage = ex.Message;
+ }
+ return result;
+ }
+ ///
+ /// 提交事务
+ ///
+ /// 执行方法
+ /// 提交方法
+ protected void WitCommitTransaction(Action execAction, Action comitAction)
+ {
+ try
+ {
+ if (execAction != null)
+ {
+ execAction();
+ }
+ UnitOfWork.BeginTransaction();
+ comitAction();
+ UnitOfWork.CommitTransaction();
+ }
+ catch (CodeException ex)
+ {
+ try
+ {
+ UnitOfWork.RollbackTransaction();
+ }
+ catch (Exception ex1)
+ {
+ LoggerManager.GetLogger().Info("rollback Error" + ex1.ToString());
+ }
+ var exs = GetErrorMsg(ex);
+ LoggerManager.GetLogger().Info("rollback Error" + exs.ToString());
+ }
+ catch (Exception ex)
+ {
+ try
+ {
+ UnitOfWork.RollbackTransaction();
+ }
+ catch (Exception ex1)
+ {
+ LoggerManager.GetLogger().Info("rollback Error" + ex1.ToString());
+ }
+ throw;
+ }
+ }
+ ///
+ /// 提交事务
+ ///
+ /// 提交方法
+ protected void WitCommitTransaction(Action comitAction)
+ {
+ try
+ {
+
+ UnitOfWork.BeginTransaction();
+ comitAction();
+ UnitOfWork.CommitTransaction();
+ }
+ catch (CodeException ex)
+ {
+ try
+ {
+ UnitOfWork.RollbackTransaction();
+ }
+ catch (Exception ex1)
+ {
+ LoggerManager.GetLogger().Info("rollback Error" + ex1.ToString());
+ }
+ var exs = GetErrorMsg(ex);
+ LoggerManager.GetLogger().Info("rollback Error" + exs.ToString());
+ }
+ catch
+ {
+ try
+ {
+ UnitOfWork.RollbackTransaction();
+ }
+ catch (Exception ex1)
+ {
+ LoggerManager.GetLogger().Info("rollback Error" + ex1.ToString());
+ }
+ throw;
+ }
+ }
+ ///
+ ///
+ ///
+ /// 返回类型
+ /// 执行
+ /// 返回
+ ///
+ protected JsonActionResult WitSafeExecute(Action execAction, Func> comitAction)
+ {
+ var result = new JsonActionResult();
+ try
+ {
+ if (execAction != null)
+ {
+ execAction();
+ }
+ result = comitAction();
+ }
+ catch (CodeException ex)
+ {
+ result.IsSuccessful = false;
+ result.ErrorMessage = GetErrorMsg(ex);
+ result.Code = ex.Code;
+ LoggerManager.GetLogger().Error(result.ErrorMessage);
+ }
+ catch (Exception ex)
+ {
+ LoggerManager.GetLogger().Error(ex.ToString());
+ result.IsSuccessful = false;
+ result.ErrorMessage = ex.Message;
+ }
+ return result;
+ }
+
+ protected JsonActionResult WitSafeExecute(Action execAction, Func comitAction)
+ {
+ var result = new JsonActionResult();
+ try
+ {
+ if (execAction != null)
+ {
+ execAction();
+ }
+ result.Data = comitAction();
+ }
+ catch (CodeException ex)
+ {
+ result.IsSuccessful = false;
+ result.ErrorMessage = GetErrorMsg(ex);
+ result.Code = ex.Code;
+ LoggerManager.GetLogger().Error(result.ErrorMessage);
+ }
+ catch (Exception ex)
+ {
+ LoggerManager.GetLogger().Error(ex.ToString());
+ result.IsSuccessful = false;
+ result.ErrorMessage = ex.Message;
+ }
+ return result;
+ }
+
+ ///
+ /// 统一提交
+ ///
+ ///
+ ///
+ ///
+ ///
+ protected JsonActionResult UnifiedCommit(Action execAction, Func comitAction)
+ {
+ var result = new JsonActionResult();
+ try
+ {
+ if (execAction != null)
+ {
+ execAction();
+ UnitOfWork.SaveChanges();
+ }
+ result.Data = comitAction();
+ }
+ catch (CodeException ex)
+ {
+ result.IsSuccessful = false;
+ result.ErrorMessage = GetErrorMsg(ex);
+ result.Code = ex.Code;
+ LoggerManager.GetLogger().Error(result.ErrorMessage);
+ }
+ catch (Exception ex)
+ {
+ LoggerManager.GetLogger().Error(ex.ToString());
+ result.IsSuccessful = false;
+ result.ErrorMessage = ex.Message;
+ }
+ return result;
+ }
+
+ ///
+ /// 统一提交
+ ///
+ /// 提交方法
+ protected void UnifiedCommit(Action comitAction)
+ {
+ try
+ {
+
+ comitAction();
+ UnitOfWork.SaveChanges();
+ }
+ catch (CodeException ex)
+ {
+ var exs = GetErrorMsg(ex);
+ LoggerManager.GetLogger().Info("rollback Error" + exs.ToString());
+ throw;
+ }
+ catch (Exception ex1)
+ {
+ LoggerManager.GetLogger().Info("rollback Error" + ex1.ToString());
+ throw;
+ }
+ }
+
+ }
+
+
+ ///
+ /// 基类接口
+ ///
+ /// 数据库类型
+ public abstract class APTApiController : APTApiControllerBase where T : MesEntityBase, new()
+ {
+
+ ///
+ /// 添加一条记录
+ ///
+ ///
+ ///
+ protected JsonActionResult WitAdd(T entity)
+ {
+ return SafeExecute(() =>
+ {
+ return base.AddEntity(entity);
+ });
+ }
+ ///
+ /// 更新一条记录
+ ///
+ ///
+ ///
+ protected JsonActionResult WitUpdate(T entity)
+ {
+ return SafeExecute(() =>
+ {
+ return base.UpdateEntity(entity);
+ });
+ }
+
+ ///
+ /// 按字段更新数据
+ ///
+ ///
+ ///
+ protected JsonActionResult WitUpdate(T entity, params string[] updateField)
+ {
+ return SafeExecute(() =>
+ {
+ return base.UpdateEntity(entity,updateField);
+ });
+ }
+
+
+ ///
+ /// 根据条件删除
+ ///
+ /// 条件
+ ///
+ protected JsonActionResult WitDelete(Expression> expression)
+ {
+ return SafeExecute(() =>
+ {
+ return base.DeleteEntity(expression);
+ });
+ }
+ ///
+ /// 删除实体
+ ///
+ /// 实体集合
+ ///
+ protected JsonActionResult WitDelete(IEnumerable entities)
+ {
+ return SafeExecute(() =>
+ {
+ return base.DeleteEntity(entities);
+ });
+ }
+ ///
+ /// 删除实体
+ ///
+ ///
+ ///
+ protected JsonActionResult WitDelete(T entity)
+ {
+ return SafeExecute(() =>
+ {
+ return base.DeleteEntity(entity);
+ });
+ }
+ ///
+ /// 根据条件删除
+ ///
+ /// 条件
+ ///
+ protected JsonActionResult WitRealDelete(Expression> expression)
+ {
+ return SafeExecute(() =>
+ {
+ return base.RealDeleteEntity(expression);
+ });
+ }
+ ///
+ /// 删除实体
+ ///
+ /// 实体集合
+ ///
+ protected JsonActionResult WitRealDelete(IEnumerable entities)
+ {
+ return SafeExecute(() =>
+ {
+ return base.RealDeleteEntity(entities);
+ });
+ }
+ ///
+ /// 删除实体
+ ///
+ ///
+ ///
+ protected JsonActionResult WitRealDelete(T entity)
+ {
+ return SafeExecute(() =>
+ {
+ return base.RealDeleteEntity(entity);
+ });
+ }
+ ///
+ /// 批量新增数据
+ ///
+ ///
+ ///
+ protected JsonActionResult WitBantchAdd(IEnumerable entities)
+ {
+ return SafeExecute(() =>
+ {
+ return base.BantchAddEntity(entities);
+ });
+ }
+ ///
+ /// 批量更新数据(效率快)
+ ///
+ ///
+ ///
+ protected JsonActionResult WitBantchUpdate(IEnumerable entities)
+ {
+ return SafeExecute(() =>
+ {
+ return base.BantchUpdateEntity(entities);
+ });
+ }
+
+ ///
+ /// 获取条数
+ ///
+ ///
+ ///
+ ///
+ protected JsonActionResult WitCount(Expression> expression, BaseFilter filter)
+ {
+ return SafeExecute(() =>
+ {
+ return base.GetCount(expression, filter);
+ });
+ }
+
+ ///
+ /// 通过ID删除
+ ///
+ ///
+ ///
+ protected JsonActionResult WitDelete(string id)
+ {
+ return SafeExecute(() =>
+ {
+ return base.DeleteEntity(id);
+ });
+ }
+ ///
+ /// 通过ID删除
+ ///
+ ///
+ ///
+ protected JsonActionResult WitRealDelete(string id)
+ {
+ return SafeExecute(() =>
+ {
+ try
+ {
+ Guid temp = new Guid(id);
+ return base.RealDeleteEntity(t => t.ID == temp);
+ }
+ catch (Exception ex)
+ {
+ if (ex is DbUpdateException)
+ throw new Exception("该资料已被用,不允许执行此操作");
+ else if (ex is DomainException)
+ {
+ if (ex.Message.IndexOf("DbUpdateException", StringComparison.OrdinalIgnoreCase) > -1)
+ throw new Exception("该资料已被用,不允许执行此操作");
+ }
+ throw ex;
+ }
+ });
+ }
+ ///
+ /// 通过ID字符串删除
+ ///
+ ///
+ ///
+ protected JsonActionResult WitBatchDelete(string ids)
+ {
+ var aryList = ids.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(i => new Guid(i)).ToList();
+ //var users = UserService.Query(i => i.NO == userName && i.PASSWORD == passWord).FirstOrDefault();
+ return SafeExecute(() =>
+ {
+ try
+ {
+ return base.BantchDeleteEntity(aryList);
+ }
+ catch (Exception ex)
+ {
+ //if (ex is DbUpdateException)
+ // throw new Exception("存在资料已被用,不允许执行此操作");
+ //else if (ex is DomainException)
+ //{
+ // if (ex.Message.IndexOf("DbUpdateException", StringComparison.OrdinalIgnoreCase) > -1)
+ // throw new Exception("存在资料已被用,不允许执行此操作");
+ //}
+ throw ex;
+ }
+ });
+ }
+ ///
+ /// 通过ID数组删除
+ ///
+ ///
+ ///
+ protected JsonActionResult WitBatchDelete(string[] ids)
+ {
+ //var users = UserService.Query(i => i.NO == userName && i.PASSWORD == passWord).FirstOrDefault();
+ return SafeExecute(() =>
+ {
+ var tmp = ids == null ? null : ids.Select(i => new Guid(i)).ToList();
+ return base.BantchDeleteEntity(tmp);
+ });
+ }
+ ///
+ /// 通过ID字符串删除
+ ///
+ ///
+ ///
+ protected JsonActionResult WitRealBatchDelete(string ids)
+ {
+ var aryList = ids.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(i => new Guid(i)).ToList();
+ //var users = UserService.Query(i => i.NO == userName && i.PASSWORD == passWord).FirstOrDefault();
+ return SafeExecute(() =>
+ {
+ return base.RealBantchDeleteEntity(aryList);
+ });
+ }
+ ///
+ /// 通过ID数组删除
+ ///
+ ///
+ ///
+ protected JsonActionResult WitRealBatchDelete(string[] ids)
+ {
+ //var users = UserService.Query(i => i.NO == userName && i.PASSWORD == passWord).FirstOrDefault();
+ return SafeExecute(() =>
+ {
+ var tmp = ids == null ? null : ids.Select(i => new Guid(i)).ToList();
+ return base.RealBantchDeleteEntity(tmp);
+ });
+ }
+
+ }
+
+ ///
+ /// 树基类接口
+ ///
+ ///
+ public abstract class APTTreeApiController : APTApiControllerBase where T : TreeEntityBase, new()
+ {
+ ///
+ /// 添加一条记录
+ ///
+ ///
+ ///
+ protected JsonActionResult WitAdd(T entity)
+ {
+ return SafeExecute(() =>
+ {
+ return base.TreeAddEntity(entity);
+ });
+ }
+ ///
+ /// 更新一条记录
+ ///
+ ///
+ ///
+ protected JsonActionResult WitUpdate(T entity)
+ {
+ return SafeExecute(() =>
+ {
+ return base.TreeUpdateEntity(entity);
+ });
+ }
+
+
+
+ ///
+ /// 根据条件删除
+ ///
+ /// 条件
+ ///
+ protected JsonActionResult WitDelete(Expression> expression)
+ {
+ return SafeExecute(() =>
+ {
+ return base.TreeDeleteEntity(expression);
+ });
+ }
+ ///
+ /// 删除实体
+ ///
+ /// 实体集合
+ ///
+ protected JsonActionResult WitDelete(IEnumerable entities)
+ {
+ return SafeExecute(() =>
+ {
+ return base.TreeDeleteEntity(entities);
+ });
+ }
+ ///
+ /// 删除实体
+ ///
+ ///
+ ///
+ protected JsonActionResult WitDelete(T entity)
+ {
+ return SafeExecute(() =>
+ {
+ return base.TreeDeleteEntity(entity);
+ });
+ }
+ ///
+ /// 根据条件删除
+ ///
+ /// 条件
+ ///
+ protected JsonActionResult WitRealDelete(Expression> expression)
+ {
+ return SafeExecute(() =>
+ {
+ return base.TreeRealDeleteEntity(expression);
+ });
+ }
+ ///
+ /// 删除实体
+ ///
+ /// 实体集合
+ ///
+ protected JsonActionResult WitRealDelete(IEnumerable entities)
+ {
+ return SafeExecute(() =>
+ {
+ return base.TreeRealDeleteEntity(entities);
+ });
+ }
+ ///
+ /// 删除实体
+ ///
+ ///
+ ///
+ protected JsonActionResult WitRealDelete(T entity)
+ {
+ return SafeExecute(() =>
+ {
+ return base.TreeRealDeleteEntity(entity);
+ });
+ }
+ ///
+ /// 批量新增数据
+ ///
+ ///
+ ///
+ protected JsonActionResult WitBantchAdd(IEnumerable entities)
+ {
+ return SafeExecute(() =>
+ {
+ return base.TreeBantchAddEntity(entities);
+ });
+ }
+ ///
+ /// 批量更新数据(效率快)
+ ///
+ ///
+ ///
+ protected JsonActionResult WitBantchUpdate(IEnumerable entities)
+ {
+ return SafeExecute(() =>
+ {
+ return base.TreeBantchUpdateEntity(entities);
+ });
+ }
+
+ ///
+ /// 获取条数
+ ///
+ ///
+ ///
+ ///
+ protected JsonActionResult WitCount(Expression> expression, BaseFilter filter)
+ {
+ return SafeExecute(() =>
+ {
+ return base.GetCount(expression, filter);
+ });
+ }
+
+ ///
+ /// 通过ID删除
+ ///
+ ///
+ ///
+ protected JsonActionResult WitDelete(string id)
+ {
+ return SafeExecute(() =>
+ {
+ return base.TreeDeleteEntity(id);
+ });
+ }
+ ///
+ /// 通过ID删除
+ ///
+ ///
+ ///
+ protected JsonActionResult WitRealDelete(string id)
+ {
+ return SafeExecute(() =>
+ {
+ try
+ {
+ return base.TreeRealDeleteEntity(id);
+ }
+ catch (Exception ex)
+ {
+ if (ex is DbUpdateException)
+ throw new Exception("该资料已被用,不允许执行此操作");
+ else if (ex is DomainException)
+ {
+ if (ex.Message.IndexOf("DbUpdateException", StringComparison.OrdinalIgnoreCase) > -1)
+ throw new Exception("该资料已被用,不允许执行此操作");
+ }
+ throw ex;
+ }
+ });
+ }
+ ///
+ /// 通过ID字符串删除
+ ///
+ ///
+ ///
+ protected JsonActionResult WitBatchDelete(string ids)
+ {
+ return SafeExecute(() =>
+ {
+ try
+ {
+ var aryList = ids.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(t => new Guid(t)).ToList();
+ return base.TreeBantchDeleteEntity(aryList);
+ }
+ catch (Exception ex)
+ {
+ if (ex is DbUpdateException)
+ throw new Exception("存在资料已被用,不允许执行此操作");
+ else if (ex is DomainException)
+ {
+ if (ex.Message.IndexOf("DbUpdateException", StringComparison.OrdinalIgnoreCase) > -1)
+ throw new Exception("存在资料已被用,不允许执行此操作");
+ }
+ throw ex;
+ }
+ });
+ }
+ ///
+ /// 通过ID数组删除
+ ///
+ ///
+ ///
+ protected JsonActionResult WitBatchDelete(string[] ids)
+ {
+ //var users = UserService.Query(i => i.NO == userName && i.PASSWORD == passWord).FirstOrDefault();
+ return SafeExecute(() =>
+ {
+ var aryList = ids == null ? null : ids.Select(t => new Guid(t)).ToList();
+ return base.TreeBantchDeleteEntity(aryList);
+ });
+ }
+ ///
+ /// 通过ID字符串删除
+ ///
+ ///
+ ///
+ protected JsonActionResult WitRealBatchDelete(string ids)
+ {
+ //var users = UserService.Query(i => i.NO == userName && i.PASSWORD == passWord).FirstOrDefault();
+ return SafeExecute(() =>
+ {
+
+ var aryList = string.IsNullOrEmpty(ids) ? null : ids.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(t => new Guid(t)).ToList();
+ return base.TreeRealBantchDeleteEntity(aryList);
+ });
+ }
+ ///
+ /// 通过ID数组删除
+ ///
+ ///
+ ///
+ protected JsonActionResult WitRealBatchDelete(string[] ids)
+ {
+ //var users = UserService.Query(i => i.NO == userName && i.PASSWORD == passWord).FirstOrDefault();
+ return SafeExecute(() =>
+ {
+ var aryList = ids == null ? null : ids.Select(t => new Guid(t)).ToList();
+ return base.TreeRealBantchDeleteEntity(aryList);
+ });
+ }
+ ///
+ /// 获取树数据
+ ///
+ /// lamble表达式
+ /// 过滤实体
+ ///
+ ///
+ ///
+ protected JsonActionResult>> WitTreeOrderEntities(Expression> expression, BaseFilter filter, bool isTracking = false,
+ params string[] paths)
+ {
+ return SafeExecute(() =>
+ {
+ return base.TreeOrderEntities(expression, filter, isTracking, paths);
+ });
+ }
+
+ }
+}
diff --git a/APT.Infrastructure.Api/Api/BaseApiController.cs b/APT.Infrastructure.Api/Api/BaseApiController.cs
new file mode 100644
index 0000000..c4d6521
--- /dev/null
+++ b/APT.Infrastructure.Api/Api/BaseApiController.cs
@@ -0,0 +1,202 @@
+using APT.Infrastructure.Api.Model;
+using Microsoft.AspNetCore.Authentication;
+using Microsoft.AspNetCore.Mvc;
+using System;
+using System.Linq;
+using System.Linq.Expressions;
+using System.Security.Claims;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using APT.Infrastructure.Core;
+namespace APT.Infrastructure.Api
+{
+ //[Log]
+ public abstract class BaseApiController : ControllerBase
+ {
+ ///
+ /// 抛出错误
+ ///
+ ///
+ protected void ThrowError(string code, params object [] objs)
+ {
+ LibMessageUtils.ThrowError(code,objs);
+ }
+ ///
+ /// 为 基础操作 提供统一的返回格式,包含try / catch操作。
+ ///
+ /// 返回值类型
+ ///
+ ///
+ protected virtual JsonActionResult SafeExecute(Func execAction, int retryTime = 0)
+ {
+ var result = new JsonActionResult();
+ try
+ {
+ result.Data = execAction();
+ }
+ catch (CodeException ex)
+ {
+ LoggerManager.GetLogger().Error(ex.ToString());
+ result.IsSuccessful = false;
+ result.ErrorMessage = GetErrorMsg(ex);
+ result.Code = ex.Code;
+ }
+ catch (Exception ex)
+ {
+ if (NeedRetryExceptions.RetryExceptions().Any(o => ex.Message.Contains(o)) && retryTime <= 3 && retryTime > 0)
+ {
+ retryTime += 1;
+ Thread.Sleep(5000);
+ return this.SafeExecute(execAction, retryTime);
+ }
+ var errMsg = LogHelper.GetCurSourceFileName() + " - " + LogHelper.GetLineNum() + ":" + ex.Message;
+ LoggerManager.GetLogger().Error(errMsg);
+ result.IsSuccessful = false;
+ result.ErrorMessage = errMsg;
+
+ }
+ return result;
+ }
+
+ ///
+ /// 为 基础操作 提供统一的返回格式,包含try / catch操作。
+ ///
+ /// 返回值类型
+ ///
+ ///
+ protected virtual async Task> SafeExecuteAsync(Func> execAction, int retryTime = 0)
+ {
+ var result = new JsonActionResult();
+ try
+ {
+ result.Data = await execAction();
+ }
+ catch (CodeException ex)
+ {
+ LoggerManager.GetLogger().Error(ex.ToString());
+ result.IsSuccessful = false;
+ result.ErrorMessage = GetErrorMsg(ex);
+ result.Code = ex.Code;
+ }
+ catch (Exception ex)
+ {
+ if (NeedRetryExceptions.RetryExceptions().Any(o => ex.Message.Contains(o)) && retryTime <= 3 && retryTime >0)
+ {
+ retryTime += 1;
+ Thread.Sleep(5000);
+ return await this.SafeExecuteAsync(execAction, retryTime);
+ }
+ var errMsg = LogHelper.GetCurSourceFileName() + " - " + LogHelper.GetLineNum() + ":" + ex.Message;
+ LoggerManager.GetLogger().Error(errMsg);
+ result.IsSuccessful = false;
+ result.ErrorMessage = errMsg;
+
+ }
+ return result;
+ }
+
+
+ protected string GetErrorMsg(Exception ex)
+ {
+ string innerError = string.Empty;
+ GetInnerErrorMsg(ex.InnerException, ref innerError);
+ return ex.Message + (!string.IsNullOrEmpty(innerError) ? (",报错明细:" + innerError) : string.Empty);
+ }
+
+ private void GetInnerErrorMsg(Exception ex, ref string error)
+ {
+ if (ex == null) return;
+ error = ex.Message;
+ GetInnerErrorMsg(ex.InnerException, ref error);
+ }
+
+
+
+ ///
+ /// 为 基础操作 提供统一的返回格式,包含try / catch操作。
+ ///
+ /// 返回值类型
+ ///
+ ///
+ protected JsonActionResult SafeJsonExecute(Action> execAction)
+ {
+ var result = new JsonActionResult();
+ try
+ {
+ execAction(result);
+ }
+ catch (CodeException ex)
+ {
+ LoggerManager.GetLogger().Error(ex.ToString());
+ result.IsSuccessful = false;
+ result.ErrorMessage = GetErrorMsg(ex);
+ result.Code = ex.Code;
+ }
+ catch (Exception ex)
+ {
+ var errMsg = LogHelper.GetCurSourceFileName() + " - " + LogHelper.GetLineNum() + ":" + ex.Message;
+ LoggerManager.GetLogger().Error(errMsg);
+ result.IsSuccessful = false;
+ result.ErrorMessage = errMsg;
+
+ }
+ return result;
+ }
+
+ ///
+ /// 为取 分页数据 提供统一的返回格式,包含try / catch操作。
+ ///
+ /// 返回值类型
+ ///
+ ///
+ protected PagedActionResult SafeGetPagedData(Action> execAction)
+ {
+ var result = new PagedActionResult();
+ try
+ {
+ execAction(result);
+ }
+ catch (CodeException ex)
+ {
+ LoggerManager.GetLogger().Error(ex.ToString());
+ result.IsSuccessful = false;
+ result.ErrorMessage = GetErrorMsg(ex);
+ result.Code = ex.Code;
+ }
+ catch (Exception ex)
+ {
+ var errMsg = LogHelper.GetCurSourceFileName() + " - " + LogHelper.GetLineNum() + ":" + ex.Message;
+ LoggerManager.GetLogger().Error(errMsg);
+ result.IsSuccessful = false;
+ result.ErrorMessage = errMsg;
+ }
+ return result;
+ }
+
+
+
+ ///
+ /// 根据Request中的QueryString获得Linq表达式
+ ///
+ /// 实体对象
+ ///
+ protected Expression> GetExpressionFromQueryString()
+ {
+ Expression> expr = null;
+ var queryPairs = Request.Query.ToDictionary(q => q.Key, q => q.Value).Where(q => q.Key.Equals("$format") == false);
+ if (queryPairs.Count() > 0)
+ {
+ var filterGroup = new FilterGroup();
+ foreach (var pairItem in queryPairs)
+ {
+ filterGroup.Rules.Add(new FilterRule(pairItem.Key, pairItem.Value));
+ }
+ expr = filterGroup.BuildExpression(null);
+ }
+ return expr;
+ }
+
+
+ }
+}
diff --git a/APT.Infrastructure.Api/Api/CommonApiController.cs b/APT.Infrastructure.Api/Api/CommonApiController.cs
new file mode 100644
index 0000000..39538a6
--- /dev/null
+++ b/APT.Infrastructure.Api/Api/CommonApiController.cs
@@ -0,0 +1,1861 @@
+using Microsoft.EntityFrameworkCore.Storage;
+using System;
+using System.Collections;
+using System.Collections.Concurrent;
+using System.Collections.Generic;
+using System.Data;
+using System.Data.Common;
+using System.Linq;
+using System.Linq.Expressions;
+using System.Threading.Tasks;
+using APT.Infrastructure.Core;
+namespace APT.Infrastructure.Api
+{
+ public abstract class CommonApiController : BaseApiController
+ {
+ ///
+ /// 获取操作单元
+ ///
+ ///
+ ///
+ public IUnitOfWork GetUnitOfWork() where T : MesEntityBase, new()
+ {
+ var commonService = _serviceLocator.GetService();
+ return commonService.UnitWork();
+ }
+ readonly ServiceLocator _serviceLocator = ServiceLocator.Instance;
+
+
+
+ #region old query
+ ///
+ /// 查询实体
+ ///
+ ///
+ ///
+ ///
+ ///
+ public T GetEntity(string id, params string[] paths) where T : MesEntityBase, new()
+ {
+ var commonService = _serviceLocator.GetService();
+
+ return commonService.GetEntity(id, paths);
+
+ }
+
+ ///
+ /// 查询实体
+ ///
+ ///
+ ///
+ ///
+ ///
+ public T GetEntity(Guid id, params string[] paths) where T : MesEntityBase, new()
+ {
+ var commonService = _serviceLocator.GetService();
+
+ return commonService.GetEntity(id, paths);
+
+ }
+ ///
+ /// 查询实体
+ ///
+ ///
+ ///
+ ///
+ ///
+ public T GetEntity(Expression> expression, params string[] paths) where T : MesEntityBase, new()
+ {
+ var commonService = _serviceLocator.GetService();
+ return commonService.GetEntity(expression, paths);
+ }
+ ///
+ /// 查询实体
+ ///
+ ///
+ ///
+ ///
+ ///
+ public T GetEntity(Expression> expression, BaseFilter fiter, params string[] paths) where T : MesEntityBase, new()
+ {
+ var commonService = _serviceLocator.GetService();
+ return commonService.GetEntity(expression, fiter, paths);
+ }
+
+ ///
+ /// 获取所有数据
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public IEnumerable GetEntities(Expression> expression, BaseFilter filter, params string[] paths) where T : MesEntityBase, new()
+ {
+ var commonService = _serviceLocator.GetService();
+ return commonService.GetEntities(expression, filter, paths);
+ }
+
+ ///