Browse Source

完成品类词管理

master
С·æ 4 years ago
commit
7df0c40259
  1. 66
      .gitattributes
  2. 263
      .gitignore
  3. 6
      .nuget
  4. 2
      .tfignore
  5. 49
      Colder.Admin.AntdVue.sln
  6. 8
      Directory.Build.props
  7. 21
      LICENSE
  8. 8
      README.md
  9. 12
      clear.bat
  10. 288
      docs/初始化文件/MySQL.sql
  11. 671
      docs/初始化文件/Oracle.sql
  12. 331
      docs/初始化文件/PostgreSQL.sql
  13. 1543
      docs/初始化文件/SQLServer.sql
  14. 3404
      docs/数据库设计/Base_Table.pdm
  15. 10
      docs/数据库设计/Base_Table.sws
  16. 73
      src/Coldairarrow.Api/05.Coldairarrow.Api.csproj
  17. 7
      src/Coldairarrow.Api/0_install.bat
  18. 4
      src/Coldairarrow.Api/0_uninstall.bat
  19. 65
      src/Coldairarrow.Api/BuildCodeTemplate/Business.txt
  20. 65
      src/Coldairarrow.Api/BuildCodeTemplate/Controller.txt
  21. 78
      src/Coldairarrow.Api/BuildCodeTemplate/EditForm.txt
  22. 16
      src/Coldairarrow.Api/BuildCodeTemplate/IBusiness.txt
  23. 157
      src/Coldairarrow.Api/BuildCodeTemplate/List.txt
  24. 13
      src/Coldairarrow.Api/Controllers/BaseApiController.cs
  25. 142
      src/Coldairarrow.Api/Controllers/BaseController.cs
  26. 100
      src/Coldairarrow.Api/Controllers/Base_Manage/Base_ActionController.cs
  27. 79
      src/Coldairarrow.Api/Controllers/Base_Manage/Base_AppSecretController.cs
  28. 79
      src/Coldairarrow.Api/Controllers/Base_Manage/Base_DbLinkController.cs
  29. 70
      src/Coldairarrow.Api/Controllers/Base_Manage/Base_DepartmentController.cs
  30. 70
      src/Coldairarrow.Api/Controllers/Base_Manage/Base_RoleController.cs
  31. 75
      src/Coldairarrow.Api/Controllers/Base_Manage/Base_UserController.cs
  32. 49
      src/Coldairarrow.Api/Controllers/Base_Manage/Base_UserLogController.cs
  33. 43
      src/Coldairarrow.Api/Controllers/Base_Manage/BuildCodeController.cs
  34. 95
      src/Coldairarrow.Api/Controllers/Base_Manage/HomeController.cs
  35. 51
      src/Coldairarrow.Api/Controllers/Base_Manage/UploadController.cs
  36. 85
      src/Coldairarrow.Api/Controllers/HuiYan/catsController.cs
  37. 51
      src/Coldairarrow.Api/Controllers/TestController.cs
  38. 98
      src/Coldairarrow.Api/DependencyInjection/Operator.cs
  39. 8
      src/Coldairarrow.Api/Dockerfile
  40. 61
      src/Coldairarrow.Api/Extentions/HostExtentions.cs
  41. 41
      src/Coldairarrow.Api/Extentions/JwtExtentions.cs
  42. 138
      src/Coldairarrow.Api/Filters/BaseActionFilterAsync.cs
  43. 19
      src/Coldairarrow.Api/Filters/FilterExtentions.cs
  44. 35
      src/Coldairarrow.Api/Filters/全局错误过滤/GlobalExceptionFilter.cs
  45. 21
      src/Coldairarrow.Api/Filters/参数校验/ValidFilterAttribute.cs
  46. 157
      src/Coldairarrow.Api/Filters/对外接口签名校验/CheckSignAttribute.cs
  47. 10
      src/Coldairarrow.Api/Filters/对外接口签名校验/IgnoreSignAttribute.cs
  48. 44
      src/Coldairarrow.Api/Filters/接口权限/ApiPermissionAttribute.cs
  49. 10
      src/Coldairarrow.Api/Filters/接口权限/NoApiPermissionAttribute.cs
  50. 31
      src/Coldairarrow.Api/Filters/格式化返回结果/FormatResponseAttribute.cs
  51. 29
      src/Coldairarrow.Api/Filters/格式化返回结果/NoFormatResponseAttribute.cs
  52. 9
      src/Coldairarrow.Api/Middlewares/RequestBody.cs
  53. 30
      src/Coldairarrow.Api/Middlewares/RequestBodyMiddleware.cs
  54. 83
      src/Coldairarrow.Api/Middlewares/RequestLogMiddleware.cs
  55. 8
      src/Coldairarrow.Api/Options/CacheOptions.cs
  56. 18
      src/Coldairarrow.Api/Options/CacheType.cs
  57. 10
      src/Coldairarrow.Api/Options/JwtOptions.cs
  58. 39
      src/Coldairarrow.Api/Program.cs
  59. 19
      src/Coldairarrow.Api/Properties/PublishProfiles/FolderProfile.pubxml
  60. 13
      src/Coldairarrow.Api/Properties/launchSettings.json
  61. 93
      src/Coldairarrow.Api/Startup.cs
  62. 3
      src/Coldairarrow.Api/appsettings.Development.json
  63. 59
      src/Coldairarrow.Api/appsettings.json
  64. BIN
      src/Coldairarrow.Api/nssm.exe
  65. 17
      src/Coldairarrow.Business/04.Coldairarrow.Business.csproj
  66. 24
      src/Coldairarrow.Business/AOP/DataAddLogAttribute.cs
  67. 38
      src/Coldairarrow.Business/AOP/DataDeleteLogAttribute.cs
  68. 24
      src/Coldairarrow.Business/AOP/DataEditLogAttribute.cs
  69. 68
      src/Coldairarrow.Business/AOP/DataRepeatValidateAttribute.cs
  70. 19
      src/Coldairarrow.Business/AOP/WriteDataLogAttribute.cs
  71. 536
      src/Coldairarrow.Business/BaseBusiness.T.cs
  72. 138
      src/Coldairarrow.Business/Base_Manage/Base_ActionBusiness.cs
  73. 77
      src/Coldairarrow.Business/Base_Manage/Base_AppSecretBusiness.cs
  74. 53
      src/Coldairarrow.Business/Base_Manage/Base_DbLinkBusiness.cs
  75. 88
      src/Coldairarrow.Business/Base_Manage/Base_DepartmentBusiness.cs
  76. 117
      src/Coldairarrow.Business/Base_Manage/Base_RoleBusiness.cs
  77. 166
      src/Coldairarrow.Business/Base_Manage/Base_UserBusiness.cs
  78. 35
      src/Coldairarrow.Business/Base_Manage/Base_UserLogBusiness.cs
  79. 220
      src/Coldairarrow.Business/Base_Manage/BuildCodeBusiness.cs
  80. 52
      src/Coldairarrow.Business/Base_Manage/HomeBusiness.cs
  81. 71
      src/Coldairarrow.Business/Base_Manage/PermissionBusiness.cs
  82. 60
      src/Coldairarrow.Business/Cache/BaseCache.T.cs
  83. 36
      src/Coldairarrow.Business/Cache/Base_UserCache.cs
  84. 12
      src/Coldairarrow.Business/Cache/IBaseCache.T.cs
  85. 9
      src/Coldairarrow.Business/Cache/IBase_UserCache.cs
  86. 204
      src/Coldairarrow.Business/HuiYan/catsBusiness.cs
  87. 21
      src/Coldairarrow.Entity/02.Coldairarrow.Entity.csproj
  88. 75
      src/Coldairarrow.Entity/Base_Manage/Base_Action.cs
  89. 51
      src/Coldairarrow.Entity/Base_Manage/Base_AppSecret.cs
  90. 50
      src/Coldairarrow.Entity/Base_Manage/Base_DbLink.cs
  91. 46
      src/Coldairarrow.Entity/Base_Manage/Base_Department.cs
  92. 41
      src/Coldairarrow.Entity/Base_Manage/Base_Role.cs
  93. 46
      src/Coldairarrow.Entity/Base_Manage/Base_RoleAction.cs
  94. 75
      src/Coldairarrow.Entity/Base_Manage/Base_User.cs
  95. 44
      src/Coldairarrow.Entity/Base_Manage/Base_UserLog.cs
  96. 46
      src/Coldairarrow.Entity/Base_Manage/Base_UserRole.cs
  97. 33
      src/Coldairarrow.Entity/DTO/Base_UserDTO.cs
  98. 32
      src/Coldairarrow.Entity/DTO/CatDto.cs
  99. 12
      src/Coldairarrow.Entity/Enum/ActionType.cs
  100. 14
      src/Coldairarrow.Entity/Enum/RoleTypes.cs

66
.gitattributes

@ -0,0 +1,66 @@
*.js linguist-language=csharp
*.css linguist-language=csharp
*.html linguist-language=csharp
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto
###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
#*.cs diff=csharp
###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln merge=binary
#*.csproj merge=binary
#*.vbproj merge=binary
#*.vcxproj merge=binary
#*.vcproj merge=binary
#*.dbproj merge=binary
#*.fsproj merge=binary
#*.lsproj merge=binary
#*.wixproj merge=binary
#*.modelproj merge=binary
#*.sqlproj merge=binary
#*.wwaproj merge=binary
###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg binary
#*.png binary
#*.gif binary
###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
#*.doc diff=astextplain
#*.DOC diff=astextplain
#*.docx diff=astextplain
#*.DOCX diff=astextplain
#*.dot diff=astextplain
#*.DOT diff=astextplain
#*.pdf diff=astextplain
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain

263
.gitignore

@ -0,0 +1,263 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# DNX
project.lock.json
project.fragment.lock.json
artifacts/
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.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
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# 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
# TODO: 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
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# NuGet v3's project.json files produces more ignoreable 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
# 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
node_modules/
orleans.codegen.cs
# 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
# SQL Server files
*.mdf
*.ldf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# 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/
# JetBrains Rider
.idea/
*.sln.iml
# CodeRush
.cr/
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
/src/Coldairarrow.Web/wwwroot/Upload/File
/src/Coldairarrow.Api/wwwroot/Upload

6
.nuget

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<solution>
<add key="disableSourceControlIntegration" value="true" />
</solution>
</configuration>

2
.tfignore

@ -0,0 +1,2 @@
\packages
!\packages\repositories.config

49
Colder.Admin.AntdVue.sln

@ -0,0 +1,49 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29123.88
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "01.Coldairarrow.Util", "src\Coldairarrow.Util\01.Coldairarrow.Util.csproj", "{3F8163F9-0513-4DD5-8761-D62294A72BAC}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "02.Coldairarrow.Entity", "src\Coldairarrow.Entity\02.Coldairarrow.Entity.csproj", "{0313E651-ADE8-4357-AE39-AADEC575F241}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "04.Coldairarrow.Business", "src\Coldairarrow.Business\04.Coldairarrow.Business.csproj", "{1920BFF8-DE4A-4871-A564-64356A5997BF}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "05.Coldairarrow.Api", "src\Coldairarrow.Api\05.Coldairarrow.Api.csproj", "{BEA1BF0D-B063-4931-89C7-22F92973143A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "03.Coldairarrow.IBusiness", "src\Coldairarrow.IBusiness\03.Coldairarrow.IBusiness.csproj", "{4422EF5A-9E20-450D-B0BD-643DED2B9219}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{3F8163F9-0513-4DD5-8761-D62294A72BAC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3F8163F9-0513-4DD5-8761-D62294A72BAC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3F8163F9-0513-4DD5-8761-D62294A72BAC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3F8163F9-0513-4DD5-8761-D62294A72BAC}.Release|Any CPU.Build.0 = Release|Any CPU
{0313E651-ADE8-4357-AE39-AADEC575F241}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0313E651-ADE8-4357-AE39-AADEC575F241}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0313E651-ADE8-4357-AE39-AADEC575F241}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0313E651-ADE8-4357-AE39-AADEC575F241}.Release|Any CPU.Build.0 = Release|Any CPU
{1920BFF8-DE4A-4871-A564-64356A5997BF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1920BFF8-DE4A-4871-A564-64356A5997BF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1920BFF8-DE4A-4871-A564-64356A5997BF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1920BFF8-DE4A-4871-A564-64356A5997BF}.Release|Any CPU.Build.0 = Release|Any CPU
{BEA1BF0D-B063-4931-89C7-22F92973143A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BEA1BF0D-B063-4931-89C7-22F92973143A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BEA1BF0D-B063-4931-89C7-22F92973143A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BEA1BF0D-B063-4931-89C7-22F92973143A}.Release|Any CPU.Build.0 = Release|Any CPU
{4422EF5A-9E20-450D-B0BD-643DED2B9219}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4422EF5A-9E20-450D-B0BD-643DED2B9219}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4422EF5A-9E20-450D-B0BD-643DED2B9219}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4422EF5A-9E20-450D-B0BD-643DED2B9219}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {7557970B-2675-4EDD-B2EF-EA28744BC050}
EndGlobalSection
EndGlobal

8
Directory.Build.props

@ -0,0 +1,8 @@
<Project>
<PropertyGroup>
<!--默认统一输出XML注释文档,不需要输出的项目可以单独关闭-->
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>
</Project>

21
LICENSE

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2019 Coldairarrow
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

8
README.md

@ -0,0 +1,8 @@
# Colder.Admin.AntdVue
Web后台快速开发框架,.NET5+Ant Design Vue版本
**代码(GitHub):**<https://github.com/Coldairarrow/Colder.Admin.AntdVue>
**文档(GitHub):**<https://github.com/Coldairarrow/Colder.Admin.AntdVue/wiki>
**代码(码云镜像):**<https://gitee.com/Coldairarrow/Colder.Admin.AntdVue>
**文档(码云镜像):**<https://gitee.com/Coldairarrow/Colder.Admin.AntdVue/wikis>
**在线预览地址**:<http://coldairarrow.gitee.io/colder.amin.antdvue.preview.web/> (账号/密码:Admin 123456)

12
clear.bat

@ -0,0 +1,12 @@
::删除所有bin与obj下的文件
@echo off
set nowpath=%cd%
cd \
cd %nowpath%
::delete specify file(*.pdb,*.vshost.*)
for /r %nowpath% %%i in (*.pdb,*.vshost.*) do (del %%i && echo delete %%i)
::delete specify folder(obj,bin)
for /r %nowpath% %%i in (obj,bin) do (IF EXIST %%i (RD /s /q %%i && echo delete %%i))
pause

288
docs/初始化文件/MySQL.sql

@ -0,0 +1,288 @@
/*
Navicat MySQL Data Transfer
Source Server : 47.97.152.69@root
Source Server Version : 50727
Source Host : 47.97.152.69:3306
Source Database : Colder.Admin.AntdVue
Target Server Type : MYSQL
Target Server Version : 50727
File Encoding : 65001
Date: 2020-04-19 16:44:48
*/
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for Base_Action
-- ----------------------------
DROP TABLE IF EXISTS `Base_Action`;
CREATE TABLE `Base_Action` (
`Id` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '主键' ,
`CreateTime` datetime NOT NULL COMMENT '创建时间' ,
`CreatorId` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建人Id' ,
`Deleted` tinyint(4) NOT NULL DEFAULT 0 COMMENT '否已删除' ,
`ParentId` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '父级Id' ,
`Type` int(11) NOT NULL COMMENT '类型,菜单=0,页面=1,权限=2' ,
`Name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '权限名/菜单名' ,
`Url` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '菜单地址' ,
`Value` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '权限值' ,
`NeedAction` tinyint(4) NOT NULL DEFAULT 0 COMMENT '是否需要权限(仅页面有效)' ,
`Icon` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '图标' ,
`Sort` int(11) NOT NULL DEFAULT 0 COMMENT '排序' ,
PRIMARY KEY (`Id`)
)
ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci
COMMENT='系统权限表'
;
-- ----------------------------
-- Records of Base_Action
-- ----------------------------
BEGIN;
INSERT INTO `Base_Action` VALUES ('1178957405992521728', '2019-10-01 16:58:44', null, '0', null, '0', '系统管理', '', null, '1', 'setting', '1'), ('1178957553778823168', '2019-10-01 16:59:19', null, '0', '1178957405992521728', '1', '权限管理', '/Base_Manage/Base_Action/List', null, '1', null, '20'), ('1179018395304071168', '2019-10-01 21:01:05', null, '0', '1178957405992521728', '1', '密钥管理', '/Base_Manage/Base_AppSecret/List', null, '1', null, '15'), ('1182652266117599232', '2019-10-11 21:40:47', null, '0', '1178957405992521728', '1', '用户管理', '/Base_Manage/Base_User/List', null, '1', null, '0'), ('1182652367447789568', '2019-10-11 21:41:11', null, '0', '1178957405992521728', '1', '角色管理', '/Base_Manage/Base_Role/List', null, '1', null, '5'), ('1182652433302556672', '2019-10-11 21:41:27', null, '0', '1178957405992521728', '1', '部门管理', '/Base_Manage/Base_Department/List', null, '1', null, '10'), ('1188801057778569216', '2019-10-28 20:53:53', null, '0', '1182652367447789568', '2', '', null, 'Base_Role.Add', '1', null, '0'), ('1188801057778569217', '2019-10-28 20:53:53', null, '0', '1182652367447789568', '2', '', null, 'Base_Role.Edit', '1', null, '0'), ('1188801057778569218', '2019-10-28 20:53:53', null, '0', '1182652367447789568', '2', '', null, 'Base_Role.Delete', '1', null, '0'), ('1188801109783744512', '2019-10-28 20:54:06', null, '0', '1182652433302556672', '2', '', null, 'Base_Department.Add', '1', null, '0'), ('1188801109783744513', '2019-10-28 20:54:06', null, '0', '1182652433302556672', '2', '', null, 'Base_Department.Edit', '1', null, '0'), ('1188801109783744514', '2019-10-28 20:54:06', null, '0', '1182652433302556672', '2', '', null, 'Base_Department.Delete', '1', null, '0'), ('1188801273885888512', '2019-10-28 20:54:45', null, '0', '1179018395304071168', '2', '', null, 'Base_AppSecret.Add', '1', null, '0'), ('1188801273885888513', '2019-10-28 20:54:45', null, '0', '1179018395304071168', '2', '', null, 'Base_AppSecret.Edit', '1', null, '0'), ('1188801273885888514', '2019-10-28 20:54:45', null, '0', '1179018395304071168', '2', '', null, 'Base_AppSecret.Delete', '1', null, '0'), ('1188801341661646848', '2019-10-28 20:55:01', null, '0', '1178957553778823168', '2', '', null, 'Base_Action.Add', '1', null, '0'), ('1188801341661646849', '2019-10-28 20:55:01', null, '0', '1178957553778823168', '2', '', null, 'Base_Action.Edit', '1', null, '0'), ('1188801341661646850', '2019-10-28 20:55:01', null, '0', '1178957553778823168', '2', '', null, 'Base_Action.Delete', '1', null, '0'), ('1193158266167758848', '2019-11-09 21:27:53', 'Admin', '0', null, '0', '首页', null, null, '1', 'home', '0'), ('1193158630615027712', '2019-11-09 21:29:20', 'Admin', '0', '1193158266167758848', '1', '框架介绍', '/Home/Introduce', null, '0', null, '0'), ('1193158780011941888', '2019-11-09 21:29:55', 'Admin', '0', '1193158266167758848', '1', '运营统计', '/Home/Statis', null, '0', null, '0'), ('1251792477787000832', '2020-04-19 16:39:19', null, '0', '1182652266117599232', '2', '', null, 'Base_User.Add', '1', null, '0'), ('1251792477787000833', '2020-04-19 16:39:19', null, '0', '1182652266117599232', '2', '', null, 'Base_User.Edit', '1', null, '0'), ('1251792477787000834', '2020-04-19 16:39:19', null, '0', '1182652266117599232', '2', '', null, 'Base_User.Delete', '1', null, '0'), ('1251792721769664512', '2020-04-19 16:40:17', 'Admin', '0', '1178957405992521728', '1', '操作日志', '/Base_Manage/Base_UserLog/List', null, '0', null, '23');
COMMIT;
-- ----------------------------
-- Table structure for Base_AppSecret
-- ----------------------------
DROP TABLE IF EXISTS `Base_AppSecret`;
CREATE TABLE `Base_AppSecret` (
`Id` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '自然主键' ,
`CreateTime` datetime NOT NULL COMMENT '创建时间' ,
`CreatorId` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建人Id' ,
`Deleted` tinyint(4) NOT NULL DEFAULT 0 COMMENT '否已删除' ,
`AppId` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '应用Id' ,
`AppSecret` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '应用密钥' ,
`AppName` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '应用名' ,
PRIMARY KEY (`Id`)
)
ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci
COMMENT='应用密钥表'
;
-- ----------------------------
-- Records of Base_AppSecret
-- ----------------------------
BEGIN;
INSERT INTO `Base_AppSecret` VALUES ('1172497995938271232', '2019-09-13 21:11:20', 'Admin', '0', 'PcAdmin', 'wtMaiTRPTT3hrf5e', '后台AppId'), ('1173937877642383360', '2019-09-17 20:32:55', 'Admin', '0', 'AppAdmin', 'IVh9LLSVFcoQPQ5K', 'APP密钥');
COMMIT;
-- ----------------------------
-- Table structure for Base_BuildTest
-- ----------------------------
DROP TABLE IF EXISTS `Base_BuildTest`;
CREATE TABLE `Base_BuildTest` (
`Id` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '自然主键' ,
`CreateTime` datetime NOT NULL COMMENT '创建时间' ,
`CreatorId` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建人Id' ,
`Deleted` tinyint(4) NOT NULL DEFAULT 0 COMMENT '否已删除' ,
`Column1` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '列1' ,
`Column2` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '列2' ,
`Column3` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '列3' ,
`Column4` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '列4' ,
`Column5` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '列5' ,
PRIMARY KEY (`Id`)
)
ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci
COMMENT='生成测试表'
;
-- ----------------------------
-- Records of Base_BuildTest
-- ----------------------------
BEGIN;
COMMIT;
-- ----------------------------
-- Table structure for Base_DbLink
-- ----------------------------
DROP TABLE IF EXISTS `Base_DbLink`;
CREATE TABLE `Base_DbLink` (
`Id` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '自然主键' ,
`CreateTime` datetime NOT NULL COMMENT '创建时间' ,
`CreatorId` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建人Id' ,
`Deleted` tinyint(4) NOT NULL DEFAULT 0 COMMENT '否已删除' ,
`LinkName` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '连接名' ,
`ConnectionStr` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '连接字符串' ,
`DbType` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '数据库类型' ,
PRIMARY KEY (`Id`)
)
ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci
COMMENT='数据库连接表'
;
-- ----------------------------
-- Records of Base_DbLink
-- ----------------------------
BEGIN;
INSERT INTO `Base_DbLink` VALUES ('1183373232498020352', '2019-10-13 21:25:39', 'Admin', '0', 'BaseDb', 'Data Source=.;Initial Catalog=Colder.Admin.AntdVue;Integrated Security=True', 'SqlServer');
COMMIT;
-- ----------------------------
-- Table structure for Base_Department
-- ----------------------------
DROP TABLE IF EXISTS `Base_Department`;
CREATE TABLE `Base_Department` (
`Id` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '主键' ,
`CreateTime` datetime NOT NULL COMMENT '创建时间' ,
`CreatorId` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建人Id' ,
`Deleted` tinyint(4) NOT NULL DEFAULT 0 COMMENT '否已删除' ,
`Name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '部门名' ,
`ParentId` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '上级部门Id' ,
PRIMARY KEY (`Id`)
)
ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci
COMMENT='部门表'
;
-- ----------------------------
-- Records of Base_Department
-- ----------------------------
BEGIN;
INSERT INTO `Base_Department` VALUES ('1181175685528424448', '2019-10-07 19:53:23', null, '0', '宁波分公司', null), ('1181175803631636480', '2019-10-07 19:53:51', null, '0', '鄞州事业部', '1181175685528424448'), ('1181175865409540096', '2019-10-07 19:54:06', null, '0', '海曙事业部', '1181175685528424448');
COMMIT;
-- ----------------------------
-- Table structure for Base_Role
-- ----------------------------
DROP TABLE IF EXISTS `Base_Role`;
CREATE TABLE `Base_Role` (
`Id` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '主键' ,
`CreateTime` datetime NOT NULL COMMENT '创建时间' ,
`CreatorId` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建人Id' ,
`Deleted` tinyint(4) NOT NULL DEFAULT 0 COMMENT '否已删除' ,
`RoleName` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '角色名' ,
PRIMARY KEY (`Id`)
)
ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci
COMMENT='系统角色表'
;
-- ----------------------------
-- Records of Base_Role
-- ----------------------------
BEGIN;
INSERT INTO `Base_Role` VALUES ('1180486275199668224', '2019-10-05 22:13:55', null, '0', '超级管理员'), ('1180819481383931904', '2019-10-06 20:17:57', null, '0', '部门管理员');
COMMIT;
-- ----------------------------
-- Table structure for Base_RoleAction
-- ----------------------------
DROP TABLE IF EXISTS `Base_RoleAction`;
CREATE TABLE `Base_RoleAction` (
`Id` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '主键' ,
`CreateTime` datetime NOT NULL COMMENT '创建时间' ,
`CreatorId` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建人Id' ,
`Deleted` tinyint(4) NOT NULL DEFAULT 0 COMMENT '否已删除' ,
`RoleId` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户Id' ,
`ActionId` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '权限Id' ,
PRIMARY KEY (`Id`)
)
ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci
COMMENT='角色权限表'
;
-- ----------------------------
-- Records of Base_RoleAction
-- ----------------------------
BEGIN;
INSERT INTO `Base_RoleAction` VALUES ('1188801858282459136', '2019-10-28 20:57:04', null, '0', '1180486275199668224', '1182654049414025216'), ('1188801858282459137', '2019-10-28 20:57:04', null, '0', '1180486275199668224', '1182654208411701248'), ('1188801858282459138', '2019-10-28 20:57:04', null, '0', '1180486275199668224', '1183370665412005888'), ('1188801984434540544', '2019-10-28 20:57:34', null, '0', '1180819481383931904', '1188044797802188800'), ('1188801984434540545', '2019-10-28 20:57:34', null, '0', '1180819481383931904', '1188044797802188801'), ('1188801984434540546', '2019-10-28 20:57:34', null, '0', '1180819481383931904', '1182652433302556672'), ('1188801984434540547', '2019-10-28 20:57:34', null, '0', '1180819481383931904', '1178957405992521728'), ('1188801984434540548', '2019-10-28 20:57:34', null, '0', '1180819481383931904', '1188801109783744512'), ('1188801984434540549', '2019-10-28 20:57:34', null, '0', '1180819481383931904', '1188801109783744513'), ('1188801984434540550', '2019-10-28 20:57:34', null, '0', '1180819481383931904', '1188801109783744514'), ('1188801984434540551', '2019-10-28 20:57:34', null, '0', '1180819481383931904', '1182652266117599232'), ('1188801984434540552', '2019-10-28 20:57:34', null, '0', '1180819481383931904', '1188800845714558976'), ('1188801984434540553', '2019-10-28 20:57:34', null, '0', '1180819481383931904', '1188800845714558977'), ('1188801984434540554', '2019-10-28 20:57:34', null, '0', '1180819481383931904', '1188800845714558978'), ('1188801984434540555', '2019-10-28 20:57:34', null, '0', '1180819481383931904', '1182652367447789568'), ('1188801984434540556', '2019-10-28 20:57:34', null, '0', '1180819481383931904', '1188801057778569216'), ('1188801984434540557', '2019-10-28 20:57:34', null, '0', '1180819481383931904', '1188801057778569217'), ('1188801984434540558', '2019-10-28 20:57:34', null, '0', '1180819481383931904', '1188801057778569218');
COMMIT;
-- ----------------------------
-- Table structure for Base_User
-- ----------------------------
DROP TABLE IF EXISTS `Base_User`;
CREATE TABLE `Base_User` (
`Id` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '主键' ,
`CreateTime` datetime NOT NULL COMMENT '创建时间' ,
`CreatorId` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建人Id' ,
`Deleted` tinyint(4) NOT NULL DEFAULT 0 COMMENT '否已删除' ,
`UserName` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户名' ,
`Password` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '密码' ,
`RealName` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '姓名' ,
`Sex` int(11) NOT NULL DEFAULT 0 COMMENT '性别(1为男,0为女)' ,
`Birthday` date NULL DEFAULT NULL COMMENT '出生日期' ,
`DepartmentId` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '所属部门Id' ,
PRIMARY KEY (`Id`)
)
ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci
COMMENT='系统用户表'
;
-- ----------------------------
-- Records of Base_User
-- ----------------------------
BEGIN;
INSERT INTO `Base_User` VALUES ('1181928860648738816', '2019-10-09 21:46:14', null, '0', 'xiaohua', 'e10adc3949ba59abbe56e057f20f883e', '小花', '0', null, null), ('1183363221872971776', '2019-10-13 20:45:52', 'Admin', '0', 'aa', null, 'aaa', '0', null, null), ('Admin', '2019-09-13 21:10:03', 'Admin', '0', 'Admin', 'e10adc3949ba59abbe56e057f20f883e', '超级管理员', '1', '2019-09-13', null);
COMMIT;
-- ----------------------------
-- Table structure for Base_UserLog
-- ----------------------------
DROP TABLE IF EXISTS `Base_UserLog`;
CREATE TABLE `Base_UserLog` (
`Id` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '自然主键' ,
`CreateTime` datetime NOT NULL COMMENT '创建时间' ,
`CreatorId` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建人Id' ,
`CreatorRealName` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建人姓名' ,
`LogType` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '日志类型' ,
`LogContent` longtext CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '日志内容' ,
PRIMARY KEY (`Id`)
)
ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci
COMMENT='系统日志表'
;
-- ----------------------------
-- Records of Base_UserLog
-- ----------------------------
BEGIN;
COMMIT;
-- ----------------------------
-- Table structure for Base_UserRole
-- ----------------------------
DROP TABLE IF EXISTS `Base_UserRole`;
CREATE TABLE `Base_UserRole` (
`Id` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '主键' ,
`CreateTime` datetime NOT NULL COMMENT '创建时间' ,
`CreatorId` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '创建人Id' ,
`Deleted` tinyint(4) NOT NULL DEFAULT 0 COMMENT '否已删除' ,
`UserId` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '用户Id' ,
`RoleId` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '角色Id' ,
PRIMARY KEY (`Id`)
)
ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8 COLLATE=utf8_general_ci
COMMENT='用户角色表'
;
-- ----------------------------
-- Records of Base_UserRole
-- ----------------------------
BEGIN;
INSERT INTO `Base_UserRole` VALUES ('1181927367719784448', '2019-10-09 21:40:18', null, '0', '1181922344629702656', '1180819481383931904'), ('1181927367719784449', '2019-10-09 21:40:18', null, '0', '1181922344629702656', '1180486275199668224'), ('1181927783786352640', '2019-10-09 21:41:57', null, '0', '1181927783727632384', '1180819481383931904'), ('1251792318642524160', '2020-04-19 16:38:41', null, '0', '1181928860648738816', '1180819481383931904');
COMMIT;

671
docs/初始化文件/Oracle.sql

@ -0,0 +1,671 @@
/*
Navicat Oracle Data Transfer
Oracle Client Version : 10.2.0.5.0
Source Server : 127.0.0.1@SYSTEM
Source Server Version : 110200
Source Host : 127.0.0.1:1521
Source Schema : COLDER.ADMIN.ANTDVUE
Target Server Type : ORACLE
Target Server Version : 110200
File Encoding : 65001
Date: 2020-04-19 16:14:00
*/
-- ----------------------------
-- Table structure for Base_Action
-- ----------------------------
CREATE TABLE "Base_Action" (
"Id" VARCHAR2(50 CHAR) NOT NULL ,
"CreateTime" DATE NOT NULL ,
"CreatorId" VARCHAR2(50 CHAR) NULL ,
"Deleted" NUMBER(1) DEFAULT 0 NOT NULL ,
"ParentId" NVARCHAR2(50) NULL ,
"Type" NUMBER(11) NOT NULL ,
"Name" NVARCHAR2(50) NULL ,
"Url" NVARCHAR2(500) NULL ,
"Value" NVARCHAR2(50) NULL ,
"NeedAction" NUMBER(1) DEFAULT 0 NOT NULL ,
"Icon" NVARCHAR2(50) NULL ,
"Sort" NUMBER(11) NOT NULL
)
LOGGING
NOCOMPRESS
NOCACHE
;
COMMENT ON TABLE "Base_Action" IS '系统权限表';
COMMENT ON COLUMN "Base_Action"."Id" IS '主键';
COMMENT ON COLUMN "Base_Action"."CreateTime" IS '创建时间';
COMMENT ON COLUMN "Base_Action"."CreatorId" IS '创建人Id';
COMMENT ON COLUMN "Base_Action"."Deleted" IS '否已删除';
COMMENT ON COLUMN "Base_Action"."ParentId" IS '父级Id';
COMMENT ON COLUMN "Base_Action"."Type" IS '类型,菜单=0,页面=1,权限=2';
COMMENT ON COLUMN "Base_Action"."Name" IS '权限名/菜单名';
COMMENT ON COLUMN "Base_Action"."Url" IS '菜单地址';
COMMENT ON COLUMN "Base_Action"."Value" IS '权限值';
COMMENT ON COLUMN "Base_Action"."NeedAction" IS '是否需要权限(仅页面有效)';
COMMENT ON COLUMN "Base_Action"."Icon" IS '图标';
COMMENT ON COLUMN "Base_Action"."Sort" IS '排序';
-- ----------------------------
-- Records of Base_Action
-- ----------------------------
INSERT INTO "Base_Action" VALUES ('1178957405992521728', TO_DATE('2019-10-01 16:58:44', 'YYYY-MM-DD HH24:MI:SS'), null, '0', null, '0', '系统管理', null, null, '1', 'setting', '1');
INSERT INTO "Base_Action" VALUES ('1178957553778823168', TO_DATE('2019-10-01 16:59:19', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1178957405992521728', '1', '权限管理', '/Base_Manage/Base_Action/List', null, '1', null, '20');
INSERT INTO "Base_Action" VALUES ('1179018395304071168', TO_DATE('2019-10-01 21:01:05', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1178957405992521728', '1', '密钥管理', '/Base_Manage/Base_AppSecret/List', null, '1', null, '15');
INSERT INTO "Base_Action" VALUES ('1182652266117599232', TO_DATE('2019-10-11 21:40:47', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1178957405992521728', '1', '用户管理', '/Base_Manage/Base_User/List', null, '1', null, '0');
INSERT INTO "Base_Action" VALUES ('1182652367447789568', TO_DATE('2019-10-11 21:41:11', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1178957405992521728', '1', '角色管理', '/Base_Manage/Base_Role/List', null, '1', null, '5');
INSERT INTO "Base_Action" VALUES ('1182652433302556672', TO_DATE('2019-10-11 21:41:27', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1178957405992521728', '1', '部门管理', '/Base_Manage/Base_Department/List', null, '1', null, '10');
INSERT INTO "Base_Action" VALUES ('1188801057778569216', TO_DATE('2019-10-28 20:53:53', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1182652367447789568', '2', '', null, 'Base_Role.Add', '1', null, '0');
INSERT INTO "Base_Action" VALUES ('1188801057778569217', TO_DATE('2019-10-28 20:53:53', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1182652367447789568', '2', '', null, 'Base_Role.Edit', '1', null, '0');
INSERT INTO "Base_Action" VALUES ('1188801057778569218', TO_DATE('2019-10-28 20:53:53', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1182652367447789568', '2', '', null, 'Base_Role.Delete', '1', null, '0');
INSERT INTO "Base_Action" VALUES ('1188801109783744512', TO_DATE('2019-10-28 20:54:06', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1182652433302556672', '2', '', null, 'Base_Department.Add', '1', null, '0');
INSERT INTO "Base_Action" VALUES ('1188801109783744513', TO_DATE('2019-10-28 20:54:06', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1182652433302556672', '2', '', null, 'Base_Department.Edit', '1', null, '0');
INSERT INTO "Base_Action" VALUES ('1188801109783744514', TO_DATE('2019-10-28 20:54:06', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1182652433302556672', '2', '', null, 'Base_Department.Delete', '1', null, '0');
INSERT INTO "Base_Action" VALUES ('1188801273885888512', TO_DATE('2019-10-28 20:54:45', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1179018395304071168', '2', '', null, 'Base_AppSecret.Add', '1', null, '0');
INSERT INTO "Base_Action" VALUES ('1188801273885888513', TO_DATE('2019-10-28 20:54:45', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1179018395304071168', '2', '', null, 'Base_AppSecret.Edit', '1', null, '0');
INSERT INTO "Base_Action" VALUES ('1188801273885888514', TO_DATE('2019-10-28 20:54:45', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1179018395304071168', '2', '', null, 'Base_AppSecret.Delete', '1', null, '0');
INSERT INTO "Base_Action" VALUES ('1188801341661646848', TO_DATE('2019-10-28 20:55:01', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1178957553778823168', '2', '', null, 'Base_Action.Add', '1', null, '0');
INSERT INTO "Base_Action" VALUES ('1188801341661646849', TO_DATE('2019-10-28 20:55:01', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1178957553778823168', '2', '', null, 'Base_Action.Edit', '1', null, '0');
INSERT INTO "Base_Action" VALUES ('1188801341661646850', TO_DATE('2019-10-28 20:55:01', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1178957553778823168', '2', '', null, 'Base_Action.Delete', '1', null, '0');
INSERT INTO "Base_Action" VALUES ('1193158266167758848', TO_DATE('2019-11-09 21:27:53', 'YYYY-MM-DD HH24:MI:SS'), 'Admin', '0', null, '0', '首页', null, null, '1', 'home', '0');
INSERT INTO "Base_Action" VALUES ('1193158630615027712', TO_DATE('2019-11-09 21:29:20', 'YYYY-MM-DD HH24:MI:SS'), 'Admin', '0', '1193158266167758848', '1', '框架介绍', '/Home/Introduce', null, '0', null, '0');
INSERT INTO "Base_Action" VALUES ('1193158780011941888', TO_DATE('2019-11-09 21:29:55', 'YYYY-MM-DD HH24:MI:SS'), 'Admin', '0', '1193158266167758848', '1', '运营统计', '/Home/Statis', null, '0', null, '0');
INSERT INTO "Base_Action" VALUES ('1251785113994268674', TO_DATE('2020-04-19 16:10:02', 'YYYY-MM-DD HH24:MI:SS'), null, '1', '1182652266117599232', '2', '', null, 'Base_User.Delete', '1', null, '0');
INSERT INTO "Base_Action" VALUES ('1251785113994268673', TO_DATE('2020-04-19 16:10:02', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1182652266117599232', '2', '', null, 'Base_User.Edit', '1', null, '0');
INSERT INTO "Base_Action" VALUES ('1251785113994268672', TO_DATE('2020-04-19 16:10:02', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1182652266117599232', '2', '', null, 'Base_User.Add', '1', null, '0');
INSERT INTO "Base_Action" VALUES ('1251785605155655680', TO_DATE('2020-04-19 16:11:59', 'YYYY-MM-DD HH24:MI:SS'), 'Admin', '0', '1178957405992521728', '1', '操作日志', '/Base_Manage/Base_UserLog/List', null, '0', null, '23');
-- ----------------------------
-- Table structure for Base_AppSecret
-- ----------------------------
CREATE TABLE "Base_AppSecret" (
"Id" VARCHAR2(50 CHAR) NOT NULL ,
"CreateTime" DATE NOT NULL ,
"CreatorId" VARCHAR2(50 CHAR) NULL ,
"Deleted" NUMBER(1) DEFAULT 0 NOT NULL ,
"AppId" VARCHAR2(50 CHAR) NULL ,
"AppSecret" VARCHAR2(50 CHAR) NULL ,
"AppName" VARCHAR2(50 CHAR) NULL
)
LOGGING
NOCOMPRESS
NOCACHE
;
COMMENT ON TABLE "Base_AppSecret" IS '应用密钥表';
COMMENT ON COLUMN "Base_AppSecret"."Id" IS '自然主键';
COMMENT ON COLUMN "Base_AppSecret"."CreateTime" IS '创建时间';
COMMENT ON COLUMN "Base_AppSecret"."CreatorId" IS '创建人Id';
COMMENT ON COLUMN "Base_AppSecret"."Deleted" IS '否已删除';
COMMENT ON COLUMN "Base_AppSecret"."AppId" IS '应用Id';
COMMENT ON COLUMN "Base_AppSecret"."AppSecret" IS '应用密钥';
COMMENT ON COLUMN "Base_AppSecret"."AppName" IS '应用名';
-- ----------------------------
-- Records of Base_AppSecret
-- ----------------------------
INSERT INTO "Base_AppSecret" VALUES ('1172497995938271232', TO_DATE('2019-09-13 21:11:20', 'YYYY-MM-DD HH24:MI:SS'), 'Admin', '0', 'PcAdmin', 'wtMaiTRPTT3hrf5e', '后台AppId');
INSERT INTO "Base_AppSecret" VALUES ('1173937877642383360', TO_DATE('2019-09-17 20:32:55', 'YYYY-MM-DD HH24:MI:SS'), 'Admin', '0', 'AppAdmin', 'IVh9LLSVFcoQPQ5K', 'APP密钥');
-- ----------------------------
-- Table structure for Base_BuildTest
-- ----------------------------
CREATE TABLE "Base_BuildTest" (
"Id" VARCHAR2(50 CHAR) NOT NULL ,
"CreateTime" DATE NOT NULL ,
"CreatorId" VARCHAR2(50 CHAR) NULL ,
"Deleted" NUMBER(1) DEFAULT 0 NOT NULL ,
"Column1" VARCHAR2(50 CHAR) NULL ,
"Column2" VARCHAR2(50 CHAR) NULL ,
"Column3" VARCHAR2(50 CHAR) NULL ,
"Column4" VARCHAR2(50 CHAR) NULL ,
"Column5" VARCHAR2(50 CHAR) NULL
)
LOGGING
NOCOMPRESS
NOCACHE
;
COMMENT ON TABLE "Base_BuildTest" IS '生成测试表';
COMMENT ON COLUMN "Base_BuildTest"."Id" IS '自然主键';
COMMENT ON COLUMN "Base_BuildTest"."CreateTime" IS '创建时间';
COMMENT ON COLUMN "Base_BuildTest"."CreatorId" IS '创建人Id';
COMMENT ON COLUMN "Base_BuildTest"."Deleted" IS '否已删除';
COMMENT ON COLUMN "Base_BuildTest"."Column1" IS '列1';
COMMENT ON COLUMN "Base_BuildTest"."Column2" IS '列2';
COMMENT ON COLUMN "Base_BuildTest"."Column3" IS '列3';
COMMENT ON COLUMN "Base_BuildTest"."Column4" IS '列4';
COMMENT ON COLUMN "Base_BuildTest"."Column5" IS '列5';
-- ----------------------------
-- Records of Base_BuildTest
-- ----------------------------
-- ----------------------------
-- Table structure for Base_DbLink
-- ----------------------------
CREATE TABLE "Base_DbLink" (
"Id" VARCHAR2(50 CHAR) NOT NULL ,
"CreateTime" DATE NOT NULL ,
"CreatorId" VARCHAR2(50 CHAR) NULL ,
"Deleted" NUMBER(1) DEFAULT 0 NOT NULL ,
"LinkName" VARCHAR2(50 CHAR) NULL ,
"ConnectionStr" VARCHAR2(500 CHAR) NULL ,
"DbType" VARCHAR2(50 CHAR) NULL
)
LOGGING
NOCOMPRESS
NOCACHE
;
COMMENT ON TABLE "Base_DbLink" IS '数据库连接表';
COMMENT ON COLUMN "Base_DbLink"."Id" IS '自然主键';
COMMENT ON COLUMN "Base_DbLink"."CreateTime" IS '创建时间';
COMMENT ON COLUMN "Base_DbLink"."CreatorId" IS '创建人Id';
COMMENT ON COLUMN "Base_DbLink"."Deleted" IS '否已删除';
COMMENT ON COLUMN "Base_DbLink"."LinkName" IS '连接名';
COMMENT ON COLUMN "Base_DbLink"."ConnectionStr" IS '连接字符串';
COMMENT ON COLUMN "Base_DbLink"."DbType" IS '数据库类型';
-- ----------------------------
-- Records of Base_DbLink
-- ----------------------------
INSERT INTO "Base_DbLink" VALUES ('1183373232498020352', TO_DATE('2019-10-13 21:25:39', 'YYYY-MM-DD HH24:MI:SS'), 'Admin', '0', 'BaseDb', 'Data Source=.;Initial Catalog=Colder.Admin.AntdVue;Integrated Security=True', 'SqlServer');
-- ----------------------------
-- Table structure for Base_Department
-- ----------------------------
CREATE TABLE "Base_Department" (
"Id" VARCHAR2(50 CHAR) NOT NULL ,
"CreateTime" DATE NOT NULL ,
"CreatorId" VARCHAR2(50 CHAR) NULL ,
"Deleted" NUMBER DEFAULT 0 NOT NULL ,
"Name" VARCHAR2(50 CHAR) NULL ,
"ParentId" VARCHAR2(50 CHAR) NULL
)
LOGGING
NOCOMPRESS
NOCACHE
;
COMMENT ON TABLE "Base_Department" IS '部门表';
COMMENT ON COLUMN "Base_Department"."Id" IS '主键';
COMMENT ON COLUMN "Base_Department"."CreateTime" IS '创建时间';
COMMENT ON COLUMN "Base_Department"."CreatorId" IS '创建人Id';
COMMENT ON COLUMN "Base_Department"."Deleted" IS '否已删除';
COMMENT ON COLUMN "Base_Department"."Name" IS '部门名';
COMMENT ON COLUMN "Base_Department"."ParentId" IS '上级部门Id';
-- ----------------------------
-- Records of Base_Department
-- ----------------------------
INSERT INTO "Base_Department" VALUES ('1181175685528424448', TO_DATE('2019-10-07 19:53:23', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '宁波分公司', null);
INSERT INTO "Base_Department" VALUES ('1181175803631636480', TO_DATE('2019-10-07 19:53:51', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '鄞州事业部', '1181175685528424448');
INSERT INTO "Base_Department" VALUES ('1181175865409540096', TO_DATE('2019-10-07 19:54:06', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '海曙事业部', '1181175685528424448');
-- ----------------------------
-- Table structure for Base_Role
-- ----------------------------
CREATE TABLE "Base_Role" (
"Id" VARCHAR2(50 CHAR) NOT NULL ,
"CreateTime" DATE NOT NULL ,
"CreatorId" VARCHAR2(50 CHAR) NULL ,
"Deleted" NUMBER(1) DEFAULT 0 NOT NULL ,
"RoleName" NVARCHAR2(50) NULL
)
LOGGING
NOCOMPRESS
NOCACHE
;
COMMENT ON TABLE "Base_Role" IS '系统角色表';
COMMENT ON COLUMN "Base_Role"."Id" IS '主键';
COMMENT ON COLUMN "Base_Role"."CreateTime" IS '创建时间';
COMMENT ON COLUMN "Base_Role"."CreatorId" IS '创建人Id';
COMMENT ON COLUMN "Base_Role"."Deleted" IS '否已删除';
COMMENT ON COLUMN "Base_Role"."RoleName" IS '角色名';
-- ----------------------------
-- Records of Base_Role
-- ----------------------------
INSERT INTO "Base_Role" VALUES ('1180486275199668224', TO_DATE('2019-10-05 22:13:55', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '超级管理员');
INSERT INTO "Base_Role" VALUES ('1180819481383931904', TO_DATE('2019-10-06 20:17:57', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '部门管理员');
-- ----------------------------
-- Table structure for Base_RoleAction
-- ----------------------------
CREATE TABLE "Base_RoleAction" (
"Id" VARCHAR2(50 CHAR) NOT NULL ,
"CreateTime" DATE NOT NULL ,
"CreatorId" VARCHAR2(50 CHAR) NULL ,
"Deleted" NUMBER(1) DEFAULT 0 NOT NULL ,
"RoleId" VARCHAR2(50 CHAR) NULL ,
"ActionId" VARCHAR2(50 CHAR) NULL
)
LOGGING
NOCOMPRESS
NOCACHE
;
COMMENT ON TABLE "Base_RoleAction" IS '角色权限表';
COMMENT ON COLUMN "Base_RoleAction"."Id" IS '主键';
COMMENT ON COLUMN "Base_RoleAction"."CreateTime" IS '创建时间';
COMMENT ON COLUMN "Base_RoleAction"."CreatorId" IS '创建人Id';
COMMENT ON COLUMN "Base_RoleAction"."Deleted" IS '否已删除';
COMMENT ON COLUMN "Base_RoleAction"."RoleId" IS '用户Id';
COMMENT ON COLUMN "Base_RoleAction"."ActionId" IS '权限Id';
-- ----------------------------
-- Records of Base_RoleAction
-- ----------------------------
INSERT INTO "Base_RoleAction" VALUES ('1188801984434540544', TO_DATE('2019-10-28 20:57:34', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180819481383931904', '1188044797802188800');
INSERT INTO "Base_RoleAction" VALUES ('1188801984434540545', TO_DATE('2019-10-28 20:57:34', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180819481383931904', '1188044797802188801');
INSERT INTO "Base_RoleAction" VALUES ('1188801984434540546', TO_DATE('2019-10-28 20:57:34', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180819481383931904', '1182652433302556672');
INSERT INTO "Base_RoleAction" VALUES ('1188801984434540547', TO_DATE('2019-10-28 20:57:34', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180819481383931904', '1178957405992521728');
INSERT INTO "Base_RoleAction" VALUES ('1188801984434540548', TO_DATE('2019-10-28 20:57:34', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180819481383931904', '1188801109783744512');
INSERT INTO "Base_RoleAction" VALUES ('1188801984434540549', TO_DATE('2019-10-28 20:57:34', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180819481383931904', '1188801109783744513');
INSERT INTO "Base_RoleAction" VALUES ('1188801984434540550', TO_DATE('2019-10-28 20:57:34', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180819481383931904', '1188801109783744514');
INSERT INTO "Base_RoleAction" VALUES ('1188801984434540551', TO_DATE('2019-10-28 20:57:34', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180819481383931904', '1182652266117599232');
INSERT INTO "Base_RoleAction" VALUES ('1188801984434540552', TO_DATE('2019-10-28 20:57:34', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180819481383931904', '1188800845714558976');
INSERT INTO "Base_RoleAction" VALUES ('1188801984434540553', TO_DATE('2019-10-28 20:57:34', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180819481383931904', '1188800845714558977');
INSERT INTO "Base_RoleAction" VALUES ('1188801984434540554', TO_DATE('2019-10-28 20:57:34', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180819481383931904', '1188800845714558978');
INSERT INTO "Base_RoleAction" VALUES ('1188801984434540555', TO_DATE('2019-10-28 20:57:34', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180819481383931904', '1182652367447789568');
INSERT INTO "Base_RoleAction" VALUES ('1188801984434540556', TO_DATE('2019-10-28 20:57:34', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180819481383931904', '1188801057778569216');
INSERT INTO "Base_RoleAction" VALUES ('1188801984434540557', TO_DATE('2019-10-28 20:57:34', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180819481383931904', '1188801057778569217');
INSERT INTO "Base_RoleAction" VALUES ('1188801984434540558', TO_DATE('2019-10-28 20:57:34', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180819481383931904', '1188801057778569218');
INSERT INTO "Base_RoleAction" VALUES ('1251784960050728962', TO_DATE('2020-04-19 16:09:26', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180486275199668224', '1179018395304071168');
INSERT INTO "Base_RoleAction" VALUES ('1251784960050728990', TO_DATE('2020-04-19 16:09:26', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180486275199668224', '1179018395304071168');
INSERT INTO "Base_RoleAction" VALUES ('1251784960050728991', TO_DATE('2020-04-19 16:09:26', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180486275199668224', '1182652266117599232');
INSERT INTO "Base_RoleAction" VALUES ('1251784960050728992', TO_DATE('2020-04-19 16:09:26', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180486275199668224', '1182652367447789568');
INSERT INTO "Base_RoleAction" VALUES ('1251784960050728993', TO_DATE('2020-04-19 16:09:26', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180486275199668224', '1182652433302556672');
INSERT INTO "Base_RoleAction" VALUES ('1251784960050728994', TO_DATE('2020-04-19 16:09:26', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180486275199668224', '1182652599069839360');
INSERT INTO "Base_RoleAction" VALUES ('1251784960050728995', TO_DATE('2020-04-19 16:09:26', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180486275199668224', '1188800845714558976');
INSERT INTO "Base_RoleAction" VALUES ('1251784960050728996', TO_DATE('2020-04-19 16:09:26', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180486275199668224', '1188800845714558977');
INSERT INTO "Base_RoleAction" VALUES ('1251784960050728997', TO_DATE('2020-04-19 16:09:26', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180486275199668224', '1188800845714558978');
INSERT INTO "Base_RoleAction" VALUES ('1251784960050728998', TO_DATE('2020-04-19 16:09:26', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180486275199668224', '1188801057778569216');
INSERT INTO "Base_RoleAction" VALUES ('1251784960050728999', TO_DATE('2020-04-19 16:09:26', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180486275199668224', '1188801057778569217');
INSERT INTO "Base_RoleAction" VALUES ('1251784960050729000', TO_DATE('2020-04-19 16:09:26', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180486275199668224', '1188801057778569218');
INSERT INTO "Base_RoleAction" VALUES ('1251784960050728989', TO_DATE('2020-04-19 16:09:26', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180486275199668224', '1178957553778823168');
INSERT INTO "Base_RoleAction" VALUES ('1251784960050729001', TO_DATE('2020-04-19 16:09:26', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180486275199668224', '1188801109783744512');
INSERT INTO "Base_RoleAction" VALUES ('1251784960050729003', TO_DATE('2020-04-19 16:09:26', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180486275199668224', '1188801109783744514');
INSERT INTO "Base_RoleAction" VALUES ('1251784960050729004', TO_DATE('2020-04-19 16:09:26', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180486275199668224', '1188801273885888512');
INSERT INTO "Base_RoleAction" VALUES ('1251784960050729005', TO_DATE('2020-04-19 16:09:26', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180486275199668224', '1188801273885888513');
INSERT INTO "Base_RoleAction" VALUES ('1251784960050729006', TO_DATE('2020-04-19 16:09:26', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180486275199668224', '1188801273885888514');
INSERT INTO "Base_RoleAction" VALUES ('1251784960050729007', TO_DATE('2020-04-19 16:09:26', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180486275199668224', '1188801341661646848');
INSERT INTO "Base_RoleAction" VALUES ('1251784960050729008', TO_DATE('2020-04-19 16:09:26', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180486275199668224', '1188801341661646849');
INSERT INTO "Base_RoleAction" VALUES ('1251784960050729009', TO_DATE('2020-04-19 16:09:26', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180486275199668224', '1188801341661646850');
INSERT INTO "Base_RoleAction" VALUES ('1251784960050729010', TO_DATE('2020-04-19 16:09:26', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180486275199668224', '1193158266167758848');
INSERT INTO "Base_RoleAction" VALUES ('1251784960050729011', TO_DATE('2020-04-19 16:09:26', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180486275199668224', '1193158630615027712');
INSERT INTO "Base_RoleAction" VALUES ('1251784960050729012', TO_DATE('2020-04-19 16:09:26', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180486275199668224', '1193158780011941888');
INSERT INTO "Base_RoleAction" VALUES ('1251784960050729013', TO_DATE('2020-04-19 16:09:26', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180486275199668224', '1193527101521661952');
INSERT INTO "Base_RoleAction" VALUES ('1251784960050729002', TO_DATE('2020-04-19 16:09:26', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180486275199668224', '1188801109783744513');
INSERT INTO "Base_RoleAction" VALUES ('1251784960050728988', TO_DATE('2020-04-19 16:09:26', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180486275199668224', '1178957405992521728');
INSERT INTO "Base_RoleAction" VALUES ('1251784960050728987', TO_DATE('2020-04-19 16:09:26', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180486275199668224', '1193527101521661954');
INSERT INTO "Base_RoleAction" VALUES ('1251784960050728986', TO_DATE('2020-04-19 16:09:26', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180486275199668224', '1193527101521661953');
INSERT INTO "Base_RoleAction" VALUES ('1251784960050728961', TO_DATE('2020-04-19 16:09:26', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180486275199668224', '1178957553778823168');
INSERT INTO "Base_RoleAction" VALUES ('1251784960050728960', TO_DATE('2020-04-19 16:09:26', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180486275199668224', '1178957405992521728');
INSERT INTO "Base_RoleAction" VALUES ('1251784960050728963', TO_DATE('2020-04-19 16:09:26', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180486275199668224', '1182652266117599232');
INSERT INTO "Base_RoleAction" VALUES ('1251784960050728964', TO_DATE('2020-04-19 16:09:26', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180486275199668224', '1182652367447789568');
INSERT INTO "Base_RoleAction" VALUES ('1251784960050728965', TO_DATE('2020-04-19 16:09:26', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180486275199668224', '1182652433302556672');
INSERT INTO "Base_RoleAction" VALUES ('1251784960050728966', TO_DATE('2020-04-19 16:09:26', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180486275199668224', '1182652599069839360');
INSERT INTO "Base_RoleAction" VALUES ('1251784960050728967', TO_DATE('2020-04-19 16:09:26', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180486275199668224', '1188800845714558976');
INSERT INTO "Base_RoleAction" VALUES ('1251784960050728968', TO_DATE('2020-04-19 16:09:26', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180486275199668224', '1188800845714558977');
INSERT INTO "Base_RoleAction" VALUES ('1251784960050728969', TO_DATE('2020-04-19 16:09:26', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180486275199668224', '1188800845714558978');
INSERT INTO "Base_RoleAction" VALUES ('1251784960050728970', TO_DATE('2020-04-19 16:09:26', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180486275199668224', '1188801057778569216');
INSERT INTO "Base_RoleAction" VALUES ('1251784960050728971', TO_DATE('2020-04-19 16:09:26', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180486275199668224', '1188801057778569217');
INSERT INTO "Base_RoleAction" VALUES ('1251784960050728972', TO_DATE('2020-04-19 16:09:26', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180486275199668224', '1188801057778569218');
INSERT INTO "Base_RoleAction" VALUES ('1251784960050728973', TO_DATE('2020-04-19 16:09:26', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180486275199668224', '1188801109783744512');
INSERT INTO "Base_RoleAction" VALUES ('1251784960050728974', TO_DATE('2020-04-19 16:09:26', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180486275199668224', '1188801109783744513');
INSERT INTO "Base_RoleAction" VALUES ('1251784960050728975', TO_DATE('2020-04-19 16:09:26', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180486275199668224', '1188801109783744514');
INSERT INTO "Base_RoleAction" VALUES ('1251784960050728976', TO_DATE('2020-04-19 16:09:26', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180486275199668224', '1188801273885888512');
INSERT INTO "Base_RoleAction" VALUES ('1251784960050728977', TO_DATE('2020-04-19 16:09:26', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180486275199668224', '1188801273885888513');
INSERT INTO "Base_RoleAction" VALUES ('1251784960050728978', TO_DATE('2020-04-19 16:09:26', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180486275199668224', '1188801273885888514');
INSERT INTO "Base_RoleAction" VALUES ('1251784960050728979', TO_DATE('2020-04-19 16:09:26', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180486275199668224', '1188801341661646848');
INSERT INTO "Base_RoleAction" VALUES ('1251784960050728980', TO_DATE('2020-04-19 16:09:26', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180486275199668224', '1188801341661646849');
INSERT INTO "Base_RoleAction" VALUES ('1251784960050728981', TO_DATE('2020-04-19 16:09:26', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180486275199668224', '1188801341661646850');
INSERT INTO "Base_RoleAction" VALUES ('1251784960050728982', TO_DATE('2020-04-19 16:09:26', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180486275199668224', '1193158266167758848');
INSERT INTO "Base_RoleAction" VALUES ('1251784960050728983', TO_DATE('2020-04-19 16:09:26', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180486275199668224', '1193158630615027712');
INSERT INTO "Base_RoleAction" VALUES ('1251784960050728984', TO_DATE('2020-04-19 16:09:26', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180486275199668224', '1193158780011941888');
INSERT INTO "Base_RoleAction" VALUES ('1251784960050728985', TO_DATE('2020-04-19 16:09:26', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180486275199668224', '1193527101521661952');
INSERT INTO "Base_RoleAction" VALUES ('1251784960050729014', TO_DATE('2020-04-19 16:09:26', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180486275199668224', '1193527101521661953');
INSERT INTO "Base_RoleAction" VALUES ('1251784960050729015', TO_DATE('2020-04-19 16:09:26', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1180486275199668224', '1193527101521661954');
-- ----------------------------
-- Table structure for Base_User
-- ----------------------------
CREATE TABLE "Base_User" (
"Id" VARCHAR2(50 CHAR) NOT NULL ,
"CreateTime" DATE NOT NULL ,
"CreatorId" VARCHAR2(50 CHAR) NULL ,
"Deleted" NUMBER(1) DEFAULT 0 NOT NULL ,
"UserName" VARCHAR2(50 CHAR) NULL ,
"Password" VARCHAR2(50 CHAR) NULL ,
"RealName" NVARCHAR2(50) NULL ,
"Sex" NUMBER(11) NOT NULL ,
"Birthday" DATE NULL ,
"DepartmentId" VARCHAR2(50 CHAR) NULL
)
LOGGING
NOCOMPRESS
NOCACHE
;
COMMENT ON TABLE "Base_User" IS '系统用户表';
COMMENT ON COLUMN "Base_User"."Id" IS '主键';
COMMENT ON COLUMN "Base_User"."CreateTime" IS '创建时间';
COMMENT ON COLUMN "Base_User"."CreatorId" IS '创建人Id';
COMMENT ON COLUMN "Base_User"."Deleted" IS '否已删除';
COMMENT ON COLUMN "Base_User"."UserName" IS '用户名';
COMMENT ON COLUMN "Base_User"."Password" IS '密码';
COMMENT ON COLUMN "Base_User"."RealName" IS '姓名';
COMMENT ON COLUMN "Base_User"."Sex" IS '性别(1为男,0为女)';
COMMENT ON COLUMN "Base_User"."Birthday" IS '出生日期';
COMMENT ON COLUMN "Base_User"."DepartmentId" IS '所属部门Id';
-- ----------------------------
-- Records of Base_User
-- ----------------------------
INSERT INTO "Base_User" VALUES ('1181928860648738816', TO_DATE('2019-10-09 21:46:14', 'YYYY-MM-DD HH24:MI:SS'), null, '0', 'xiaohua', 'e10adc3949ba59abbe56e057f20f883e', '小花', '0', null, null);
INSERT INTO "Base_User" VALUES ('Admin', TO_DATE('2019-09-13 21:10:03', 'YYYY-MM-DD HH24:MI:SS'), 'Admin', '0', 'Admin', 'e10adc3949ba59abbe56e057f20f883e', '超级管理员', '1', TO_DATE('2019-09-13 00:00:00', 'YYYY-MM-DD HH24:MI:SS'), null);
-- ----------------------------
-- Table structure for Base_UserLog
-- ----------------------------
CREATE TABLE "Base_UserLog" (
"Id" VARCHAR2(50 CHAR) NOT NULL ,
"CreateTime" DATE NOT NULL ,
"CreatorId" VARCHAR2(50 CHAR) NULL ,
"CreatorRealName" NVARCHAR2(50) NULL ,
"LogType" VARCHAR2(50 CHAR) NULL ,
"LogContent" CLOB NULL
)
LOGGING
NOCOMPRESS
NOCACHE
;
COMMENT ON TABLE "Base_UserLog" IS '系统日志表';
COMMENT ON COLUMN "Base_UserLog"."Id" IS '自然主键';
COMMENT ON COLUMN "Base_UserLog"."CreateTime" IS '创建时间';
COMMENT ON COLUMN "Base_UserLog"."CreatorId" IS '创建人Id';
COMMENT ON COLUMN "Base_UserLog"."CreatorRealName" IS '创建人姓名';
COMMENT ON COLUMN "Base_UserLog"."LogType" IS '日志类型';
COMMENT ON COLUMN "Base_UserLog"."LogContent" IS '日志内容';
-- ----------------------------
-- Records of Base_UserLog
-- ----------------------------
-- ----------------------------
-- Table structure for Base_UserRole
-- ----------------------------
CREATE TABLE "Base_UserRole" (
"Id" VARCHAR2(50 CHAR) NOT NULL ,
"CreateTime" DATE NOT NULL ,
"CreatorId" VARCHAR2(50 CHAR) NULL ,
"Deleted" NUMBER(1) DEFAULT 0 NOT NULL ,
"UserId" VARCHAR2(50 CHAR) NULL ,
"RoleId" VARCHAR2(50 CHAR) NULL
)
LOGGING
NOCOMPRESS
NOCACHE
;
COMMENT ON TABLE "Base_UserRole" IS '用户角色表';
COMMENT ON COLUMN "Base_UserRole"."Id" IS '主键';
COMMENT ON COLUMN "Base_UserRole"."CreateTime" IS '创建时间';
COMMENT ON COLUMN "Base_UserRole"."CreatorId" IS '创建人Id';
COMMENT ON COLUMN "Base_UserRole"."Deleted" IS '否已删除';
COMMENT ON COLUMN "Base_UserRole"."UserId" IS '用户Id';
COMMENT ON COLUMN "Base_UserRole"."RoleId" IS '角色Id';
-- ----------------------------
-- Records of Base_UserRole
-- ----------------------------
INSERT INTO "Base_UserRole" VALUES ('1181927367719784448', TO_DATE('2019-10-09 21:40:18', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1181922344629702656', '1180819481383931904');
INSERT INTO "Base_UserRole" VALUES ('1181927367719784449', TO_DATE('2019-10-09 21:40:18', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1181922344629702656', '1180486275199668224');
INSERT INTO "Base_UserRole" VALUES ('1181927783786352640', TO_DATE('2019-10-09 21:41:57', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1181927783727632384', '1180819481383931904');
INSERT INTO "Base_UserRole" VALUES ('1251784944565358592', TO_DATE('2020-04-19 16:09:22', 'YYYY-MM-DD HH24:MI:SS'), null, '0', '1181928860648738816', '1180819481383931904');
-- ----------------------------
-- Indexes structure for table Base_Action
-- ----------------------------
-- ----------------------------
-- Checks structure for table Base_Action
-- ----------------------------
ALTER TABLE "Base_Action" ADD CHECK ("Id" IS NOT NULL);
ALTER TABLE "Base_Action" ADD CHECK ("CreateTime" IS NOT NULL);
ALTER TABLE "Base_Action" ADD CHECK ("Deleted" IS NOT NULL);
ALTER TABLE "Base_Action" ADD CHECK ("Type" IS NOT NULL);
ALTER TABLE "Base_Action" ADD CHECK ("NeedAction" IS NOT NULL);
ALTER TABLE "Base_Action" ADD CHECK ("Sort" IS NOT NULL);
ALTER TABLE "Base_Action" ADD CHECK ("Id" IS NOT NULL);
ALTER TABLE "Base_Action" ADD CHECK ("CreateTime" IS NOT NULL);
ALTER TABLE "Base_Action" ADD CHECK ("Deleted" IS NOT NULL);
ALTER TABLE "Base_Action" ADD CHECK ("Type" IS NOT NULL);
ALTER TABLE "Base_Action" ADD CHECK ("NeedAction" IS NOT NULL);
ALTER TABLE "Base_Action" ADD CHECK ("Sort" IS NOT NULL);
ALTER TABLE "Base_Action" ADD CHECK ("Id" IS NOT NULL);
ALTER TABLE "Base_Action" ADD CHECK ("CreateTime" IS NOT NULL);
ALTER TABLE "Base_Action" ADD CHECK ("Deleted" IS NOT NULL);
ALTER TABLE "Base_Action" ADD CHECK ("Type" IS NOT NULL);
ALTER TABLE "Base_Action" ADD CHECK ("NeedAction" IS NOT NULL);
ALTER TABLE "Base_Action" ADD CHECK ("Sort" IS NOT NULL);
ALTER TABLE "Base_Action" ADD CHECK ("Id" IS NOT NULL);
ALTER TABLE "Base_Action" ADD CHECK ("CreateTime" IS NOT NULL);
ALTER TABLE "Base_Action" ADD CHECK ("Deleted" IS NOT NULL);
ALTER TABLE "Base_Action" ADD CHECK ("Type" IS NOT NULL);
ALTER TABLE "Base_Action" ADD CHECK ("NeedAction" IS NOT NULL);
ALTER TABLE "Base_Action" ADD CHECK ("Sort" IS NOT NULL);
-- ----------------------------
-- Primary Key structure for table Base_Action
-- ----------------------------
ALTER TABLE "Base_Action" ADD PRIMARY KEY ("Id");
-- ----------------------------
-- Indexes structure for table Base_AppSecret
-- ----------------------------
-- ----------------------------
-- Checks structure for table Base_AppSecret
-- ----------------------------
ALTER TABLE "Base_AppSecret" ADD CHECK ("Id" IS NOT NULL);
ALTER TABLE "Base_AppSecret" ADD CHECK ("CreateTime" IS NOT NULL);
ALTER TABLE "Base_AppSecret" ADD CHECK ("Deleted" IS NOT NULL);
ALTER TABLE "Base_AppSecret" ADD CHECK ("Id" IS NOT NULL);
ALTER TABLE "Base_AppSecret" ADD CHECK ("CreateTime" IS NOT NULL);
ALTER TABLE "Base_AppSecret" ADD CHECK ("Deleted" IS NOT NULL);
ALTER TABLE "Base_AppSecret" ADD CHECK ("Id" IS NOT NULL);
ALTER TABLE "Base_AppSecret" ADD CHECK ("CreateTime" IS NOT NULL);
ALTER TABLE "Base_AppSecret" ADD CHECK ("Deleted" IS NOT NULL);
ALTER TABLE "Base_AppSecret" ADD CHECK ("Id" IS NOT NULL);
ALTER TABLE "Base_AppSecret" ADD CHECK ("CreateTime" IS NOT NULL);
ALTER TABLE "Base_AppSecret" ADD CHECK ("Deleted" IS NOT NULL);
-- ----------------------------
-- Primary Key structure for table Base_AppSecret
-- ----------------------------
ALTER TABLE "Base_AppSecret" ADD PRIMARY KEY ("Id");
-- ----------------------------
-- Indexes structure for table Base_BuildTest
-- ----------------------------
-- ----------------------------
-- Checks structure for table Base_BuildTest
-- ----------------------------
ALTER TABLE "Base_BuildTest" ADD CHECK ("Id" IS NOT NULL);
ALTER TABLE "Base_BuildTest" ADD CHECK ("CreateTime" IS NOT NULL);
ALTER TABLE "Base_BuildTest" ADD CHECK ("Deleted" IS NOT NULL);
ALTER TABLE "Base_BuildTest" ADD CHECK ("Id" IS NOT NULL);
ALTER TABLE "Base_BuildTest" ADD CHECK ("CreateTime" IS NOT NULL);
ALTER TABLE "Base_BuildTest" ADD CHECK ("Deleted" IS NOT NULL);
ALTER TABLE "Base_BuildTest" ADD CHECK ("Id" IS NOT NULL);
ALTER TABLE "Base_BuildTest" ADD CHECK ("CreateTime" IS NOT NULL);
ALTER TABLE "Base_BuildTest" ADD CHECK ("Deleted" IS NOT NULL);
ALTER TABLE "Base_BuildTest" ADD CHECK ("Id" IS NOT NULL);
ALTER TABLE "Base_BuildTest" ADD CHECK ("CreateTime" IS NOT NULL);
ALTER TABLE "Base_BuildTest" ADD CHECK ("Deleted" IS NOT NULL);
-- ----------------------------
-- Primary Key structure for table Base_BuildTest
-- ----------------------------
ALTER TABLE "Base_BuildTest" ADD PRIMARY KEY ("Id");
-- ----------------------------
-- Indexes structure for table Base_DbLink
-- ----------------------------
-- ----------------------------
-- Checks structure for table Base_DbLink
-- ----------------------------
ALTER TABLE "Base_DbLink" ADD CHECK ("Id" IS NOT NULL);
ALTER TABLE "Base_DbLink" ADD CHECK ("CreateTime" IS NOT NULL);
ALTER TABLE "Base_DbLink" ADD CHECK ("Deleted" IS NOT NULL);
ALTER TABLE "Base_DbLink" ADD CHECK ("Id" IS NOT NULL);
ALTER TABLE "Base_DbLink" ADD CHECK ("CreateTime" IS NOT NULL);
ALTER TABLE "Base_DbLink" ADD CHECK ("Deleted" IS NOT NULL);
ALTER TABLE "Base_DbLink" ADD CHECK ("Id" IS NOT NULL);
ALTER TABLE "Base_DbLink" ADD CHECK ("CreateTime" IS NOT NULL);
ALTER TABLE "Base_DbLink" ADD CHECK ("Deleted" IS NOT NULL);
ALTER TABLE "Base_DbLink" ADD CHECK ("Id" IS NOT NULL);
ALTER TABLE "Base_DbLink" ADD CHECK ("CreateTime" IS NOT NULL);
ALTER TABLE "Base_DbLink" ADD CHECK ("Deleted" IS NOT NULL);
-- ----------------------------
-- Primary Key structure for table Base_DbLink
-- ----------------------------
ALTER TABLE "Base_DbLink" ADD PRIMARY KEY ("Id");
-- ----------------------------
-- Indexes structure for table Base_Department
-- ----------------------------
-- ----------------------------
-- Checks structure for table Base_Department
-- ----------------------------
ALTER TABLE "Base_Department" ADD CHECK ("Id" IS NOT NULL);
ALTER TABLE "Base_Department" ADD CHECK ("CreateTime" IS NOT NULL);
ALTER TABLE "Base_Department" ADD CHECK ("Deleted" IS NOT NULL);
ALTER TABLE "Base_Department" ADD CHECK ("Id" IS NOT NULL);
ALTER TABLE "Base_Department" ADD CHECK ("CreateTime" IS NOT NULL);
ALTER TABLE "Base_Department" ADD CHECK ("Deleted" IS NOT NULL);
ALTER TABLE "Base_Department" ADD CHECK ("Id" IS NOT NULL);
ALTER TABLE "Base_Department" ADD CHECK ("CreateTime" IS NOT NULL);
ALTER TABLE "Base_Department" ADD CHECK ("Deleted" IS NOT NULL);
ALTER TABLE "Base_Department" ADD CHECK ("Id" IS NOT NULL);
ALTER TABLE "Base_Department" ADD CHECK ("CreateTime" IS NOT NULL);
ALTER TABLE "Base_Department" ADD CHECK ("Deleted" IS NOT NULL);
-- ----------------------------
-- Primary Key structure for table Base_Department
-- ----------------------------
ALTER TABLE "Base_Department" ADD PRIMARY KEY ("Id");
-- ----------------------------
-- Indexes structure for table Base_Role
-- ----------------------------
-- ----------------------------
-- Checks structure for table Base_Role
-- ----------------------------
ALTER TABLE "Base_Role" ADD CHECK ("Id" IS NOT NULL);
ALTER TABLE "Base_Role" ADD CHECK ("CreateTime" IS NOT NULL);
ALTER TABLE "Base_Role" ADD CHECK ("Deleted" IS NOT NULL);
ALTER TABLE "Base_Role" ADD CHECK ("Id" IS NOT NULL);
ALTER TABLE "Base_Role" ADD CHECK ("CreateTime" IS NOT NULL);
ALTER TABLE "Base_Role" ADD CHECK ("Deleted" IS NOT NULL);
ALTER TABLE "Base_Role" ADD CHECK ("Id" IS NOT NULL);
ALTER TABLE "Base_Role" ADD CHECK ("CreateTime" IS NOT NULL);
ALTER TABLE "Base_Role" ADD CHECK ("Deleted" IS NOT NULL);
ALTER TABLE "Base_Role" ADD CHECK ("Id" IS NOT NULL);
ALTER TABLE "Base_Role" ADD CHECK ("CreateTime" IS NOT NULL);
ALTER TABLE "Base_Role" ADD CHECK ("Deleted" IS NOT NULL);
-- ----------------------------
-- Primary Key structure for table Base_Role
-- ----------------------------
ALTER TABLE "Base_Role" ADD PRIMARY KEY ("Id");
-- ----------------------------
-- Checks structure for table Base_RoleAction
-- ----------------------------
ALTER TABLE "Base_RoleAction" ADD CHECK ("Id" IS NOT NULL);
ALTER TABLE "Base_RoleAction" ADD CHECK ("CreateTime" IS NOT NULL);
ALTER TABLE "Base_RoleAction" ADD CHECK ("Deleted" IS NOT NULL);
ALTER TABLE "Base_RoleAction" ADD CHECK ("Id" IS NOT NULL);
ALTER TABLE "Base_RoleAction" ADD CHECK ("CreateTime" IS NOT NULL);
ALTER TABLE "Base_RoleAction" ADD CHECK ("Deleted" IS NOT NULL);
ALTER TABLE "Base_RoleAction" ADD CHECK ("Id" IS NOT NULL);
ALTER TABLE "Base_RoleAction" ADD CHECK ("CreateTime" IS NOT NULL);
ALTER TABLE "Base_RoleAction" ADD CHECK ("Deleted" IS NOT NULL);
ALTER TABLE "Base_RoleAction" ADD CHECK ("Id" IS NOT NULL);
ALTER TABLE "Base_RoleAction" ADD CHECK ("CreateTime" IS NOT NULL);
ALTER TABLE "Base_RoleAction" ADD CHECK ("Deleted" IS NOT NULL);
-- ----------------------------
-- Checks structure for table Base_User
-- ----------------------------
ALTER TABLE "Base_User" ADD CHECK ("Id" IS NOT NULL);
ALTER TABLE "Base_User" ADD CHECK ("CreateTime" IS NOT NULL);
ALTER TABLE "Base_User" ADD CHECK ("Deleted" IS NOT NULL);
ALTER TABLE "Base_User" ADD CHECK ("Sex" IS NOT NULL);
ALTER TABLE "Base_User" ADD CHECK ("Id" IS NOT NULL);
ALTER TABLE "Base_User" ADD CHECK ("CreateTime" IS NOT NULL);
ALTER TABLE "Base_User" ADD CHECK ("Deleted" IS NOT NULL);
ALTER TABLE "Base_User" ADD CHECK ("Sex" IS NOT NULL);
ALTER TABLE "Base_User" ADD CHECK ("Id" IS NOT NULL);
ALTER TABLE "Base_User" ADD CHECK ("CreateTime" IS NOT NULL);
ALTER TABLE "Base_User" ADD CHECK ("Deleted" IS NOT NULL);
ALTER TABLE "Base_User" ADD CHECK ("Sex" IS NOT NULL);
ALTER TABLE "Base_User" ADD CHECK ("Id" IS NOT NULL);
ALTER TABLE "Base_User" ADD CHECK ("CreateTime" IS NOT NULL);
ALTER TABLE "Base_User" ADD CHECK ("Deleted" IS NOT NULL);
ALTER TABLE "Base_User" ADD CHECK ("Sex" IS NOT NULL);
-- ----------------------------
-- Indexes structure for table Base_UserLog
-- ----------------------------
-- ----------------------------
-- Checks structure for table Base_UserLog
-- ----------------------------
ALTER TABLE "Base_UserLog" ADD CHECK ("Id" IS NOT NULL);
ALTER TABLE "Base_UserLog" ADD CHECK ("CreateTime" IS NOT NULL);
ALTER TABLE "Base_UserLog" ADD CHECK ("Id" IS NOT NULL);
ALTER TABLE "Base_UserLog" ADD CHECK ("CreateTime" IS NOT NULL);
ALTER TABLE "Base_UserLog" ADD CHECK ("Id" IS NOT NULL);
ALTER TABLE "Base_UserLog" ADD CHECK ("CreateTime" IS NOT NULL);
ALTER TABLE "Base_UserLog" ADD CHECK ("Id" IS NOT NULL);
ALTER TABLE "Base_UserLog" ADD CHECK ("CreateTime" IS NOT NULL);
ALTER TABLE "Base_UserLog" ADD CHECK ("Id" IS NOT NULL);
ALTER TABLE "Base_UserLog" ADD CHECK ("CreateTime" IS NOT NULL);
-- ----------------------------
-- Primary Key structure for table Base_UserLog
-- ----------------------------
ALTER TABLE "Base_UserLog" ADD PRIMARY KEY ("Id");
-- ----------------------------
-- Checks structure for table Base_UserRole
-- ----------------------------
ALTER TABLE "Base_UserRole" ADD CHECK ("Id" IS NOT NULL);
ALTER TABLE "Base_UserRole" ADD CHECK ("CreateTime" IS NOT NULL);
ALTER TABLE "Base_UserRole" ADD CHECK ("Deleted" IS NOT NULL);
ALTER TABLE "Base_UserRole" ADD CHECK ("Id" IS NOT NULL);
ALTER TABLE "Base_UserRole" ADD CHECK ("CreateTime" IS NOT NULL);
ALTER TABLE "Base_UserRole" ADD CHECK ("Deleted" IS NOT NULL);
ALTER TABLE "Base_UserRole" ADD CHECK ("Id" IS NOT NULL);
ALTER TABLE "Base_UserRole" ADD CHECK ("CreateTime" IS NOT NULL);
ALTER TABLE "Base_UserRole" ADD CHECK ("Deleted" IS NOT NULL);
ALTER TABLE "Base_UserRole" ADD CHECK ("Id" IS NOT NULL);
ALTER TABLE "Base_UserRole" ADD CHECK ("CreateTime" IS NOT NULL);
ALTER TABLE "Base_UserRole" ADD CHECK ("Deleted" IS NOT NULL);

331
docs/初始化文件/PostgreSQL.sql

@ -0,0 +1,331 @@
/*
Navicat Premium Data Transfer
Source Server : 192.168.56.103
Source Server Type : PostgreSQL
Source Server Version : 120003
Source Host : 192.168.56.103:9999
Source Catalog : Colder.Admin.AntdVue
Source Schema : public
Target Server Type : PostgreSQL
Target Server Version : 120003
File Encoding : 65001
Date: 14/06/2020 22:06:21
*/
-- ----------------------------
-- Table structure for Base_Action
-- ----------------------------
CREATE TABLE "Base_Action" (
"Id" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
"CreateTime" timestamp(6) NOT NULL,
"CreatorId" varchar(50) COLLATE "pg_catalog"."default",
"Deleted" bool NOT NULL DEFAULT false,
"ParentId" varchar(50) COLLATE "pg_catalog"."default",
"Type" int4 NOT NULL DEFAULT 0,
"Name" varchar(50) COLLATE "pg_catalog"."default",
"Url" varchar(500) COLLATE "pg_catalog"."default",
"Value" varchar(50) COLLATE "pg_catalog"."default",
"NeedAction" bool NOT NULL DEFAULT false,
"Icon" varchar(50) COLLATE "pg_catalog"."default",
"Sort" int4 NOT NULL DEFAULT 0
)
;
-- ----------------------------
-- Records of Base_Action
-- ----------------------------
BEGIN;
INSERT INTO "Base_Action" VALUES ('1178957405992521728', '2019-10-01 16:58:44', NULL, 'f', NULL, 0, '系统管理', '', NULL, 't', 'setting', 1);
INSERT INTO "Base_Action" VALUES ('1178957553778823168', '2019-10-01 16:59:19', NULL, 'f', '1178957405992521728', 1, '权限管理', '/Base_Manage/Base_Action/List', NULL, 't', NULL, 20);
INSERT INTO "Base_Action" VALUES ('1179018395304071168', '2019-10-01 21:01:05', NULL, 'f', '1178957405992521728', 1, '密钥管理', '/Base_Manage/Base_AppSecret/List', NULL, 't', NULL, 15);
INSERT INTO "Base_Action" VALUES ('1182652367447789568', '2019-10-11 21:41:11', NULL, 'f', '1178957405992521728', 1, '角色管理', '/Base_Manage/Base_Role/List', NULL, 't', NULL, 5);
INSERT INTO "Base_Action" VALUES ('1182652433302556672', '2019-10-11 21:41:27', NULL, 'f', '1178957405992521728', 1, '部门管理', '/Base_Manage/Base_Department/List', NULL, 't', NULL, 10);
INSERT INTO "Base_Action" VALUES ('1188801057778569216', '2019-10-28 20:53:53.687', NULL, 'f', '1182652367447789568', 2, '', NULL, 'Base_Role.Add', 't', NULL, 0);
INSERT INTO "Base_Action" VALUES ('1188801057778569217', '2019-10-28 20:53:53.687', NULL, 'f', '1182652367447789568', 2, '', NULL, 'Base_Role.Edit', 't', NULL, 0);
INSERT INTO "Base_Action" VALUES ('1188801057778569218', '2019-10-28 20:53:53.687', NULL, 'f', '1182652367447789568', 2, '', NULL, 'Base_Role.Delete', 't', NULL, 0);
INSERT INTO "Base_Action" VALUES ('1188801109783744512', '2019-10-28 20:54:06.087', NULL, 'f', '1182652433302556672', 2, '', NULL, 'Base_Department.Add', 't', NULL, 0);
INSERT INTO "Base_Action" VALUES ('1188801109783744513', '2019-10-28 20:54:06.087', NULL, 'f', '1182652433302556672', 2, '', NULL, 'Base_Department.Edit', 't', NULL, 0);
INSERT INTO "Base_Action" VALUES ('1188801109783744514', '2019-10-28 20:54:06.087', NULL, 'f', '1182652433302556672', 2, '', NULL, 'Base_Department.Delete', 't', NULL, 0);
INSERT INTO "Base_Action" VALUES ('1188801273885888512', '2019-10-28 20:54:45.213', NULL, 'f', '1179018395304071168', 2, '', NULL, 'Base_AppSecret.Add', 't', NULL, 0);
INSERT INTO "Base_Action" VALUES ('1188801273885888513', '2019-10-28 20:54:45.213', NULL, 'f', '1179018395304071168', 2, '', NULL, 'Base_AppSecret.Edit', 't', NULL, 0);
INSERT INTO "Base_Action" VALUES ('1188801273885888514', '2019-10-28 20:54:45.213', NULL, 'f', '1179018395304071168', 2, '', NULL, 'Base_AppSecret.Delete', 't', NULL, 0);
INSERT INTO "Base_Action" VALUES ('1188801341661646848', '2019-10-28 20:55:01.37', NULL, 'f', '1178957553778823168', 2, '', NULL, 'Base_Action.Add', 't', NULL, 0);
INSERT INTO "Base_Action" VALUES ('1188801341661646849', '2019-10-28 20:55:01.37', NULL, 'f', '1178957553778823168', 2, '', NULL, 'Base_Action.Edit', 't', NULL, 0);
INSERT INTO "Base_Action" VALUES ('1188801341661646850', '2019-10-28 20:55:01.37', NULL, 'f', '1178957553778823168', 2, '', NULL, 'Base_Action.Delete', 't', NULL, 0);
INSERT INTO "Base_Action" VALUES ('1193158266167758848', '2019-11-09 21:27:53', 'Admin', 'f', NULL, 0, '首页', NULL, NULL, 't', 'home', 0);
INSERT INTO "Base_Action" VALUES ('1193158630615027712', '2019-11-09 21:29:20.013', 'Admin', 'f', '1193158266167758848', 1, '框架介绍', '/Home/Introduce', NULL, 'f', NULL, 0);
INSERT INTO "Base_Action" VALUES ('1193158780011941888', '2019-11-09 21:29:55.63', 'Admin', 'f', '1193158266167758848', 1, '运营统计', '/Home/Statis', NULL, 'f', NULL, 0);
INSERT INTO "Base_Action" VALUES ('1251789009936453632', '2020-04-19 16:25:31.741292', 'Admin', 'f', '1178957405992521728', 1, '操作日志', '/Base_Manage/Base_UserLog/List', NULL, 'f', NULL, 23);
INSERT INTO "Base_Action" VALUES ('1182652266117599232', '2019-10-11 21:40:47', NULL, 'f', '1178957405992521728', 1, '用户管理', '/Base_Manage/Base_User/List', NULL, 't', NULL, 0);
INSERT INTO "Base_Action" VALUES ('1272041182930669568', '2020-06-14 13:40:26.050826', NULL, 'f', '1182652266117599232', 2, '', NULL, 'Base_User.Add', 't', NULL, 0);
INSERT INTO "Base_Action" VALUES ('1272041182930669569', '2020-06-14 13:40:26.050854', NULL, 'f', '1182652266117599232', 2, '', NULL, 'Base_User.Edit', 't', NULL, 0);
INSERT INTO "Base_Action" VALUES ('1272041182930669570', '2020-06-14 13:40:26.050856', NULL, 'f', '1182652266117599232', 2, '', NULL, 'Base_User.Delete', 't', NULL, 0);
COMMIT;
-- ----------------------------
-- Table structure for Base_AppSecret
-- ----------------------------
CREATE TABLE "Base_AppSecret" (
"Id" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
"CreateTime" timestamp(6) NOT NULL,
"CreatorId" varchar(50) COLLATE "pg_catalog"."default",
"Deleted" bool NOT NULL DEFAULT false,
"AppId" varchar(50) COLLATE "pg_catalog"."default",
"AppSecret" varchar(50) COLLATE "pg_catalog"."default",
"AppName" varchar(50) COLLATE "pg_catalog"."default"
)
;
-- ----------------------------
-- Records of Base_AppSecret
-- ----------------------------
BEGIN;
INSERT INTO "Base_AppSecret" VALUES ('1172497995938271232', '2019-09-13 21:11:20', 'Admin', 'f', 'PcAdmin', 'wtMaiTRPTT3hrf5e', '后台AppId');
INSERT INTO "Base_AppSecret" VALUES ('1173937877642383360', '2019-09-17 20:32:55', 'Admin', 'f', 'AppAdmin', 'IVh9LLSVFcoQPQ5K', 'APP密钥');
COMMIT;
-- ----------------------------
-- Table structure for Base_BuildTest
-- ----------------------------
CREATE TABLE "Base_BuildTest" (
"Id" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
"CreateTime" timestamp(6) NOT NULL,
"CreatorId" varchar(50) COLLATE "pg_catalog"."default",
"Deleted" bool NOT NULL DEFAULT false,
"Column1" varchar(50) COLLATE "pg_catalog"."default",
"Column2" varchar(50) COLLATE "pg_catalog"."default",
"Column3" varchar(50) COLLATE "pg_catalog"."default",
"Column4" varchar(50) COLLATE "pg_catalog"."default",
"Column5" varchar(50) COLLATE "pg_catalog"."default"
)
;
-- ----------------------------
-- Records of Base_BuildTest
-- ----------------------------
BEGIN;
COMMIT;
-- ----------------------------
-- Table structure for Base_DbLink
-- ----------------------------
CREATE TABLE "Base_DbLink" (
"Id" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
"CreateTime" timestamp(6) NOT NULL,
"CreatorId" varchar(50) COLLATE "pg_catalog"."default",
"Deleted" bool NOT NULL DEFAULT false,
"LinkName" varchar(50) COLLATE "pg_catalog"."default",
"ConnectionStr" varchar(500) COLLATE "pg_catalog"."default",
"DbType" varchar(50) COLLATE "pg_catalog"."default"
)
;
-- ----------------------------
-- Records of Base_DbLink
-- ----------------------------
BEGIN;
INSERT INTO "Base_DbLink" VALUES ('1183373232498020352', '2019-10-13 21:25:39', 'Admin', 'f', 'BaseDb', 'Data Source=.;Initial Catalog=Colder.Admin.AntdVue;Integrated Security=True', 'SqlServer');
COMMIT;
-- ----------------------------
-- Table structure for Base_Department
-- ----------------------------
CREATE TABLE "Base_Department" (
"Id" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
"CreateTime" timestamp(6) NOT NULL,
"CreatorId" varchar(50) COLLATE "pg_catalog"."default",
"Deleted" bool NOT NULL DEFAULT false,
"Name" varchar(50) COLLATE "pg_catalog"."default",
"ParentId" varchar(50) COLLATE "pg_catalog"."default"
)
;
-- ----------------------------
-- Records of Base_Department
-- ----------------------------
BEGIN;
INSERT INTO "Base_Department" VALUES ('1181175685528424448', '2019-10-07 19:53:23', NULL, 'f', '宁波分公司', NULL);
INSERT INTO "Base_Department" VALUES ('1181175803631636480', '2019-10-07 19:53:51.427', NULL, 'f', '鄞州事业部', '1181175685528424448');
INSERT INTO "Base_Department" VALUES ('1181175865409540096', '2019-10-07 19:54:06', NULL, 'f', '海曙事业部', '1181175685528424448');
COMMIT;
-- ----------------------------
-- Table structure for Base_Role
-- ----------------------------
CREATE TABLE "Base_Role" (
"Id" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
"CreateTime" timestamp(6) NOT NULL,
"CreatorId" varchar(50) COLLATE "pg_catalog"."default",
"Deleted" bool NOT NULL DEFAULT false,
"RoleName" varchar(50) COLLATE "pg_catalog"."default"
)
;
-- ----------------------------
-- Records of Base_Role
-- ----------------------------
BEGIN;
INSERT INTO "Base_Role" VALUES ('1180486275199668224', '2019-10-05 22:13:55', NULL, 'f', '超级管理员');
INSERT INTO "Base_Role" VALUES ('1180819481383931904', '2019-10-06 20:17:57', NULL, 'f', '部门管理员');
COMMIT;
-- ----------------------------
-- Table structure for Base_RoleAction
-- ----------------------------
CREATE TABLE "Base_RoleAction" (
"Id" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
"CreateTime" timestamp(6) NOT NULL,
"CreatorId" varchar(50) COLLATE "pg_catalog"."default",
"Deleted" bool NOT NULL DEFAULT false,
"RoleId" varchar(50) COLLATE "pg_catalog"."default",
"ActionId" varchar(50) COLLATE "pg_catalog"."default"
)
;
-- ----------------------------
-- Records of Base_RoleAction
-- ----------------------------
BEGIN;
COMMIT;
-- ----------------------------
-- Table structure for Base_User
-- ----------------------------
CREATE TABLE "Base_User" (
"Id" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
"CreateTime" timestamp(6) NOT NULL,
"CreatorId" varchar(50) COLLATE "pg_catalog"."default",
"Deleted" bool NOT NULL DEFAULT false,
"UserName" varchar(50) COLLATE "pg_catalog"."default",
"Password" varchar(50) COLLATE "pg_catalog"."default",
"RealName" varchar(50) COLLATE "pg_catalog"."default",
"Sex" int4 NOT NULL DEFAULT 0,
"Birthday" date,
"DepartmentId" varchar(50) COLLATE "pg_catalog"."default"
)
;
-- ----------------------------
-- Records of Base_User
-- ----------------------------
BEGIN;
INSERT INTO "Base_User" VALUES ('Admin', '2019-09-13 21:10:03', 'Admin', 'f', 'Admin', 'e10adc3949ba59abbe56e057f20f883e', '超级管理员', 1, '2019-09-13', NULL);
COMMIT;
-- ----------------------------
-- Table structure for Base_UserLog
-- ----------------------------
CREATE TABLE "Base_UserLog" (
"Id" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
"CreateTime" timestamp(6) NOT NULL,
"CreatorId" varchar(50) COLLATE "pg_catalog"."default",
"CreatorRealName" varchar(50) COLLATE "pg_catalog"."default",
"LogType" varchar(50) COLLATE "pg_catalog"."default",
"LogContent" text COLLATE "pg_catalog"."default"
)
;
-- ----------------------------
-- Records of Base_UserLog
-- ----------------------------
BEGIN;
INSERT INTO "Base_UserLog" VALUES ('1272029420646830080', '2020-06-14 12:53:41.703516', 'Admin', '超级管理员', '系统用户管理', '添加用户:sadsadsa');
INSERT INTO "Base_UserLog" VALUES ('1272029650280779776', '2020-06-14 12:54:36.452629', 'Admin', '超级管理员', '系统用户管理', '修改用户:sadsadsa');
INSERT INTO "Base_UserLog" VALUES ('1272030872345776128', '2020-06-14 12:59:27.815138', 'Admin', '超级管理员', '系统角色管理', '修改角色:超级管理员');
INSERT INTO "Base_UserLog" VALUES ('1272030891475996672', '2020-06-14 12:59:32.376166', 'Admin', '超级管理员', '系统角色管理', '修改角色:超级管理员');
INSERT INTO "Base_UserLog" VALUES ('1272030918021746688', '2020-06-14 12:59:38.705268', 'Admin', '超级管理员', '系统角色管理', '修改角色:超级管理员');
INSERT INTO "Base_UserLog" VALUES ('1272030948765995008', '2020-06-14 12:59:46.03599', 'Admin', '超级管理员', '系统角色管理', '修改角色:部门管理员');
INSERT INTO "Base_UserLog" VALUES ('1272030966604369920', '2020-06-14 12:59:50.288714', 'Admin', '超级管理员', '系统角色管理', '修改角色:部门管理员');
INSERT INTO "Base_UserLog" VALUES ('1272030994970447872', '2020-06-14 12:59:57.05113', 'Admin', '超级管理员', '系统角色管理', '修改角色:部门管理员');
INSERT INTO "Base_UserLog" VALUES ('1272033561364402176', '2020-06-14 13:10:08.927689', 'Admin', '超级管理员', '系统角色管理', '修改角色:部门管理员');
INSERT INTO "Base_UserLog" VALUES ('1272033590300905472', '2020-06-14 13:10:15.826545', 'Admin', '超级管理员', '系统角色管理', '修改角色:部门管理员');
INSERT INTO "Base_UserLog" VALUES ('1272033850259673088', '2020-06-14 13:11:17.805003', 'Admin', '超级管理员', '系统角色管理', '修改角色:部门管理员');
INSERT INTO "Base_UserLog" VALUES ('1272036901221568512', '2020-06-14 13:23:25.211097', 'Admin', '超级管理员', '系统角色管理', '修改角色:部门管理员');
INSERT INTO "Base_UserLog" VALUES ('1272036916170067968', '2020-06-14 13:23:28.775327', 'Admin', '超级管理员', '系统角色管理', '修改角色:部门管理员');
INSERT INTO "Base_UserLog" VALUES ('1272037356295163904', '2020-06-14 13:25:13.709362', 'Admin', '超级管理员', '系统角色管理', '修改角色:部门管理员');
INSERT INTO "Base_UserLog" VALUES ('1272037462578827264', '2020-06-14 13:25:39.049447', 'Admin', '超级管理员', '系统角色管理', '修改角色:部门管理员');
INSERT INTO "Base_UserLog" VALUES ('1272037849323016192', '2020-06-14 13:27:11.256078', 'Admin', '超级管理员', '系统角色管理', '修改角色:部门管理员');
INSERT INTO "Base_UserLog" VALUES ('1272040662048444416', '2020-06-14 13:38:21.862887', 'Admin', '超级管理员', '系统角色管理', '修改角色:部门管理员');
INSERT INTO "Base_UserLog" VALUES ('1272040701143552000', '2020-06-14 13:38:31.183958', 'Admin', '超级管理员', '系统角色管理', '修改角色:部门管理员');
INSERT INTO "Base_UserLog" VALUES ('1272040740783919104', '2020-06-14 13:38:40.634052', 'Admin', '超级管理员', '系统角色管理', '修改角色:部门管理员');
COMMIT;
-- ----------------------------
-- Table structure for Base_UserRole
-- ----------------------------
CREATE TABLE "Base_UserRole" (
"Id" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
"CreateTime" timestamp(6) NOT NULL,
"CreatorId" varchar(50) COLLATE "pg_catalog"."default",
"Deleted" bool NOT NULL DEFAULT false,
"UserId" varchar(50) COLLATE "pg_catalog"."default",
"RoleId" varchar(50) COLLATE "pg_catalog"."default"
)
;
-- ----------------------------
-- Records of Base_UserRole
-- ----------------------------
BEGIN;
INSERT INTO "Base_UserRole" VALUES ('1181927367719784448', '2019-10-09 21:40:18.27', NULL, 'f', '1181922344629702656', '1180819481383931904');
INSERT INTO "Base_UserRole" VALUES ('1181927367719784449', '2019-10-09 21:40:18.27', NULL, 'f', '1181922344629702656', '1180486275199668224');
INSERT INTO "Base_UserRole" VALUES ('1181927783786352640', '2019-10-09 21:41:57.47', NULL, 'f', '1181927783727632384', '1180819481383931904');
INSERT INTO "Base_UserRole" VALUES ('1251788815895367680', '2020-04-19 16:24:45.478714', NULL, 'f', '1181928860648738816', '1180819481383931904');
INSERT INTO "Base_UserRole" VALUES ('1251788815895367681', '2020-04-19 16:24:45.478899', NULL, 'f', '1181928860648738816', '1180819481383931904');
INSERT INTO "Base_UserRole" VALUES ('1272029650192699392', '2020-06-14 12:54:36.431934', NULL, 'f', '1272029420349034496', '1180486275199668224');
INSERT INTO "Base_UserRole" VALUES ('1272029650196893696', '2020-06-14 12:54:36.432072', NULL, 'f', '1272029420349034496', '1180819481383931904');
COMMIT;
-- ----------------------------
-- Primary Key structure for table Base_Action
-- ----------------------------
ALTER TABLE "Base_Action" ADD CONSTRAINT "Base_Action_pkey" PRIMARY KEY ("Id");
-- ----------------------------
-- Primary Key structure for table Base_AppSecret
-- ----------------------------
ALTER TABLE "Base_AppSecret" ADD CONSTRAINT "Base_AppSecret_pkey" PRIMARY KEY ("Id");
-- ----------------------------
-- Primary Key structure for table Base_BuildTest
-- ----------------------------
ALTER TABLE "Base_BuildTest" ADD CONSTRAINT "Base_BuildTest_pkey" PRIMARY KEY ("Id");
-- ----------------------------
-- Primary Key structure for table Base_DbLink
-- ----------------------------
ALTER TABLE "Base_DbLink" ADD CONSTRAINT "Base_DbLink_pkey" PRIMARY KEY ("Id");
-- ----------------------------
-- Primary Key structure for table Base_Department
-- ----------------------------
ALTER TABLE "Base_Department" ADD CONSTRAINT "Base_Department_pkey" PRIMARY KEY ("Id");
-- ----------------------------
-- Primary Key structure for table Base_Role
-- ----------------------------
ALTER TABLE "Base_Role" ADD CONSTRAINT "Base_Role_pkey" PRIMARY KEY ("Id");
-- ----------------------------
-- Primary Key structure for table Base_RoleAction
-- ----------------------------
ALTER TABLE "Base_RoleAction" ADD CONSTRAINT "Base_RoleAction_pkey" PRIMARY KEY ("Id");
-- ----------------------------
-- Primary Key structure for table Base_User
-- ----------------------------
ALTER TABLE "Base_User" ADD CONSTRAINT "Base_User_pkey" PRIMARY KEY ("Id");
-- ----------------------------
-- Primary Key structure for table Base_UserLog
-- ----------------------------
ALTER TABLE "Base_UserLog" ADD CONSTRAINT "Base_UserLog_pkey" PRIMARY KEY ("Id");
-- ----------------------------
-- Primary Key structure for table Base_UserRole
-- ----------------------------
ALTER TABLE "Base_UserRole" ADD CONSTRAINT "Base_UserRole_pkey" PRIMARY KEY ("Id");

1543
docs/初始化文件/SQLServer.sql

File diff suppressed because it is too large

3404
docs/数据库设计/Base_Table.pdm

File diff suppressed because it is too large

10
docs/数据库设计/Base_Table.sws

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<?PowerDesigner signature="Workspace" version="16.5.0.3982"?>
<!-- do not edit this file -->
<Workspace>
<Local Expanded="Yes">
<Model Expanded="Yes" ID="{160EB092-2F96-4235-852F-052B990C5A86}" Name="Base_Table" Selected="Yes" Type="{CDE44E21-9669-11D1-9914-006097355D9B}" URL="Base_Table.pdm"/>
</Local>
<BrowserModule Name="Repository"/>
</Workspace>

73
src/Coldairarrow.Api/05.Coldairarrow.Api.csproj

@ -0,0 +1,73 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<ServerGarbageCollection>true</ServerGarbageCollection>
<ConcurrentGarbageCollection>false</ConcurrentGarbageCollection>
<TargetFramework>net5.0</TargetFramework>
<RootNamespace>Coldairarrow.Api</RootNamespace>
<AssemblyName>Coldairarrow.Api</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<NoWarn>1701;1702;CS1591</NoWarn>
</PropertyGroup>
<!--输出依赖包的xml-->
<Target Name="CopyReferenceFiles" BeforeTargets="Build">
<ItemGroup>
<ReferenceFiles Include="%(Reference.RelativeDir)%(Reference.Filename).xml;%(Reference.RelativeDir)%(Reference.Filename).pdb" />
</ItemGroup>
<Message Text="Copying reference files to $(OutputPath)" Importance="High" />
<Copy SourceFiles="@(ReferenceFiles)" DestinationFolder="$(OutputPath)" Condition="Exists('%(RootDir)%(Directory)%(Filename)%(Extension)')" />
<Message Text="Copying reference files to $(PublishDir)" Importance="High" />
<Copy SourceFiles="@(ReferenceFiles)" DestinationFolder="$(PublishDir)" Condition="Exists('%(RootDir)%(Directory)%(Filename)%(Extension)')" />
</Target>
<ItemGroup>
<PackageReference Include="Colder.Logging.Serilog" Version="1.2.17" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.5" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="5.0.5" />
<PackageReference Include="NSwag.AspNetCore" Version="13.10.9" />
<PackageReference Include="Caching.CSRedis" Version="3.6.60" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Coldairarrow.Business\04.Coldairarrow.Business.csproj" />
<ProjectReference Include="..\Coldairarrow.Entity\02.Coldairarrow.Entity.csproj" />
<ProjectReference Include="..\Coldairarrow.Util\01.Coldairarrow.Util.csproj" />
</ItemGroup>
<ItemGroup>
<None Update="0_install.bat">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="0_uninstall.bat">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="BuildCodeTemplate\Business.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="BuildCodeTemplate\Controller.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="BuildCodeTemplate\EditForm.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="BuildCodeTemplate\IBusiness.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="BuildCodeTemplate\List.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Dockerfile">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="nssm.exe">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<ProjectExtensions><VisualStudio><UserProperties appsettings_1json__JsonSchema="" /></VisualStudio></ProjectExtensions>
</Project>

7
src/Coldairarrow.Api/0_install.bat

@ -0,0 +1,7 @@
cd /d %~dp0
set serviceName="Coldairarrow.Api"
set exePath="Coldairarrow.Api.exe"
nssm install %serviceName% %~dp0\%exePath%
::参数设置
::nssm set emqx AppParameters start
nssm start %serviceName%

4
src/Coldairarrow.Api/0_uninstall.bat

@ -0,0 +1,4 @@
cd /d %~dp0
set serviceName="Coldairarrow.Api"
nssm stop %serviceName%
nssm remove %serviceName% confirm

65
src/Coldairarrow.Api/BuildCodeTemplate/Business.txt

@ -0,0 +1,65 @@
using Coldairarrow.Entity.%areaName%;
using Coldairarrow.Util;
using EFCore.Sharding;
using LinqKit;
using Microsoft.EntityFrameworkCore;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Dynamic.Core;
using System.Threading.Tasks;
namespace Coldairarrow.Business.%areaName%
{
public class %entityName%Business : BaseBusiness<%entityName%>, I%entityName%Business, ITransientDependency
{
public %entityName%Business(IDbAccessor db)
: base(db)
{
}
#region 外部接口
public async Task<PageResult<%entityName%>> GetDataListAsync(PageInput<ConditionDTO> input)
{
var q = GetIQueryable();
var where = LinqHelper.True<%entityName%>();
var search = input.Search;
//筛选
if (!search.Condition.IsNullOrEmpty() && !search.Keyword.IsNullOrEmpty())
{
var newWhere = DynamicExpressionParser.ParseLambda<%entityName%, bool>(
ParsingConfig.Default, false, $@"{search.Condition}.Contains(@0)", search.Keyword);
where = where.And(newWhere);
}
return await q.Where(where).GetPageResultAsync(input);
}
public async Task<%entityName%> GetTheDataAsync(string id)
{
return await GetEntityAsync(id);
}
public async Task AddDataAsync(%entityName% data)
{
await InsertAsync(data);
}
public async Task UpdateDataAsync(%entityName% data)
{
await UpdateAsync(data);
}
public async Task DeleteDataAsync(List<string> ids)
{
await DeleteAsync(ids);
}
#endregion
#region 私有成员
#endregion
}
}

65
src/Coldairarrow.Api/BuildCodeTemplate/Controller.txt

@ -0,0 +1,65 @@
using Coldairarrow.Business.%areaName%;
using Coldairarrow.Entity.%areaName%;
using Coldairarrow.Util;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Coldairarrow.Api.Controllers.%areaName%
{
[Route("/%areaName%/[controller]/[action]")]
public class %entityName%Controller : BaseApiController
{
#region DI
public %entityName%Controller(I%entityName%Business %busName%)
{
%_busName% = %busName%;
}
I%entityName%Business %_busName% { get; }
#endregion
#region 获取
[HttpPost]
public async Task<PageResult<%entityName%>> GetDataList(PageInput<ConditionDTO> input)
{
return await %_busName%.GetDataListAsync(input);
}
[HttpPost]
public async Task<%entityName%> GetTheData(IdInputDTO input)
{
return await %_busName%.GetTheDataAsync(input.id);
}
#endregion
#region 提交
[HttpPost]
public async Task SaveData(%entityName% data)
{
if (data.Id.IsNullOrEmpty())
{
InitEntity(data);
await %_busName%.AddDataAsync(data);
}
else
{
await %_busName%.UpdateDataAsync(data);
}
}
[HttpPost]
public async Task DeleteData(List<string> ids)
{
await %_busName%.DeleteDataAsync(ids);
}
#endregion
}
}

78
src/Coldairarrow.Api/BuildCodeTemplate/EditForm.txt

@ -0,0 +1,78 @@
<template>
<a-modal
:title="title"
width="40%"
:visible="visible"
:confirmLoading="loading"
@ok="handleSubmit"
@cancel="()=>{this.visible=false}"
>
<a-spin :spinning="loading">
<a-form-model ref="form" :model="entity" :rules="rules" v-bind="layout">
%formColumns%
</a-form-model>
</a-spin>
</a-modal>
</template>
<script>
export default {
props: {
parentObj: Object
},
data() {
return {
layout: {
labelCol: { span: 5 },
wrapperCol: { span: 18 }
},
visible: false,
loading: false,
entity: {},
rules: {},
title: ''
}
},
methods: {
init() {
this.visible = true
this.entity = {}
this.$nextTick(() => {
this.$refs['form'].clearValidate()
})
},
openForm(id, title) {
this.init()
if (id) {
this.loading = true
this.$http.post('/%areaName%/%entityName%/GetTheData', { id: id }).then(resJson => {
this.loading = false
this.entity = resJson.Data
})
}
},
handleSubmit() {
this.$refs['form'].validate(valid => {
if (!valid) {
return
}
this.loading = true
this.$http.post('/%areaName%/%entityName%/SaveData', this.entity).then(resJson => {
this.loading = false
if (resJson.Success) {
this.$message.success('操作成功!')
this.visible = false
this.parentObj.getDataList()
} else {
this.$message.error(resJson.Msg)
}
})
})
}
}
}
</script>

16
src/Coldairarrow.Api/BuildCodeTemplate/IBusiness.txt

@ -0,0 +1,16 @@
using Coldairarrow.Entity.%areaName%;
using Coldairarrow.Util;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Coldairarrow.Business.%areaName%
{
public interface I%entityName%Business
{
Task<PageResult<%entityName%>> GetDataListAsync(PageInput<ConditionDTO> input);
Task<%entityName%> GetTheDataAsync(string id);
Task AddDataAsync(%entityName% data);
Task UpdateDataAsync(%entityName% data);
Task DeleteDataAsync(List<string> ids);
}
}

157
src/Coldairarrow.Api/BuildCodeTemplate/List.txt

@ -0,0 +1,157 @@
<template>
<a-card :bordered="false">
<div class="table-operator">
<a-button type="primary" icon="plus" @click="hanldleAdd()">新建</a-button>
<a-button
type="primary"
icon="minus"
@click="handleDelete(selectedRowKeys)"
:disabled="!hasSelected()"
:loading="loading"
>删除</a-button>
<a-button type="primary" icon="redo" @click="getDataList()">刷新</a-button>
</div>
<div class="table-page-search-wrapper">
<a-form layout="inline">
<a-row :gutter="10">
<a-col :md="4" :sm="24">
<a-form-item label="查询类别">
<a-select allowClear v-model="queryParam.condition">
%selectOptions%
</a-select>
</a-form-item>
</a-col>
<a-col :md="4" :sm="24">
<a-form-item>
<a-input v-model="queryParam.keyword" placeholder="关键字" />
</a-form-item>
</a-col>
<a-col :md="6" :sm="24">
<a-button type="primary" @click="() => {this.pagination.current = 1; this.getDataList()}">查询</a-button>
<a-button style="margin-left: 8px" @click="() => (queryParam = {})">重置</a-button>
</a-col>
</a-row>
</a-form>
</div>
<a-table
ref="table"
:columns="columns"
:rowKey="row => row.Id"
:dataSource="data"
:pagination="pagination"
:loading="loading"
@change="handleTableChange"
:rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
:bordered="true"
size="small"
>
<span slot="action" slot-scope="text, record">
<template>
<a @click="handleEdit(record.Id)">编辑</a>
<a-divider type="vertical" />
<a @click="handleDelete([record.Id])">删除</a>
</template>
</span>
</a-table>
<edit-form ref="editForm" :parentObj="this"></edit-form>
</a-card>
</template>
<script>
import EditForm from './EditForm'
const columns = [
%listColumns%
{ title: '操作', dataIndex: 'action', scopedSlots: { customRender: 'action' } }
]
export default {
components: {
EditForm
},
mounted() {
this.getDataList()
},
data() {
return {
data: [],
pagination: {
current: 1,
pageSize: 10,
showTotal: (total, range) => `总数:${total} 当前:${range[0]}-${range[1]}`
},
filters: {},
sorter: { field: 'Id', order: 'asc' },
loading: false,
columns,
queryParam: {},
selectedRowKeys: []
}
},
methods: {
handleTableChange(pagination, filters, sorter) {
this.pagination = { ...pagination }
this.filters = { ...filters }
this.sorter = { ...sorter }
this.getDataList()
},
getDataList() {
this.selectedRowKeys = []
this.loading = true
this.$http
.post('/%areaName%/%entityName%/GetDataList', {
PageIndex: this.pagination.current,
PageRows: this.pagination.pageSize,
SortField: this.sorter.field || 'Id',
SortType: this.sorter.order,
Search: this.queryParam,
...this.filters
})
.then(resJson => {
this.loading = false
this.data = resJson.Data
const pagination = { ...this.pagination }
pagination.total = resJson.Total
this.pagination = pagination
})
},
onSelectChange(selectedRowKeys) {
this.selectedRowKeys = selectedRowKeys
},
hasSelected() {
return this.selectedRowKeys.length > 0
},
hanldleAdd() {
this.$refs.editForm.openForm()
},
handleEdit(id) {
this.$refs.editForm.openForm(id)
},
handleDelete(ids) {
var thisObj = this
this.$confirm({
title: '确认删除吗?',
onOk() {
return new Promise((resolve, reject) => {
thisObj.$http.post('/%areaName%/%entityName%/DeleteData', ids).then(resJson => {
resolve()
if (resJson.Success) {
thisObj.$message.success('操作成功!')
thisObj.getDataList()
} else {
thisObj.$message.error(resJson.Msg)
}
})
})
}
})
}
}
}
</script>

13
src/Coldairarrow.Api/Controllers/BaseApiController.cs

@ -0,0 +1,13 @@
using Microsoft.AspNetCore.Mvc;
namespace Coldairarrow.Api
{
/// <summary>
/// 对外接口基控制器
/// </summary>
[ApiController]
public class BaseApiController : BaseController
{
}
}

142
src/Coldairarrow.Api/Controllers/BaseController.cs

@ -0,0 +1,142 @@
using Coldairarrow.IBusiness;
using Coldairarrow.Util;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.IO;
using System.Text;
namespace Coldairarrow.Api
{
/// <summary>
/// 基控制器
/// </summary>
[FormatResponse]
public class BaseController : ControllerBase
{
protected void InitEntity(object obj)
{
var op = HttpContext.RequestServices.GetService<IOperator>();
if (obj.ContainsProperty("Id"))
obj.SetPropertyValue("Id", IdHelper.GetId());
if (obj.ContainsProperty("CreateTime"))
obj.SetPropertyValue("CreateTime", DateTime.Now);
if (obj.ContainsProperty("CreatorId"))
obj.SetPropertyValue("CreatorId", op?.UserId);
if (obj.ContainsProperty("CreatorRealName"))
obj.SetPropertyValue("CreatorRealName", op?.Property?.RealName);
}
protected string GetAbsolutePath(string virtualPath)
{
string path = virtualPath.Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar);
if (path[0] == '~')
path = path.Remove(0, 2);
string rootPath = HttpContext.RequestServices.GetService<IWebHostEnvironment>().WebRootPath;
return Path.Combine(rootPath, path);
}
/// <summary>
/// 返回JSON
/// </summary>
/// <param name="jsonStr">json字符串</param>
/// <returns></returns>
protected ContentResult JsonContent(string jsonStr)
{
return base.Content(jsonStr, "application/json", Encoding.UTF8);
}
/// <summary>
/// 返回html
/// </summary>
/// <param name="body">html内容</param>
/// <returns></returns>
protected ContentResult HtmlContent(string body)
{
return base.Content(body);
}
/// <summary>
/// 返回成功
/// </summary>
/// <returns></returns>
protected AjaxResult Success()
{
AjaxResult res = new AjaxResult
{
Success = true,
Msg = "请求成功!",
};
return res;
}
/// <summary>
/// 返回成功
/// </summary>
/// <param name="data">返回数据</param>
/// <returns></returns>
protected AjaxResult<T> Success<T>(T data)
{
AjaxResult<T> res = new AjaxResult<T>
{
Success = true,
Msg = "操作成功",
Data = data
};
return res;
}
/// <summary>
/// 返回成功
/// </summary>
/// <param name="data">返回数据</param>
/// <param name="msg">返回消息</param>
/// <returns></returns>
protected AjaxResult<T> Success<T>(T data, string msg)
{
AjaxResult<T> res = new AjaxResult<T>
{
Success = true,
Msg = msg,
Data = data
};
return res;
}
/// <summary>
/// 返回错误
/// </summary>
/// <returns></returns>
protected AjaxResult Error()
{
AjaxResult res = new AjaxResult
{
Success = false,
Msg = "请求失败!",
};
return res;
}
/// <summary>
/// 返回错误
/// </summary>
/// <param name="msg">错误提示</param>
/// <returns></returns>
protected AjaxResult Error(string msg)
{
AjaxResult res = new AjaxResult
{
Success = false,
Msg = msg,
};
return res;
}
}
}

100
src/Coldairarrow.Api/Controllers/Base_Manage/Base_ActionController.cs

@ -0,0 +1,100 @@
using Coldairarrow.Business.Base_Manage;
using Coldairarrow.Entity;
using Coldairarrow.Entity.Base_Manage;
using Coldairarrow.Util;
using Microsoft.AspNetCore.Mvc;
using NSwag.Annotations;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Coldairarrow.Api.Controllers.Base_Manage
{
/// <summary>
/// 系统权限
/// </summary>
/// <seealso cref="Coldairarrow.Api.BaseApiController" />
[Route("/Base_Manage/[controller]/[action]")]
[OpenApiTag("系统权限")]
public class Base_ActionController : BaseApiController
{
#region DI
public Base_ActionController(IBase_ActionBusiness actionBus)
{
_actionBus = actionBus;
}
IBase_ActionBusiness _actionBus { get; }
#endregion
#region 获取
[HttpPost]
public async Task<Base_Action> GetTheData(IdInputDTO input)
{
return (await _actionBus.GetTheDataAsync(input.id)) ?? new Base_Action();
}
[HttpPost]
public async Task<List<Base_Action>> GetPermissionList(Base_ActionsInputDTO input)
{
input.types = new ActionType[] { Entity.ActionType. };
return await _actionBus.GetDataListAsync(input);
}
[HttpPost]
public async Task<List<Base_Action>> GetAllActionList()
{
return await _actionBus.GetDataListAsync(new Base_ActionsInputDTO
{
types = new ActionType[] { ActionType., ActionType., ActionType. }
});
}
[HttpPost]
public async Task<List<Base_ActionDTO>> GetMenuTreeList(Base_ActionsInputDTO input)
{
input.selectable = true;
input.types = new ActionType[] { ActionType., ActionType. };
return await _actionBus.GetTreeDataListAsync(input);
}
[HttpPost]
public async Task<List<Base_ActionDTO>> GetActionTreeList(Base_ActionsInputDTO input)
{
input.selectable = false;
return await _actionBus.GetTreeDataListAsync(input);
}
#endregion
#region 提交
[HttpPost]
public async Task SaveData(ActionEditInputDTO input)
{
if (input.Id.IsNullOrEmpty())
{
InitEntity(input);
await _actionBus.AddDataAsync(input);
}
else
{
await _actionBus.UpdateDataAsync(input);
}
}
[HttpPost]
public async Task DeleteData(List<string> ids)
{
await _actionBus.DeleteDataAsync(ids);
}
#endregion
}
}

79
src/Coldairarrow.Api/Controllers/Base_Manage/Base_AppSecretController.cs

@ -0,0 +1,79 @@
using Coldairarrow.Business.Base_Manage;
using Coldairarrow.Entity.Base_Manage;
using Coldairarrow.Util;
using Microsoft.AspNetCore.Mvc;
using NSwag.Annotations;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Coldairarrow.Api.Controllers.Base_Manage
{
/// <summary>
/// 应用密钥
/// </summary>
/// <seealso cref="Coldairarrow.Api.BaseApiController" />
[Route("/Base_Manage/[controller]/[action]")]
[OpenApiTag("应用密钥")]
public class Base_AppSecretController : BaseApiController
{
#region DI
public Base_AppSecretController(IBase_AppSecretBusiness appSecretBus)
{
_appSecretBus = appSecretBus;
}
IBase_AppSecretBusiness _appSecretBus { get; }
#endregion
#region 获取
[HttpPost]
public async Task<PageResult<Base_AppSecret>> GetDataList(PageInput<AppSecretsInputDTO> input)
{
return await _appSecretBus.GetDataListAsync(input);
}
[HttpPost]
public async Task<Base_AppSecret> GetTheData(IdInputDTO input)
{
return await _appSecretBus.GetTheDataAsync(input.id) ?? new Base_AppSecret();
}
#endregion
#region 提交
/// <summary>
/// 保存
/// </summary>
/// <param name="theData">保存的数据</param>
[HttpPost]
public async Task SaveData(Base_AppSecret theData)
{
if (theData.Id.IsNullOrEmpty())
{
InitEntity(theData);
await _appSecretBus.AddDataAsync(theData);
}
else
{
await _appSecretBus.UpdateDataAsync(theData);
}
}
/// <summary>
/// 删除数据
/// </summary>
/// <param name="ids">id数组,JSON数组</param>
[HttpPost]
public async Task DeleteData(List<string> ids)
{
await _appSecretBus.DeleteDataAsync(ids);
}
#endregion
}
}

79
src/Coldairarrow.Api/Controllers/Base_Manage/Base_DbLinkController.cs

@ -0,0 +1,79 @@
using Coldairarrow.Business.Base_Manage;
using Coldairarrow.Entity.Base_Manage;
using Coldairarrow.Util;
using Microsoft.AspNetCore.Mvc;
using NSwag.Annotations;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Coldairarrow.Api.Controllers.Base_Manage
{
/// <summary>
/// 数据库连接
/// </summary>
/// <seealso cref="Coldairarrow.Api.BaseApiController" />
[Route("/Base_Manage/[controller]/[action]")]
[OpenApiTag("数据库连接")]
public class Base_DbLinkController : BaseApiController
{
#region DI
public Base_DbLinkController(IBase_DbLinkBusiness dbLinkBus)
{
_dbLinkBus = dbLinkBus;
}
IBase_DbLinkBusiness _dbLinkBus { get; }
#endregion
#region 获取
[HttpPost]
public async Task<AjaxResult<List<Base_DbLink>>> GetDataList(PageInput input)
{
return await _dbLinkBus.GetDataListAsync(input);
}
[HttpPost]
public async Task<Base_DbLink> GetTheData(IdInputDTO input)
{
return await _dbLinkBus.GetTheDataAsync(input.id) ?? new Base_DbLink();
}
#endregion
#region 提交
/// <summary>
/// 保存
/// </summary>
/// <param name="theData">保存的数据</param>
[HttpPost]
public async Task SaveData(Base_DbLink theData)
{
if (theData.Id.IsNullOrEmpty())
{
InitEntity(theData);
await _dbLinkBus.AddDataAsync(theData);
}
else
{
await _dbLinkBus.UpdateDataAsync(theData);
}
}
/// <summary>
/// 删除数据
/// </summary>
/// <param name="ids">id数组,JSON数组</param>
[HttpPost]
public async Task DeleteData(List<string> ids)
{
await _dbLinkBus.DeleteDataAsync(ids);
}
#endregion
}
}

70
src/Coldairarrow.Api/Controllers/Base_Manage/Base_DepartmentController.cs

@ -0,0 +1,70 @@
using Coldairarrow.Business.Base_Manage;
using Coldairarrow.Entity.Base_Manage;
using Coldairarrow.Util;
using Microsoft.AspNetCore.Mvc;
using NSwag.Annotations;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Coldairarrow.Api.Controllers.Base_Manage
{
/// <summary>
/// 部门
/// </summary>
[Route("/Base_Manage/[controller]/[action]")]
[OpenApiTag("部门")]
public class Base_DepartmentController : BaseApiController
{
#region DI
public Base_DepartmentController(IBase_DepartmentBusiness departmentBus)
{
_departmentBus = departmentBus;
}
IBase_DepartmentBusiness _departmentBus { get; }
#endregion
#region 获取
[HttpPost]
public async Task<Base_Department> GetTheData(IdInputDTO input)
{
return await _departmentBus.GetTheDataAsync(input.id) ?? new Base_Department();
}
[HttpPost]
public async Task<List<Base_DepartmentTreeDTO>> GetTreeDataList(DepartmentsTreeInputDTO input)
{
return await _departmentBus.GetTreeDataListAsync(input);
}
#endregion
#region 提交
[HttpPost]
public async Task SaveData(Base_Department theData)
{
if (theData.Id.IsNullOrEmpty())
{
InitEntity(theData);
await _departmentBus.AddDataAsync(theData);
}
else
{
await _departmentBus.UpdateDataAsync(theData);
}
}
[HttpPost]
public async Task DeleteData(List<string> ids)
{
await _departmentBus.DeleteDataAsync(ids);
}
#endregion
}
}

70
src/Coldairarrow.Api/Controllers/Base_Manage/Base_RoleController.cs

@ -0,0 +1,70 @@
using Coldairarrow.Business.Base_Manage;
using Coldairarrow.Util;
using Microsoft.AspNetCore.Mvc;
using NSwag.Annotations;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Coldairarrow.Api.Controllers.Base_Manage
{
/// <summary>
/// 系统角色
/// </summary>
/// <seealso cref="Coldairarrow.Api.BaseApiController" />
[Route("/Base_Manage/[controller]/[action]")]
[OpenApiTag("系统角色")]
public class Base_RoleController : BaseApiController
{
#region DI
public Base_RoleController(IBase_RoleBusiness roleBus)
{
_roleBus = roleBus;
}
IBase_RoleBusiness _roleBus { get; }
#endregion
#region 获取
[HttpPost]
public async Task<PageResult<Base_RoleInfoDTO>> GetDataList(PageInput<RolesInputDTO> input)
{
return await _roleBus.GetDataListAsync(input);
}
[HttpPost]
public async Task<Base_RoleInfoDTO> GetTheData(IdInputDTO input)
{
return await _roleBus.GetTheDataAsync(input.id) ?? new Base_RoleInfoDTO();
}
#endregion
#region 提交
[HttpPost]
public async Task SaveData(Base_RoleInfoDTO input)
{
if (input.Id.IsNullOrEmpty())
{
InitEntity(input);
await _roleBus.AddDataAsync(input);
}
else
{
await _roleBus.UpdateDataAsync(input);
}
}
[HttpPost]
public async Task DeleteData(List<string> ids)
{
await _roleBus.DeleteDataAsync(ids);
}
#endregion
}
}

75
src/Coldairarrow.Api/Controllers/Base_Manage/Base_UserController.cs

@ -0,0 +1,75 @@
using Coldairarrow.Business.Base_Manage;
using Coldairarrow.Entity;
using Coldairarrow.Util;
using Microsoft.AspNetCore.Mvc;
using NSwag.Annotations;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Coldairarrow.Api.Controllers.Base_Manage
{
[Route("/Base_Manage/[controller]/[action]")]
[OpenApiTag("系统用户")]
public class Base_UserController : BaseApiController
{
#region DI
public Base_UserController(IBase_UserBusiness userBus)
{
_userBus = userBus;
}
IBase_UserBusiness _userBus { get; }
#endregion
#region 获取
[HttpPost]
public async Task<PageResult<Base_UserDTO>> GetDataList(PageInput<Base_UsersInputDTO> input)
{
return await _userBus.GetDataListAsync(input);
}
[HttpPost]
public async Task<Base_UserDTO> GetTheData(IdInputDTO input)
{
return await _userBus.GetTheDataAsync(input.id) ?? new Base_UserDTO();
}
[HttpPost]
public async Task<List<SelectOption>> GetOptionList(OptionListInputDTO input)
{
return await _userBus.GetOptionListAsync(input);
}
#endregion
#region 提交
[HttpPost]
public async Task SaveData(UserEditInputDTO input)
{
if (!input.newPwd.IsNullOrEmpty())
input.Password = input.newPwd.ToMD5String();
if (input.Id.IsNullOrEmpty())
{
InitEntity(input);
await _userBus.AddDataAsync(input);
}
else
{
await _userBus.UpdateDataAsync(input);
}
}
[HttpPost]
public async Task DeleteData(List<string> ids)
{
await _userBus.DeleteDataAsync(ids);
}
#endregion
}
}

49
src/Coldairarrow.Api/Controllers/Base_Manage/Base_UserLogController.cs

@ -0,0 +1,49 @@
using Coldairarrow.Business.Base_Manage;
using Coldairarrow.Entity.Base_Manage;
using Coldairarrow.Util;
using Microsoft.AspNetCore.Mvc;
using NSwag.Annotations;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Coldairarrow.Api.Controllers.Base_Manage
{
[Route("/Base_Manage/[controller]/[action]")]
[OpenApiTag("审计日志")]
public class Base_UserLogController : BaseApiController
{
#region DI
public Base_UserLogController(IBase_UserLogBusiness logBus)
{
_logBus = logBus;
}
IBase_UserLogBusiness _logBus { get; }
#endregion
#region 获取
[HttpPost]
public async Task<PageResult<Base_UserLog>> GetLogList(PageInput<UserLogsInputDTO> input)
{
input.SortField = "CreateTime";
input.SortType = "desc";
return await _logBus.GetLogListAsync(input);
}
[HttpPost]
public List<SelectOption> GetLogTypeList()
{
return EnumHelper.ToOptionList(typeof(UserLogType));
}
#endregion
#region 提交
#endregion
}
}

43
src/Coldairarrow.Api/Controllers/Base_Manage/BuildCodeController.cs

@ -0,0 +1,43 @@
using Coldairarrow.Business.Base_Manage;
using Coldairarrow.Entity.Base_Manage;
using Coldairarrow.Util;
using Microsoft.AspNetCore.Mvc;
using NSwag.Annotations;
using System.Collections.Generic;
namespace Coldairarrow.Api.Controllers.Base_Manage
{
[Route("/Base_Manage/[controller]/[action]")]
[OpenApiTag("代码生成")]
public class BuildCodeController : BaseApiController
{
#region DI
public BuildCodeController(IBuildCodeBusiness buildCodeBus)
{
_buildCodeBus = buildCodeBus;
}
IBuildCodeBusiness _buildCodeBus { get; }
#endregion
[HttpPost]
public List<Base_DbLink> GetAllDbLink()
{
return _buildCodeBus.GetAllDbLink();
}
[HttpPost]
public List<DbTableInfo> GetDbTableList(DbTablesInputDTO input)
{
return _buildCodeBus.GetDbTableList(input.linkId);
}
[HttpPost]
public void Build(BuildInputDTO input)
{
_buildCodeBus.Build(input);
}
}
}

95
src/Coldairarrow.Api/Controllers/Base_Manage/HomeController.cs

@ -0,0 +1,95 @@
using Coldairarrow.Business.Base_Manage;
using Coldairarrow.IBusiness;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using Microsoft.IdentityModel.Tokens;
using NSwag.Annotations;
using System;
using System.Collections.Generic;
using System.IdentityModel.Tokens.Jwt;
using System.Security.Claims;
using System.Text;
using System.Threading.Tasks;
namespace Coldairarrow.Api.Controllers.Base_Manage
{
/// <summary>
/// 首页控制器
/// </summary>
[Route("/Base_Manage/[controller]/[action]")]
[OpenApiTag("主页")]
public class HomeController : BaseApiController
{
readonly IHomeBusiness _homeBus;
readonly IPermissionBusiness _permissionBus;
readonly IBase_UserBusiness _userBus;
readonly IOperator _operator;
private readonly JwtOptions _jwtOptions;
public HomeController(
IHomeBusiness homeBus,
IPermissionBusiness permissionBus,
IBase_UserBusiness userBus,
IOperator @operator,
IOptions<JwtOptions> jwtOptions
)
{
_homeBus = homeBus;
_permissionBus = permissionBus;
_userBus = userBus;
_operator = @operator;
_jwtOptions = jwtOptions.Value;
}
/// <summary>
/// 用户登录(获取token)
/// </summary>
/// <returns></returns>
[HttpPost]
[AllowAnonymous]
public async Task<string> SubmitLogin(LoginInputDTO input)
{
var userId = await _homeBus.SubmitLoginAsync(input);
var claims = new[]
{
new Claim("userId",userId)
};
var key = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(_jwtOptions.Secret));
var credentials = new SigningCredentials(key, SecurityAlgorithms.HmacSha256);
var jwtToken = new JwtSecurityToken(
string.Empty,
string.Empty,
claims,
expires: DateTime.Now.AddHours(_jwtOptions.AccessExpireHours),
signingCredentials: credentials);
return new JwtSecurityTokenHandler().WriteToken(jwtToken);
}
[HttpPost]
public async Task ChangePwd(ChangePwdInputDTO input)
{
await _homeBus.ChangePwdAsync(input);
}
[HttpPost]
public async Task<object> GetOperatorInfo()
{
var theInfo = await _userBus.GetTheDataAsync(_operator.UserId);
var permissions = await _permissionBus.GetUserPermissionValuesAsync(_operator.UserId);
var resObj = new
{
UserInfo = theInfo,
Permissions = permissions
};
return resObj;
}
[HttpPost]
public async Task<List<Base_ActionDTO>> GetOperatorMenuList()
{
return await _permissionBus.GetUserMenuListAsync(_operator.UserId);
}
}
}

51
src/Coldairarrow.Api/Controllers/Base_Manage/UploadController.cs

@ -0,0 +1,51 @@
using Coldairarrow.Util;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using NSwag.Annotations;
using System;
using System.IO;
namespace Coldairarrow.Api.Controllers.Base_Manage
{
[Route("/Base_Manage/[controller]/[action]")]
[OpenApiTag("上传")]
public class UploadController : BaseApiController
{
readonly IConfiguration _configuration;
public UploadController(IConfiguration configuration)
{
_configuration = configuration;
}
[HttpPost]
//[AllowAnonymous]
public IActionResult UploadFileByForm(IFormFile formFile)
{
var file = formFile;
if (file == null)
return JsonContent(new { status = "error" }.ToJson());
string path = $"/Upload/{Guid.NewGuid().ToString("N")}/{file.FileName}";
string physicPath = GetAbsolutePath($"~{path}");
string dir = Path.GetDirectoryName(physicPath);
if (!Directory.Exists(dir))
Directory.CreateDirectory(dir);
using (FileStream fs = new FileStream(physicPath, FileMode.Create))
{
file.CopyTo(fs);
}
string url = $"{_configuration["WebRootUrl"]}{path}";
var res = new
{
name = file.FileName,
status = "done",
thumbUrl = url,
url = url
};
return JsonContent(res.ToJson());
}
}
}

85
src/Coldairarrow.Api/Controllers/HuiYan/catsController.cs

@ -0,0 +1,85 @@
using Coldairarrow.Business.HuiYan;
using Coldairarrow.Entity.DTO;
using Coldairarrow.Entity.HuiYan;
using Coldairarrow.Util;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Coldairarrow.Api.Controllers.HuiYan
{
[Route("/HuiYan/[controller]/[action]")]
public class catsController : BaseApiController
{
#region DI
public catsController(IcatsBusiness catsBus)
{
_catsBus = catsBus;
}
IcatsBusiness _catsBus { get; }
#endregion
#region 获取
[HttpPost]
public async Task<PageResult<cats>> GetDataList(PageInput<ConditionDTO> input)
{
return await _catsBus.GetDataListAsync(input);
}
[HttpPost]
public async Task<cats> GetTheData(IdInputDTO input)
{
return await _catsBus.GetTheDataAsync(input.id);
}
#endregion
#region 提交
[HttpPost]
public async Task SaveData(cats data)
{
if (data.Id.IsNullOrEmpty())
{
InitEntity(data);
await _catsBus.AddDataAsync(data);
}
else
{
await _catsBus.UpdateDataAsync(data);
}
}
[HttpPost]
public AjaxResult AddKeyWord([FromBody]CatDto model)
{
return _catsBus.AddKeyWord(model);
}
[HttpPost]
public async Task DeleteData(List<string> ids)
{
await _catsBus.DeleteDataAsync(ids);
}
[HttpPost]
public async Task<List<CatTreeDTO>> GetTreeDataListAsync(CatsTreeInputDTO input)
{
return await _catsBus.GetTreeDataListAsync(input);
}
[HttpGet]
public AjaxResult GetParentCatList()
{
return _catsBus.GetParentCatList();
}
#endregion
}
}

51
src/Coldairarrow.Api/Controllers/TestController.cs

@ -0,0 +1,51 @@
using Coldairarrow.Entity.Base_Manage;
using Coldairarrow.Util;
using EFCore.Sharding;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using System;
using System.Linq;
using System.Threading.Tasks;
namespace Coldairarrow.Api.Controllers
{
[Route("/[controller]/[action]")]
[AllowAnonymous]
public class TestController : BaseController
{
readonly IDbAccessor _repository;
public TestController(IDbAccessor repository)
{
_repository = repository;
}
[HttpGet]
public async Task PressTest()
{
Base_User base_User = new Base_User
{
Id = Guid.NewGuid().ToString(),
Birthday = DateTime.Now,
CreateTime = DateTime.Now,
CreatorId = Guid.NewGuid().ToString(),
DepartmentId = Guid.NewGuid().ToString(),
Password = Guid.NewGuid().ToString(),
RealName = Guid.NewGuid().ToString(),
Sex = Sex.Man,
UserName = Guid.NewGuid().ToString()
};
await _repository.InsertAsync(base_User);
await _repository.UpdateAsync(base_User);
await _repository.GetIQueryable<Base_User>().Where(x => x.Id == base_User.Id).FirstOrDefaultAsync();
await _repository.DeleteAsync(base_User);
}
[HttpGet]
public async Task<PageResult<Base_UserLog>> GetLogList()
{
return await _repository.GetIQueryable<Base_UserLog>().GetPageResultAsync(new PageInput());
}
}
}

98
src/Coldairarrow.Api/DependencyInjection/Operator.cs

@ -0,0 +1,98 @@
using Coldairarrow.Business.Cache;
using Coldairarrow.Entity;
using Coldairarrow.Entity.Base_Manage;
using Coldairarrow.IBusiness;
using Coldairarrow.Util;
using EFCore.Sharding;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Linq;
using System.Threading.Tasks;
namespace Coldairarrow.Api
{
/// <summary>
/// 操作者
/// </summary>
public class Operator : IOperator, IScopedDependency
{
readonly IBase_UserCache _userCache;
readonly IServiceProvider _serviceProvider;
public Operator(IBase_UserCache userCache, IHttpContextAccessor httpContextAccessor, IServiceProvider serviceProvider)
{
_serviceProvider = serviceProvider;
_userCache = userCache;
UserId = httpContextAccessor?.HttpContext?.User.Claims
.Where(x => x.Type == "userId").FirstOrDefault()?.Value;
}
private Base_UserDTO _property;
private object _lockObj = new object();
/// <summary>
/// 当前操作者UserId
/// </summary>
public string UserId { get; }
/// <summary>
/// 属性
/// </summary>
public Base_UserDTO Property
{
get
{
if (UserId.IsNullOrEmpty())
return default;
if (_property == null)
{
lock (_lockObj)
{
if (_property == null)
{
_property = AsyncHelper.RunSync(() => _userCache.GetCacheAsync(UserId));
}
}
}
return _property;
}
}
/// <summary>
/// 判断是否为超级管理员
/// </summary>
/// <returns></returns>
public bool IsAdmin()
{
var role = Property.RoleType;
if (UserId == GlobalAssemblies.ADMINID || role.HasFlag(RoleTypes.))
return true;
else
return false;
}
public void WriteUserLog(UserLogType userLogType, string msg)
{
var log = new Base_UserLog
{
Id = IdHelper.GetId(),
CreateTime = DateTime.Now,
CreatorId = UserId,
CreatorRealName = Property.RealName,
LogContent = msg,
LogType = userLogType.ToString()
};
Task.Factory.StartNew(async () =>
{
using (var scop = _serviceProvider.CreateScope())
{
var db = scop.ServiceProvider.GetService<IDbAccessor>();
await db.InsertAsync(log);
}
}, TaskCreationOptions.LongRunning);
}
}
}

8
src/Coldairarrow.Api/Dockerfile

@ -0,0 +1,8 @@
#使用阿里云镜像,微软镜像太慢
#FROM docker pull mcr.microsoft.com/dotnet/aspnet:5.0.2
FROM registry.cn-hangzhou.aliyuncs.com/colder-public/aspnet:5.0.2
RUN rm -f /etc/localtime && ln -sv /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo "Asia/Shanghai" > /etc/timezone
WORKDIR /app
COPY . .
EXPOSE 5000
ENTRYPOINT ["dotnet","Coldairarrow.Api.dll"]

61
src/Coldairarrow.Api/Extentions/HostExtentions.cs

@ -0,0 +1,61 @@
using Coldairarrow.Util;
using CSRedis;
using Microsoft.Extensions.Caching.Distributed;
using Microsoft.Extensions.Caching.Redis;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using System;
namespace Coldairarrow.Api
{
public static class HostExtentions
{
/// <summary>
/// 使用IdHelper
/// </summary>
/// <param name="hostBuilder">建造者</param>
/// <returns></returns>
public static IHostBuilder UseIdHelper(this IHostBuilder hostBuilder)
{
hostBuilder.ConfigureServices((buidler, services) =>
{
new IdHelperBootstrapper()
//设置WorkerId
.SetWorkderId(buidler.Configuration["WorkerId"].ToLong())
//使用Zookeeper
//.UseZookeeper("127.0.0.1:2181", 200, GlobalSwitch.ProjectName)
.Boot();
});
return hostBuilder;
}
/// <summary>
/// 使用缓存
/// </summary>
/// <param name="hostBuilder">建造者</param>
/// <returns></returns>
public static IHostBuilder UseCache(this IHostBuilder hostBuilder)
{
hostBuilder.ConfigureServices((buidlerContext, services) =>
{
var cacheOption = buidlerContext.Configuration.GetSection("Cache").Get<CacheOptions>();
switch (cacheOption.CacheType)
{
case CacheType.Memory: services.AddDistributedMemoryCache(); break;
case CacheType.Redis:
{
var csredis = new CSRedisClient(cacheOption.RedisEndpoint);
RedisHelper.Initialization(csredis);
services.AddSingleton(csredis);
services.AddSingleton<IDistributedCache>(new CSRedisCache(RedisHelper.Instance));
}; break;
default: throw new Exception("缓存类型无效");
}
});
return hostBuilder;
}
}
}

41
src/Coldairarrow.Api/Extentions/JwtExtentions.cs

@ -0,0 +1,41 @@
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.IdentityModel.Tokens;
using System;
using System.Text;
namespace Coldairarrow.Api
{
public static class JwtExtentions
{
public static IServiceCollection AddJwt(this IServiceCollection services, IConfiguration configuration)
{
services.Configure<JwtOptions>(configuration.GetSection("jwt"));
var jwtOptions = configuration.GetSection("jwt").Get<JwtOptions>();
services.AddAuthentication(x =>
{
x.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
x.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
}).AddJwtBearer(x =>
{
x.RequireHttpsMetadata = false;
x.SaveToken = false;
//Token Validation Parameters
x.TokenValidationParameters = new TokenValidationParameters
{
ClockSkew = TimeSpan.Zero,//到时间立即过期
ValidateIssuerSigningKey = true,
//获取或设置要使用的Microsoft.IdentityModel.Tokens.SecurityKey用于签名验证。
IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.
GetBytes(jwtOptions.Secret)),
ValidateIssuer = false,
ValidateAudience = false,
};
});
return services;
}
}
}

138
src/Coldairarrow.Api/Filters/BaseActionFilterAsync.cs

@ -0,0 +1,138 @@
using Coldairarrow.Util;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
using System;
using System.Threading.Tasks;
namespace Coldairarrow.Api
{
public abstract class BaseActionFilterAsync : Attribute, IAsyncActionFilter
{
public async virtual Task OnActionExecuting(ActionExecutingContext context)
{
await Task.CompletedTask;
}
public async virtual Task OnActionExecuted(ActionExecutedContext context)
{
await Task.CompletedTask;
}
public async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
{
await OnActionExecuting(context);
if (context.Result == null)
{
var nextContext = await next();
await OnActionExecuted(nextContext);
}
}
/// <summary>
/// 返回JSON
/// </summary>
/// <param name="json">json字符串</param>
/// <returns></returns>
public ContentResult JsonContent(string json)
{
return new ContentResult { Content = json, StatusCode = 200, ContentType = "application/json; charset=utf-8" };
}
/// <summary>
/// 返回成功
/// </summary>
/// <returns></returns>
public ContentResult Success()
{
AjaxResult res = new AjaxResult
{
Success = true,
Msg = "请求成功!"
};
return JsonContent(res.ToJson());
}
/// <summary>
/// 返回成功
/// </summary>
/// <param name="msg">消息</param>
/// <returns></returns>
public ContentResult Success(string msg)
{
AjaxResult res = new AjaxResult
{
Success = true,
Msg = msg
};
return JsonContent(res.ToJson());
}
/// <summary>
/// 返回成功
/// </summary>
/// <param name="data">返回的数据</param>
/// <returns></returns>
public ContentResult Success<T>(T data)
{
AjaxResult<T> res = new AjaxResult<T>
{
Success = true,
Msg = "请求成功!",
Data = data
};
return JsonContent(res.ToJson());
}
/// <summary>
/// 返回错误
/// </summary>
/// <returns></returns>
public ContentResult Error()
{
AjaxResult res = new AjaxResult
{
Success = false,
Msg = "请求失败!"
};
return JsonContent(res.ToJson());
}
/// <summary>
/// 返回错误
/// </summary>
/// <param name="msg">错误提示</param>
/// <returns></returns>
public ContentResult Error(string msg)
{
AjaxResult res = new AjaxResult
{
Success = false,
Msg = msg,
};
return JsonContent(res.ToJson());
}
/// <summary>
/// 返回错误
/// </summary>
/// <param name="msg">错误提示</param>
/// <param name="errorCode">错误代码</param>
/// <returns></returns>
public ContentResult Error(string msg, int errorCode)
{
AjaxResult res = new AjaxResult
{
Success = false,
Msg = msg,
ErrorCode = errorCode
};
return JsonContent(res.ToJson());
}
}
}

19
src/Coldairarrow.Api/Filters/FilterExtentions.cs

@ -0,0 +1,19 @@
using Microsoft.AspNetCore.Mvc.Filters;
using System.Linq;
namespace Coldairarrow.Api
{
public static class FilterExtentions
{
/// <summary>
/// 是否拥有某过滤器
/// </summary>
/// <typeparam name="T">过滤器类型</typeparam>
/// <param name="actionExecutingContext">上下文</param>
/// <returns></returns>
public static bool ContainsFilter<T>(this FilterContext actionExecutingContext)
{
return actionExecutingContext.Filters.Any(x => x.GetType() == typeof(T));
}
}
}

35
src/Coldairarrow.Api/Filters/全局错误过滤/GlobalExceptionFilter.cs

@ -0,0 +1,35 @@
using Coldairarrow.Util;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.Extensions.Logging;
using System;
using System.Threading.Tasks;
namespace Coldairarrow.Api
{
public class GlobalExceptionFilter : BaseActionFilterAsync, IAsyncExceptionFilter
{
readonly ILogger _logger;
public GlobalExceptionFilter(ILogger<GlobalExceptionFilter> logger)
{
_logger = logger;
}
public async Task OnExceptionAsync(ExceptionContext context)
{
Exception ex = context.Exception;
if (ex is BusException busEx)
{
_logger.LogInformation(busEx.Message);
context.Result = Error(busEx.Message, busEx.ErrorCode);
}
else
{
_logger.LogError(ex, "");
context.Result = Error("系统繁忙");
}
await Task.CompletedTask;
}
}
}

21
src/Coldairarrow.Api/Filters/参数校验/ValidFilterAttribute.cs

@ -0,0 +1,21 @@
using Microsoft.AspNetCore.Mvc.Filters;
using System.Linq;
using System.Threading.Tasks;
namespace Coldairarrow.Api
{
public class ValidFilterAttribute : BaseActionFilterAsync
{
public override async Task OnActionExecuting(ActionExecutingContext context)
{
if (!context.ModelState.IsValid)
{
var msgList = context.ModelState.Values.SelectMany(x => x.Errors).Select(x => x.ErrorMessage);
context.Result = Error(string.Join(",", msgList));
}
await Task.CompletedTask;
}
}
}

157
src/Coldairarrow.Api/Filters/对外接口签名校验/CheckSignAttribute.cs

@ -0,0 +1,157 @@
using Coldairarrow.Business.Base_Manage;
using Coldairarrow.Util;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.Extensions.Caching.Distributed;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using System;
using System.Threading.Tasks;
namespace Coldairarrow.Api
{
/*
==== ====
header
| header名 | | |
| appId | string | Id |
| time | string | 2017-01-01 23:00:00 |
| guid | string | GUID字符串,, |
| sign| string | , |
:
appId=xxx
appSecret=xxx
time=2017-01-01 23:00:00
guid=d0595245-60db-495d-9c0e-fea931b8d69a
body={"aaa":"aaa"}
1: appId+time+guid+body+appSecret得到xxx2017-01-01 23:00:00d0595245-60db-495d-9c0e-fea931b8d69a{"aaa":"aaa"}xxx
2: MD5(32)
sign=MD5(xxx2017-01-01 23:00:00d0595245-60db-495d-9c0e-fea931b8d69a{"aaa":"aaa"}xxx)
=4e30f1eca521485c208f642a7d927ff0
3: header中携带上述的appIdtimeguidsign即可
使Demo请看:
src\Coldairarrow.Web\src\utils\plugin\axios-plugin.js
*/
/// <summary>
/// 校验签名、十分严格
/// 防抵赖、防伪造、防重复调用
/// </summary>
public class CheckSignAttribute : BaseActionFilterAsync
{
/// <summary>
/// Action执行之前执行
/// </summary>
/// <param name="filterContext"></param>
public async override Task OnActionExecuting(ActionExecutingContext filterContext)
{
//判断是否需要签名
if (filterContext.ContainsFilter<IgnoreSignAttribute>())
return;
var request = filterContext.HttpContext.Request;
IServiceProvider serviceProvider = filterContext.HttpContext.RequestServices;
IBase_AppSecretBusiness appSecretBus = serviceProvider.GetService<IBase_AppSecretBusiness>();
ILogger logger = serviceProvider.GetService<ILogger<CheckSignAttribute>>();
var cache = serviceProvider.GetService<IDistributedCache>();
string appId = request.Headers["appId"].ToString();
if (appId.IsNullOrEmpty())
{
ReturnError("缺少header:appId");
return;
}
string time = request.Headers["time"].ToString();
if (time.IsNullOrEmpty())
{
ReturnError("缺少header:time");
return;
}
if (time.ToDateTime() < DateTime.Now.AddMinutes(-5) || time.ToDateTime() > DateTime.Now.AddMinutes(5))
{
ReturnError("time过期");
return;
}
string guid = request.Headers["guid"].ToString();
if (guid.IsNullOrEmpty())
{
ReturnError("缺少header:guid");
return;
}
string guidKey = $"ApiGuid_{guid}";
if (cache.GetString(guidKey).IsNullOrEmpty())
cache.SetString(guidKey, "1", new DistributedCacheEntryOptions
{
AbsoluteExpirationRelativeToNow = TimeSpan.FromMinutes(10)
});
else
{
ReturnError("禁止重复调用!");
return;
}
request.EnableBuffering();
string body = await request.Body.ReadToStringAsync();
string sign = request.Headers["sign"].ToString();
if (sign.IsNullOrEmpty())
{
ReturnError("缺少header:sign");
return;
}
string appSecret = await appSecretBus.GetAppSecretAsync(appId);
if (appSecret.IsNullOrEmpty())
{
ReturnError("header:appId无效");
return;
}
string newSign = BuildApiSign(appId, appSecret, guid, time.ToDateTime(), body);
if (sign != newSign)
{
string log =
$@"sign签名错误!
headers:{request.Headers.ToJson()}
body:{body}
sign:{newSign}
";
logger.LogWarning(log);
ReturnError("header:sign签名错误");
return;
}
void ReturnError(string msg)
{
filterContext.Result = Error(msg);
}
}
/// <summary>
/// 生成接口签名sign
/// 注:md5(appId+time+guid+body+appSecret)
/// </summary>
/// <param name="appId">应用Id</param>
/// <param name="appSecret">应用密钥</param>
/// <param name="guid">唯一GUID</param>
/// <param name="time">时间</param>
/// <param name="body">请求体</param>
/// <returns></returns>
private string BuildApiSign(string appId, string appSecret, string guid, DateTime time, string body)
{
return $"{appId}{time.ToString("yyyy-MM-dd HH:mm:ss")}{guid}{body}{appSecret}".ToMD5String();
}
}
}

10
src/Coldairarrow.Api/Filters/对外接口签名校验/IgnoreSignAttribute.cs

@ -0,0 +1,10 @@
namespace Coldairarrow.Api
{
/// <summary>
/// 忽略接口签名校验
/// </summary>
public class IgnoreSignAttribute : BaseActionFilterAsync
{
}
}

44
src/Coldairarrow.Api/Filters/接口权限/ApiPermissionAttribute.cs

@ -0,0 +1,44 @@
using Coldairarrow.Business.Base_Manage;
using Coldairarrow.IBusiness;
using Coldairarrow.Util;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Threading.Tasks;
namespace Coldairarrow.Api
{
/// <summary>
/// 接口权限校验
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true)]
public class ApiPermissionAttribute : BaseActionFilterAsync
{
public ApiPermissionAttribute(string permissionValue)
{
if (permissionValue.IsNullOrEmpty())
throw new Exception("permissionValue不能为空");
_permissionValue = permissionValue;
}
public string _permissionValue { get; }
/// <summary>
/// Action执行之前执行
/// </summary>
/// <param name="context">过滤器上下文</param>
public async override Task OnActionExecuting(ActionExecutingContext context)
{
if (context.ContainsFilter<NoApiPermissionAttribute>())
return;
IServiceProvider serviceProvider = context.HttpContext.RequestServices;
IPermissionBusiness _permissionBus = serviceProvider.GetService<IPermissionBusiness>();
IOperator _operator = serviceProvider.GetService<IOperator>();
var permissions = await _permissionBus.GetUserPermissionValuesAsync(_operator.UserId);
if (!permissions.Contains(_permissionValue))
context.Result = Error("权限不足!");
}
}
}

10
src/Coldairarrow.Api/Filters/接口权限/NoApiPermissionAttribute.cs

@ -0,0 +1,10 @@
namespace Coldairarrow.Api
{
/// <summary>
/// 忽略接口权限校验
/// </summary>
public class NoApiPermissionAttribute : BaseActionFilterAsync
{
}
}

31
src/Coldairarrow.Api/Filters/格式化返回结果/FormatResponseAttribute.cs

@ -0,0 +1,31 @@
using Coldairarrow.Util;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
using System.Threading.Tasks;
namespace Coldairarrow.Api
{
/// <summary>
/// 若Action返回对象为自定义对象,则将其转为JSON
/// </summary>
public class FormatResponseAttribute : BaseActionFilterAsync
{
public override async Task OnActionExecuted(ActionExecutedContext context)
{
if (context.ContainsFilter<NoFormatResponseAttribute>())
return;
if (context.Result is EmptyResult)
context.Result = Success();
else if (context.Result is ObjectResult res)
{
if (res.Value is AjaxResult)
context.Result = JsonContent(res.Value.ToJson());
else
context.Result = Success(res.Value);
}
await Task.CompletedTask;
}
}
}

29
src/Coldairarrow.Api/Filters/格式化返回结果/NoFormatResponseAttribute.cs

@ -0,0 +1,29 @@
using Microsoft.AspNetCore.Mvc.Filters;
using System;
namespace Coldairarrow.Api
{
/// <summary>
/// 返回结果不进行格式化
/// </summary>
public class NoFormatResponseAttribute : Attribute, IActionFilter
{
/// <summary>
/// Action执行之前执行
/// </summary>
/// <param name="context">过滤器上下文</param>
public void OnActionExecuting(ActionExecutingContext context)
{
}
/// <summary>
/// Action执行完毕之后执行
/// </summary>
/// <param name="context"></param>
public void OnActionExecuted(ActionExecutedContext context)
{
}
}
}

9
src/Coldairarrow.Api/Middlewares/RequestBody.cs

@ -0,0 +1,9 @@
using Coldairarrow.Util;
namespace Coldairarrow.Api
{
public class RequestBody : IScopedDependency
{
public string Body { get; set; }
}
}

30
src/Coldairarrow.Api/Middlewares/RequestBodyMiddleware.cs

@ -0,0 +1,30 @@
using Coldairarrow.Util;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using System.Text;
using System.Threading.Tasks;
namespace Coldairarrow.Api
{
public class RequestBodyMiddleware
{
private readonly RequestDelegate _next;
public RequestBodyMiddleware(RequestDelegate next)
{
_next = next;
}
public async Task Invoke(HttpContext context)
{
if ((context.Request.ContentType ?? string.Empty).Contains("application/json"))
{
context.Request.EnableBuffering();
string body = await context.Request.Body?.ReadToStringAsync(Encoding.UTF8);
context.RequestServices.GetService<RequestBody>().Body = body;
}
await _next(context);
}
}
}

83
src/Coldairarrow.Api/Middlewares/RequestLogMiddleware.cs

@ -0,0 +1,83 @@
using Coldairarrow.Util;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
namespace Coldairarrow.Api
{
public class RequestLogMiddleware
{
private readonly RequestDelegate _next;
private readonly ILogger _logger;
public RequestLogMiddleware(RequestDelegate next, ILogger<RequestLogMiddleware> logger)
{
_next = next;
_logger = logger;
}
public async Task Invoke(HttpContext context)
{
Stopwatch watch = Stopwatch.StartNew();
string resContent = string.Empty;
//返回Body需特殊处理
Stream originalResponseBody = context.Response.Body;
using var memStream = new MemoryStream();
context.Response.Body = memStream;
try
{
await _next(context);
memStream.Position = 0;
resContent = new StreamReader(memStream).ReadToEnd();
memStream.Position = 0;
await memStream.CopyToAsync(originalResponseBody);
}
catch
{
throw;
}
finally
{
context.Response.Body = originalResponseBody;
watch.Stop();
if (resContent?.Length > 1000)
{
resContent = new string(resContent.Copy(0, 1000).ToArray());
resContent += "......内容太长已忽略";
}
string log =
@"方向:请求本系统
Url:{Url}
Time:{Time}ms
Method:{Method}
ContentType:{ContentType}
Body:{Body}
StatusCode:{StatusCode}
Response:{Response}
";
_logger.LogInformation(
log,
context.Request.Path,
(int)watch.ElapsedMilliseconds,
context.Request.Method,
context.Request.ContentType,
context.RequestServices.GetService<RequestBody>().Body,
context.Response.StatusCode,
resContent
);
}
}
}
}

8
src/Coldairarrow.Api/Options/CacheOptions.cs

@ -0,0 +1,8 @@
namespace Coldairarrow.Api
{
internal class CacheOptions
{
public CacheType CacheType { get; set; }
public string RedisEndpoint { get; set; }
}
}

18
src/Coldairarrow.Api/Options/CacheType.cs

@ -0,0 +1,18 @@
namespace Coldairarrow.Api
{
/// <summary>
/// 缓存类型
/// </summary>
public enum CacheType
{
/// <summary>
/// 使用内存缓存(不支持分布式)
/// </summary>
Memory,
/// <summary>
/// 使用Redis缓存(支持分布式)
/// </summary>
Redis
}
}

10
src/Coldairarrow.Api/Options/JwtOptions.cs

@ -0,0 +1,10 @@
namespace Coldairarrow.Api
{
public class JwtOptions
{
public string Secret { get; set; }
public int AccessExpireHours { get; set; }
public int RefreshExpireHours { get; set; }
}
}

39
src/Coldairarrow.Api/Program.cs

@ -0,0 +1,39 @@
using Coldairarrow.Util;
using Colder.Logging.Serilog;
using EFCore.Sharding;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
namespace Coldairarrow.Api
{
public class Program
{
public static void Main(string[] args)
{
Host.CreateDefaultBuilder(args)
.ConfigureLoggingDefaults()
.UseIdHelper()
.UseCache()
.ConfigureServices((hostContext, services) =>
{
services.AddFxServices();
services.AddAutoMapper();
services.AddEFCoreSharding(config =>
{
config.SetEntityAssemblies(GlobalAssemblies.AllAssemblies);
var dbOptions = hostContext.Configuration.GetSection("Database:BaseDb").Get<DatabaseOptions>();
config.UseDatabase(dbOptions.ConnectionString, dbOptions.DatabaseType);
});
})
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
})
.Build()
.Run();
}
}
}

19
src/Coldairarrow.Api/Properties/PublishProfiles/FolderProfile.pubxml

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
此文件由 Web 项目的发布/打包过程使用。可以通过编辑此 MSBuild 文件
自定义此过程的行为。为了解与此相关的更多内容,请访问 https://go.microsoft.com/fwlink/?LinkID=208121。
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>FileSystem</WebPublishMethod>
<PublishProvider>FileSystem</PublishProvider>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish />
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<ExcludeApp_Data>False</ExcludeApp_Data>
<ProjectGuid>bea1bf0d-b063-4931-89c7-22f92973143a</ProjectGuid>
<publishUrl>bin\Release\netcoreapp3.1\publish\</publishUrl>
<DeleteExistingFiles>False</DeleteExistingFiles>
</PropertyGroup>
</Project>

13
src/Coldairarrow.Api/Properties/launchSettings.json

@ -0,0 +1,13 @@
{
"profiles": {
"Coldairarrow.Api": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:5000"
}
}
}

93
src/Coldairarrow.Api/Startup.cs

@ -0,0 +1,93 @@
using Coldairarrow.Util;
using EFCore.Sharding;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.HttpOverrides;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using NSwag;
using System.Linq;
namespace Coldairarrow.Api
{
public class Startup
{
public Startup(IConfiguration configuration)
{
_configuration = configuration;
}
private readonly IConfiguration _configuration;
public void ConfigureServices(IServiceCollection services)
{
services.Configure<ApiBehaviorOptions>(options => options.SuppressModelStateInvalidFilter = true);
services.AddControllers(options =>
{
options.Filters.Add<ValidFilterAttribute>();
options.Filters.Add<GlobalExceptionFilter>();
})
.AddNewtonsoftJson(options =>
{
options.SerializerSettings.GetType().GetProperties().ForEach(aProperty =>
{
var value = aProperty.GetValue(JsonExtention.DefaultJsonSetting);
aProperty.SetValue(options.SerializerSettings, value);
});
});
services.AddHttpContextAccessor();
//swagger
services.AddOpenApiDocument(settings =>
{
settings.AllowReferencesWithProperties = true;
settings.AddSecurity("身份认证Token", Enumerable.Empty<string>(), new OpenApiSecurityScheme()
{
Scheme = "bearer",
Description = "Authorization:Bearer {your JWT token}<br/><b>授权地址:/Base_Manage/Home/SubmitLogin</b>",
Name = "Authorization",
In = OpenApiSecurityApiKeyLocation.Header,
Type = OpenApiSecuritySchemeType.Http
});
});
//jwt
services.AddJwt(_configuration);
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
//跨域
app.UseCors(x =>
{
x.AllowAnyOrigin()
.AllowAnyHeader()
.AllowAnyMethod()
.DisallowCredentials();
})
.UseForwardedHeaders(new ForwardedHeadersOptions
{
ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto
})
.UseMiddleware<RequestBodyMiddleware>()
.UseMiddleware<RequestLogMiddleware>()
.UseDeveloperExceptionPage()
.UseStaticFiles(new StaticFileOptions
{
ServeUnknownFileTypes = true,
DefaultContentType = "application/octet-stream"
})
.UseRouting()
.UseAuthentication()
.UseAuthorization()
.UseEndpoints(endpoints =>
{
endpoints.MapControllers().RequireAuthorization();
})
.UseOpenApi()//添加swagger生成api文档(默认路由文档 /swagger/v1/swagger.json)
.UseSwaggerUi3()//添加Swagger UI到请求管道中(默认路由: /swagger).
;
}
}
}

3
src/Coldairarrow.Api/appsettings.Development.json

@ -0,0 +1,3 @@
{
}

59
src/Coldairarrow.Api/appsettings.json

@ -0,0 +1,59 @@
{
"urls": "http://*:5000",
"AllowedHosts": "*",
"log": { //
"minlevel": "Trace", //Microsoft.Extensions.Logging.LogLevel
"console": {
"enabled": true
},
"debug": {
"enabled": true
},
"file": {
"enabled": true
},
"elasticsearch": {
"enabled": false,
"nodes": [ "http://elastic:123456@localhost:9200/" ],
"indexformat": "colder.{0:yyyyMMdd}"
},
"overrides": [ //
{
"source": "Microsoft.AspNetCore",
"minlevel": "Warning"
},
{
"source": "Microsoft.EntityFrameworkCore",
"minlevel": "Warning"
},
{
"source": "Microsoft.EntityFrameworkCore.Infrastructure",
"minlevel": "Warning"
}
]
},
"Cache": {
"CacheType": "Memory", //Coldairarrow.Util.CacheType
"RedisEndpoint": "127.0.0.1:6379" //Redis, https://github.com/2881099/csredis
},
"Database": {
"BaseDb": {
//"DatabaseType": "SqlServer", //EFCore.Sharding.DatabaseType
//"ConnectionString": "Data Source=.;Initial Catalog=Colder.Admin.AntdVue;Integrated Security=True;Pooling=true;"
//"DatabaseType": "PostgreSql",
//"ConnectionString": "Server=127.0.0.1;Port=5432;Database=Colder.Admin.AntdVue;User Id=postgres;Password=postgres;"
"DatabaseType": "MySql",
"ConnectionString": "server=116.62.61.68;user id=jdhy;password=kaicn1132+-;persistsecurityinfo=True;database=jdhy;SslMode=none;AllowLoadLocalInfile=true"
//"DatabaseType": "Oracle",
//"ConnectionString": "Data Source=127.0.0.1/ORCL;User ID=COLDER.ADMIN.ANTDVUE;Password=123456;Connect Timeout=3"
}
},
//Id,,,IdId
"WorkerId": 1, //Id
"WebRootUrl": "http://localhost:5000", //,
"jwt": {
"secret": "D96BFA5B-F2AF-45BC-9342-5A55C3F9BBB0",
"accessExpireHours": 24,
"refreshExpireHours": 24
}
}

BIN
src/Coldairarrow.Api/nssm.exe

Binary file not shown.

17
src/Coldairarrow.Business/04.Coldairarrow.Business.csproj

@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<RootNamespace>Coldairarrow.Business</RootNamespace>
<AssemblyName>Coldairarrow.Business</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<NoWarn>1701;1702;CS1591</NoWarn>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Coldairarrow.IBusiness\03.Coldairarrow.IBusiness.csproj" />
</ItemGroup>
</Project>

24
src/Coldairarrow.Business/AOP/DataAddLogAttribute.cs

@ -0,0 +1,24 @@
using Coldairarrow.IBusiness;
using Coldairarrow.Util;
using Microsoft.Extensions.DependencyInjection;
using System.Threading.Tasks;
namespace Coldairarrow.Business
{
public class DataAddLogAttribute : WriteDataLogAttribute
{
public DataAddLogAttribute(UserLogType logType, string nameField, string dataName)
: base(logType, nameField, dataName)
{
}
public override async Task After(IAOPContext context)
{
var op = context.ServiceProvider.GetService<IOperator>();
var obj = context.Arguments[0];
op.WriteUserLog(_logType, $"添加{_dataName}:{obj.GetPropertyValue(_nameField)?.ToString()}");
await Task.CompletedTask;
}
}
}

38
src/Coldairarrow.Business/AOP/DataDeleteLogAttribute.cs

@ -0,0 +1,38 @@
using Coldairarrow.IBusiness;
using Coldairarrow.Util;
using Microsoft.Extensions.DependencyInjection;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Dynamic.Core;
using System.Threading.Tasks;
namespace Coldairarrow.Business
{
public class DataDeleteLogAttribute : WriteDataLogAttribute
{
public DataDeleteLogAttribute(UserLogType logType, string nameField, string dataName)
: base(logType, nameField, dataName)
{
}
private string _names;
public override async Task Befor(IAOPContext context)
{
List<string> ids = context.Arguments[0] as List<string>;
var q = context.InvocationTarget.GetType().GetMethod("GetIQueryable").Invoke(context.InvocationTarget, new object[] { }) as IQueryable;
var deleteList = q.Where("@0.Contains(Id)", ids).CastToList<object>();
_names = string.Join(",", deleteList.Select(x => x.GetPropertyValue(_nameField)?.ToString()));
await Task.CompletedTask;
}
public override async Task After(IAOPContext context)
{
var op = context.ServiceProvider.GetService<IOperator>();
op.WriteUserLog(_logType, $"删除{_dataName}:{_names}");
await Task.CompletedTask;
}
}
}

24
src/Coldairarrow.Business/AOP/DataEditLogAttribute.cs

@ -0,0 +1,24 @@
using Coldairarrow.IBusiness;
using Coldairarrow.Util;
using Microsoft.Extensions.DependencyInjection;
using System.Threading.Tasks;
namespace Coldairarrow.Business
{
public class DataEditLogAttribute : WriteDataLogAttribute
{
public DataEditLogAttribute(UserLogType logType, string nameField, string dataName)
: base(logType, nameField, dataName)
{
}
public override async Task After(IAOPContext context)
{
var op = context.ServiceProvider.GetService<IOperator>();
var obj = context.Arguments[0];
op.WriteUserLog(_logType, $"修改{_dataName}:{obj.GetPropertyValue(_nameField)?.ToString()}");
await Task.CompletedTask;
}
}
}

68
src/Coldairarrow.Business/AOP/DataRepeatValidateAttribute.cs

@ -0,0 +1,68 @@
using Coldairarrow.Util;
using EFCore.Sharding;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Dynamic.Core;
using System.Threading.Tasks;
namespace Coldairarrow.Business
{
public class DataRepeatValidateAttribute : BaseAOPAttribute
{
public DataRepeatValidateAttribute(string[] validateFields, string[] validateFieldNames, bool allData = false, bool matchOr = true)
{
if (validateFields.Length != validateFieldNames.Length)
throw new Exception("校验列与列描述信息不对应!");
_allData = allData;
_matchOr = matchOr;
for (int i = 0; i < validateFields.Length; i++)
{
_validateFields.Add(validateFields[i], validateFieldNames[i]);
}
}
private bool _allData { get; }
private bool _matchOr { get; }
private Dictionary<string, string> _validateFields { get; } = new Dictionary<string, string>();
public override async Task Befor(IAOPContext context)
{
Type entityType = context.Arguments[0].GetType();
var data = context.Arguments[0];
List<string> whereList = new List<string>();
var properties = _validateFields
.Where(x => !data.GetPropertyValue(x.Key).IsNullOrEmpty())
.ToList();
properties.ForEach((aProperty, index) =>
{
whereList.Add($" {aProperty.Key} = @{index} ");
});
IQueryable q = null;
if (_allData)
{
var repository = context.Proxy.GetPropertyValue("Service") as IDbAccessor;
var method = repository.GetMethod("GetIQueryable");
q = method.MakeGenericMethod(entityType).Invoke(repository, new object[] { }) as IQueryable;
}
else
q = context.InvocationTarget.GetType().GetMethod("GetIQueryable").Invoke(context.InvocationTarget, new object[] { }) as IQueryable;
q = q.Where("Id != @0", data.GetPropertyValue("Id"));
q = q.Where(
string.Join(_matchOr ? " || " : " && ", whereList),
properties.Select(x => data.GetPropertyValue(x.Key)).ToArray());
var list = q.CastToList<object>();
if (list.Count > 0)
{
var repeatList = properties
.Where(x => list.Any(y => !y.GetPropertyValue(x.Key).IsNullOrEmpty()))
.Select(x => x.Value)
.ToList();
throw new BusException($"{string.Join(_matchOr ? "" : "", repeatList)}已存在!");
}
await Task.CompletedTask;
}
}
}

19
src/Coldairarrow.Business/AOP/WriteDataLogAttribute.cs

@ -0,0 +1,19 @@
using Coldairarrow.Util;
using System;
namespace Coldairarrow.Business
{
public abstract class WriteDataLogAttribute : BaseAOPAttribute
{
public WriteDataLogAttribute(UserLogType logType, string nameField, string dataName)
{
_logType = logType;
_dataName = dataName;
_nameField = nameField;
}
protected UserLogType _logType { get; }
protected string _dataName { get; }
protected string _nameField { get; }
protected Type _entityType { get; }
}
}

536
src/Coldairarrow.Business/BaseBusiness.T.cs

@ -0,0 +1,536 @@
using Coldairarrow.Util;
using EFCore.Sharding;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Linq.Dynamic.Core;
using System.Linq.Expressions;
using System.Threading.Tasks;
namespace Coldairarrow.Business
{
/// <summary>
/// 描述:业务处理基类
/// </summary>
/// <typeparam name="T">泛型约束(数据库实体)</typeparam>
public abstract class BaseBusiness<T> where T : class, new()
{
#region 构造函数
/// <summary>
/// 构造函数
/// </summary>
/// <param name="db">注入数据库</param>
public BaseBusiness(IDbAccessor db)
{
Db = db;
}
#endregion
#region 私有成员
protected virtual string _valueField { get; } = "Id";
protected virtual string _textField { get => throw new Exception("请在子类重写"); }
#endregion
#region 外部属性
/// <summary>
/// 业务仓储接口(支持软删除),支持联表操作
/// 注:若需要访问逻辑删除的数据,请使用IDbAccessor.FullRepository
/// 注:仅支持单线程操作
/// </summary>
public IDbAccessor Db { get; }
#endregion
#region 事物提交
public (bool Success, Exception ex) RunTransaction(Action action, IsolationLevel isolationLevel = IsolationLevel.ReadCommitted)
{
return Db.RunTransaction(action, isolationLevel);
}
public async Task<(bool Success, Exception ex)> RunTransactionAsync(Func<Task> action, IsolationLevel isolationLevel = IsolationLevel.ReadCommitted)
{
return await Db.RunTransactionAsync(action, isolationLevel);
}
#endregion
#region 增加数据
/// <summary>
/// 添加数据
/// </summary>
/// <param name="entity">实体对象</param>
public int Insert(T entity)
{
return Db.Insert(entity);
}
/// <summary>
/// 添加数据
/// </summary>
/// <param name="entity">实体对象</param>
public async Task<int> InsertAsync(T entity)
{
return await Db.InsertAsync(entity);
}
/// <summary>
/// 添加多条数据
/// </summary>
/// <param name="entities">实体对象集合</param>
public int Insert(List<T> entities)
{
return Db.Insert(entities);
}
/// <summary>
/// 添加多条数据
/// </summary>
/// <param name="entities">实体对象集合</param>
public async Task<int> InsertAsync(List<T> entities)
{
return await Db.InsertAsync(entities);
}
/// <summary>
/// 批量添加数据,速度快
/// </summary>
/// <param name="entities"></param>
public void BulkInsert(List<T> entities)
{
Db.BulkInsert(entities);
}
#endregion
#region 删除数据
/// <summary>
/// 删除所有数据
/// </summary>
public int DeleteAll()
{
return Db.DeleteAll<T>();
}
/// <summary>
/// 删除所有数据
/// </summary>
public async Task<int> DeleteAllAsync()
{
return await Db.DeleteAllAsync<T>();
}
/// <summary>
/// 删除指定主键数据
/// </summary>
/// <param name="key"></param>
public int Delete(string key)
{
return Db.Delete<T>(key);
}
/// <summary>
/// 删除指定主键数据
/// </summary>
/// <param name="key"></param>
public async Task<int> DeleteAsync(string key)
{
return await Db.DeleteAsync<T>(key);
}
/// <summary>
/// 通过主键删除多条数据
/// </summary>
/// <param name="keys"></param>
public int Delete(List<string> keys)
{
return Db.Delete<T>(keys);
}
/// <summary>
/// 通过主键删除多条数据
/// </summary>
/// <param name="keys"></param>
public async Task<int> DeleteAsync(List<string> keys)
{
return await Db.DeleteAsync<T>(keys);
}
/// <summary>
/// 删除单条数据
/// </summary>
/// <param name="entity">实体对象</param>
public int Delete(T entity)
{
return Db.Delete<T>(entity);
}
/// <summary>
/// 删除单条数据
/// </summary>
/// <param name="entity">实体对象</param>
public async Task<int> DeleteAsync(T entity)
{
return await Db.DeleteAsync(entity);
}
/// <summary>
/// 删除多条数据
/// </summary>
/// <param name="entities">实体对象集合</param>
public int Delete(List<T> entities)
{
return Db.Delete<T>(entities);
}
/// <summary>
/// 删除多条数据
/// </summary>
/// <param name="entities">实体对象集合</param>
public async Task<int> DeleteAsync(List<T> entities)
{
return await Db.DeleteAsync<T>(entities);
}
/// <summary>
/// 删除指定条件数据
/// </summary>
/// <param name="condition">筛选条件</param>
public int Delete(Expression<Func<T, bool>> condition)
{
return Db.Delete(condition);
}
/// <summary>
/// 删除指定条件数据
/// </summary>
/// <param name="condition">筛选条件</param>
public async Task<int> DeleteAsync(Expression<Func<T, bool>> condition)
{
return await Db.DeleteAsync(condition);
}
/// <summary>
/// 使用SQL语句按照条件删除数据
/// 用法:Delete_Sql"Base_User"(x=&gt;x.Id == "Admin")
/// 注:生成的SQL类似于DELETE FROM [Base_User] WHERE [Name] = 'xxx' WHERE [Id] = 'Admin'
/// </summary>
/// <param name="where">条件</param>
/// <returns>
/// 影响条数
/// </returns>
public int DeleteSql(Expression<Func<T, bool>> where)
{
return Db.DeleteSql(where);
}
/// <summary>
/// 使用SQL语句按照条件删除数据
/// 用法:Delete_Sql"Base_User"(x=&gt;x.Id == "Admin")
/// 注:生成的SQL类似于DELETE FROM [Base_User] WHERE [Name] = 'xxx' WHERE [Id] = 'Admin'
/// </summary>
/// <param name="where">条件</param>
/// <returns>
/// 影响条数
/// </returns>
public async Task<int> DeleteSqlAsync(Expression<Func<T, bool>> where)
{
return await Db.DeleteSqlAsync(where);
}
#endregion
#region 更新数据
/// <summary>
/// 更新一条数据
/// </summary>
/// <param name="entity">实体对象</param>
public int Update(T entity)
{
return Db.Update(entity);
}
/// <summary>
/// 更新一条数据
/// </summary>
/// <param name="entity">实体对象</param>
public async Task<int> UpdateAsync(T entity)
{
return await Db.UpdateAsync(entity);
}
/// <summary>
/// 更新多条数据
/// </summary>
/// <param name="entities">数据列表</param>
public int Update(List<T> entities)
{
return Db.Update(entities);
}
/// <summary>
/// 更新多条数据
/// </summary>
/// <param name="entities">数据列表</param>
public async Task<int> UpdateAsync(List<T> entities)
{
return await Db.UpdateAsync(entities);
}
/// <summary>
/// 指定条件更新
/// </summary>
/// <param name="whereExpre">筛选表达式</param>
/// <param name="set">更改属性回调</param>
public int Update(Expression<Func<T, bool>> whereExpre, Action<T> set)
{
return Db.Update(whereExpre, set);
}
/// <summary>
/// 指定条件更新
/// </summary>
/// <param name="whereExpre">筛选表达式</param>
/// <param name="set">更改属性回调</param>
public async Task<int> UpdateAsync(Expression<Func<T, bool>> whereExpre, Action<T> set)
{
return await Db.UpdateAsync(whereExpre, set);
}
/// <summary>
/// 使用SQL语句按照条件更新
/// 用法:UpdateWhere_Sql"Base_User"(x=>x.Id == "Admin",("Name","小明"))
/// 注:生成的SQL类似于UPDATE [TABLE] SET [Name] = 'xxx' WHERE [Id] = 'Admin'
/// </summary>
/// <param name="where">筛选条件</param>
/// <param name="values">字段值设置</param>
/// <returns>影响条数</returns>
public int UpdateSql(Expression<Func<T, bool>> where, params (string field, UpdateType updateType, object value)[] values)
{
return Db.UpdateSql(where, values);
}
/// <summary>
/// 使用SQL语句按照条件更新
/// 用法:UpdateWhere_Sql"Base_User"(x=>x.Id == "Admin",("Name","小明"))
/// 注:生成的SQL类似于UPDATE [TABLE] SET [Name] = 'xxx' WHERE [Id] = 'Admin'
/// </summary>
/// <param name="where">筛选条件</param>
/// <param name="values">字段值设置</param>
/// <returns>影响条数</returns>
public async Task<int> UpdateSqlAsync(Expression<Func<T, bool>> where, params (string field, UpdateType updateType, object value)[] values)
{
return await Db.UpdateSqlAsync(where, values);
}
#endregion
#region 查询数据
/// <summary>
/// 获取实体
/// </summary>
/// <param name="keyValue">主键</param>
/// <returns></returns>
public T GetEntity(params object[] keyValue)
{
return Db.GetEntity<T>(keyValue);
}
/// <summary>
/// 获取实体
/// </summary>
/// <param name="keyValue">主键</param>
/// <returns></returns>
public async Task<T> GetEntityAsync(params object[] keyValue)
{
return await Db.GetEntityAsync<T>(keyValue);
}
/// <summary>
/// 获取表的所有数据,当数据量很大时不要使用!
/// </summary>
/// <returns></returns>
public List<T> GetList()
{
return Db.GetIQueryable<T>().ToList();
}
/// <summary>
/// 获取表的所有数据,当数据量很大时不要使用!
/// </summary>
/// <returns></returns>
public async Task<List<T>> GetListAsync()
{
return await Db.GetIQueryable<T>().ToListAsync();
}
/// <summary>
/// 获取实体对应的表,延迟加载,主要用于支持Linq查询操作
/// </summary>
/// <returns></returns>
public virtual IQueryable<T> GetIQueryable()
{
return Db.GetIQueryable<T>();
}
#endregion
#region 执行Sql语句
#endregion
#region 业务返回
/// <summary>
/// 返回成功
/// </summary>
/// <returns></returns>
public AjaxResult Success()
{
AjaxResult res = new AjaxResult
{
Success = true,
Msg = "请求成功!",
};
return res;
}
/// <summary>
/// 返回成功
/// </summary>
/// <param name="data">返回数据</param>
/// <returns></returns>
public AjaxResult<U> Success<U>(U data)
{
AjaxResult<U> res = new AjaxResult<U>
{
Success = true,
Msg = "操作成功",
Data = data
};
return res;
}
/// <summary>
/// 返回成功
/// </summary>
/// <param name="data">返回数据</param>
/// <param name="msg">返回消息</param>
/// <returns></returns>
public AjaxResult<U> Success<U>(U data, string msg)
{
AjaxResult<U> res = new AjaxResult<U>
{
Success = true,
Msg = msg,
Data = data
};
return res;
}
/// <summary>
/// 返回错误
/// </summary>
/// <returns></returns>
public AjaxResult Error()
{
AjaxResult res = new AjaxResult
{
Success = false,
Msg = "请求失败!",
};
return res;
}
/// <summary>
/// 返回错误
/// </summary>
/// <param name="msg">错误提示</param>
/// <returns></returns>
public AjaxResult Error(string msg)
{
AjaxResult res = new AjaxResult
{
Success = false,
Msg = msg,
};
return res;
}
/// <summary>
/// 构建前端Select远程搜索数据
/// </summary>
/// <param name="input">查询参数</param>
/// <returns></returns>
public async Task<List<SelectOption>> GetOptionListAsync(OptionListInputDTO input)
{
return await GetOptionListAsync(input, _textField, _valueField, null);
}
/// <summary>
/// 构建前端Select远程搜索数据
/// </summary>
/// <param name="input">查询参数</param>
/// <param name="textFiled">文本字段</param>
/// <param name="valueField">值字段</param>
/// <param name="source">指定数据源</param>
/// <returns></returns>
public async Task<List<SelectOption>> GetOptionListAsync(OptionListInputDTO input, string textFiled, string valueField, IQueryable<T> source = null)
{
PageInput pageInput = new PageInput
{
PageRows = 10
};
List<T> selectedList = new List<T>();
string where = " 1=1 ";
List<string> ids = input.selectedValues;
if (ids.Count > 0)
{
selectedList = await GetNewQ().Where($"@0.Contains({valueField})", ids).ToListAsync();
where += $" && !@0.Contains({valueField})";
}
if (!input.q.IsNullOrEmpty())
{
where += $" && it.{textFiled}.Contains(@1)";
}
List<T> newQList = await GetNewQ().Where(where, ids, input.q).GetPageListAsync(pageInput);
var resList = selectedList.Concat(newQList).Select(x => new SelectOption
{
value = x.GetPropertyValue(valueField)?.ToString(),
text = x.GetPropertyValue(textFiled)?.ToString()
}).ToList();
return resList;
IQueryable<T> GetNewQ()
{
return source ?? GetIQueryable();
}
}
#endregion
#region 其它操作
#endregion
}
}

138
src/Coldairarrow.Business/Base_Manage/Base_ActionBusiness.cs

@ -0,0 +1,138 @@
using AutoMapper;
using Coldairarrow.Entity.Base_Manage;
using Coldairarrow.Util;
using EFCore.Sharding;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Coldairarrow.Business.Base_Manage
{
public class Base_ActionBusiness : BaseBusiness<Base_Action>, IBase_ActionBusiness, ITransientDependency
{
readonly IMapper _mapper;
public Base_ActionBusiness(IDbAccessor db, IMapper mapper)
: base(db)
{
_mapper = mapper;
}
#region 外部接口
public async Task<List<Base_Action>> GetDataListAsync(Base_ActionsInputDTO input)
{
var q = GetIQueryable();
q = q
.WhereIf(!input.parentId.IsNullOrEmpty(), x => x.ParentId == input.parentId)
.WhereIf(input.types?.Length > 0, x => input.types.Contains(x.Type))
.WhereIf(input.ActionIds?.Length > 0, x => input.ActionIds.Contains(x.Id))
;
return await q.OrderBy(x => x.Sort).ToListAsync();
}
public async Task<List<Base_ActionDTO>> GetTreeDataListAsync(Base_ActionsInputDTO input)
{
var qList = await GetDataListAsync(input);
var treeList = qList.Select(x => new Base_ActionDTO
{
Id = x.Id,
NeedAction = x.NeedAction,
Text = x.Name,
ParentId = x.ParentId,
Type = x.Type,
Url = x.Url,
Value = x.Id,
Icon = x.Icon,
Sort = x.Sort,
selectable = input.selectable
}).ToList();
//菜单节点中,若子节点为空则移除父节点
if (input.checkEmptyChildren)
treeList = treeList.Where(x => x.Type != 0 || TreeHelper.GetChildren(treeList, x, false).Count > 0).ToList();
await SetProperty(treeList);
return TreeHelper.BuildTree(treeList);
async Task SetProperty(List<Base_ActionDTO> _list)
{
var ids = _list.Select(x => x.Id).ToList();
var allPermissions = await GetIQueryable()
.Where(x => ids.Contains(x.ParentId) && (int)x.Type == 2)
.ToListAsync();
_list.ForEach(aData =>
{
var permissionValues = allPermissions
.Where(x => x.ParentId == aData.Id)
.Select(x => $"{x.Name}({x.Value})")
.ToList();
aData.PermissionValues = permissionValues;
});
}
}
public async Task<Base_Action> GetTheDataAsync(string id)
{
return await GetEntityAsync(id);
}
[Transactional]
public async Task AddDataAsync(ActionEditInputDTO input)
{
await InsertAsync(_mapper.Map<Base_Action>(input));
await SavePermissionAsync(input.Id, input.permissionList);
}
[Transactional]
public async Task UpdateDataAsync(ActionEditInputDTO input)
{
await UpdateAsync(_mapper.Map<Base_Action>(input));
await SavePermissionAsync(input.Id, input.permissionList);
}
public async Task DeleteDataAsync(List<string> ids)
{
await DeleteAsync(ids);
await DeleteAsync(x => ids.Contains(x.ParentId));
}
public async Task SavePermissionAsync(string parentId, List<Base_Action> permissionList)
{
permissionList.ForEach(aData =>
{
aData.Id = IdHelper.GetId();
aData.CreateTime = DateTime.Now;
aData.CreatorId = null;
aData.ParentId = parentId;
aData.NeedAction = true;
});
//删除原来
await DeleteAsync(x => x.ParentId == parentId && (int)x.Type == 2);
//新增
await InsertAsync(permissionList);
//权限值必须唯一
var repeatValues = await GetIQueryable()
.GroupBy(x => x.Value)
.Where(x => !string.IsNullOrEmpty(x.Key) && x.Count() > 1)
.Select(x => x.Key)
.ToListAsync();
if (repeatValues.Count > 0)
throw new Exception($"以下权限值重复:{string.Join(",", repeatValues)}");
}
#endregion
#region 私有成员
#endregion
}
}

77
src/Coldairarrow.Business/Base_Manage/Base_AppSecretBusiness.cs

@ -0,0 +1,77 @@
using Coldairarrow.Entity.Base_Manage;
using Coldairarrow.Util;
using EFCore.Sharding;
using LinqKit;
using Microsoft.EntityFrameworkCore;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Coldairarrow.Business.Base_Manage
{
public class Base_AppSecretBusiness : BaseBusiness<Base_AppSecret>, IBase_AppSecretBusiness, ITransientDependency
{
public Base_AppSecretBusiness(IDbAccessor db)
: base(db)
{
}
#region 外部接口
public async Task<PageResult<Base_AppSecret>> GetDataListAsync(PageInput<AppSecretsInputDTO> input)
{
var q = GetIQueryable();
var where = LinqHelper.True<Base_AppSecret>();
var search = input.Search;
if (!search.keyword.IsNullOrEmpty())
{
where = where.And(x =>
x.AppId.Contains(search.keyword)
|| x.AppSecret.Contains(search.keyword)
|| x.AppName.Contains(search.keyword));
}
return await q.Where(where).GetPageResultAsync(input);
}
public async Task<Base_AppSecret> GetTheDataAsync(string id)
{
return await GetEntityAsync(id);
}
public async Task<string> GetAppSecretAsync(string appId)
{
var theData = await GetIQueryable().Where(x => x.AppId == appId).FirstOrDefaultAsync();
return theData?.AppSecret;
}
[DataRepeatValidate(new string[] { "AppId" },
new string[] { "应用Id" })]
[DataAddLog(UserLogType.接口密钥管理, "AppId", "应用Id")]
public async Task AddDataAsync(Base_AppSecret newData)
{
await InsertAsync(newData);
}
[DataRepeatValidate(new string[] { "AppId" },
new string[] { "应用Id" })]
[DataEditLog(UserLogType.接口密钥管理, "AppId", "应用Id")]
public async Task UpdateDataAsync(Base_AppSecret theData)
{
await UpdateAsync(theData);
}
[DataDeleteLog(UserLogType.接口密钥管理, "AppId", "应用Id")]
public async Task DeleteDataAsync(List<string> ids)
{
await DeleteAsync(ids);
}
#endregion
#region 私有成员
#endregion
}
}

53
src/Coldairarrow.Business/Base_Manage/Base_DbLinkBusiness.cs

@ -0,0 +1,53 @@
using Coldairarrow.Entity.Base_Manage;
using Coldairarrow.Util;
using EFCore.Sharding;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Coldairarrow.Business.Base_Manage
{
public class Base_DbLinkBusiness : BaseBusiness<Base_DbLink>, IBase_DbLinkBusiness, ITransientDependency
{
public Base_DbLinkBusiness(IDbAccessor db)
: base(db)
{
}
#region 外部接口
public async Task<PageResult<Base_DbLink>> GetDataListAsync(PageInput input)
{
return await GetIQueryable().GetPageResultAsync(input);
}
public async Task<Base_DbLink> GetTheDataAsync(string id)
{
return await GetEntityAsync(id);
}
public async Task AddDataAsync(Base_DbLink newData)
{
await InsertAsync(newData);
}
public async Task UpdateDataAsync(Base_DbLink theData)
{
await UpdateAsync(theData);
}
public async Task DeleteDataAsync(List<string> ids)
{
await DeleteAsync(ids);
}
#endregion
#region 私有成员
#endregion
#region 数据模型
#endregion
}
}

88
src/Coldairarrow.Business/Base_Manage/Base_DepartmentBusiness.cs

@ -0,0 +1,88 @@
using Coldairarrow.Entity.Base_Manage;
using Coldairarrow.Util;
using EFCore.Sharding;
using LinqKit;
using Microsoft.EntityFrameworkCore;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Coldairarrow.Business.Base_Manage
{
public class Base_DepartmentBusiness : BaseBusiness<Base_Department>, IBase_DepartmentBusiness, ITransientDependency
{
public Base_DepartmentBusiness(IDbAccessor db)
: base(db)
{
}
#region 外部接口
public async Task<List<Base_DepartmentTreeDTO>> GetTreeDataListAsync(DepartmentsTreeInputDTO input)
{
var where = LinqHelper.True<Base_Department>();
if (!input.parentId.IsNullOrEmpty())
where = where.And(x => x.ParentId == input.parentId);
var list = await GetIQueryable().Where(where).ToListAsync();
var treeList = list
.Select(x => new Base_DepartmentTreeDTO
{
Id = x.Id,
ParentId = x.ParentId,
Text = x.Name,
Value = x.Id
}).ToList();
return TreeHelper.BuildTree(treeList);
}
public async Task<List<string>> GetChildrenIdsAsync(string departmentId)
{
var allNode = await GetIQueryable().Select(x => new TreeModel
{
Id = x.Id,
ParentId = x.ParentId,
Text = x.Name,
Value = x.Id
}).ToListAsync();
var children = TreeHelper
.GetChildren(allNode, allNode.Where(x => x.Id == departmentId).FirstOrDefault(), true)
.Select(x => x.Id)
.ToList();
return children;
}
public async Task<Base_Department> GetTheDataAsync(string id)
{
return await GetEntityAsync(id);
}
[DataRepeatValidate(new string[] { "Name" }, new string[] { "部门名" })]
[DataAddLog(UserLogType.部门管理, "Name", "部门名")]
public async Task AddDataAsync(Base_Department newData)
{
await InsertAsync(newData);
}
[DataRepeatValidate(new string[] { "Name" }, new string[] { "部门名" })]
[DataEditLog(UserLogType.部门管理, "Name", "部门名")]
public async Task UpdateDataAsync(Base_Department theData)
{
await UpdateAsync(theData);
}
[DataDeleteLog(UserLogType.部门管理, "Name", "部门名")]
public async Task DeleteDataAsync(List<string> ids)
{
if (await GetIQueryable().AnyAsync(x => ids.Contains(x.ParentId)))
throw new BusException("禁止删除!请先删除所有子级!");
await DeleteAsync(ids);
}
#endregion
}
}

117
src/Coldairarrow.Business/Base_Manage/Base_RoleBusiness.cs

@ -0,0 +1,117 @@
using AutoMapper;
using AutoMapper.QueryableExtensions;
using Coldairarrow.Entity;
using Coldairarrow.Entity.Base_Manage;
using Coldairarrow.Util;
using EFCore.Sharding;
using LinqKit;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Coldairarrow.Business.Base_Manage
{
public class Base_RoleBusiness : BaseBusiness<Base_Role>, IBase_RoleBusiness, ITransientDependency
{
readonly IMapper _mapper;
public Base_RoleBusiness(IDbAccessor db, IMapper mapper)
: base(db)
{
_mapper = mapper;
}
#region 外部接口
public async Task<PageResult<Base_RoleInfoDTO>> GetDataListAsync(PageInput<RolesInputDTO> input)
{
var where = LinqHelper.True<Base_Role>();
var search = input.Search;
if (!search.roleId.IsNullOrEmpty())
where = where.And(x => x.Id == search.roleId);
if (!search.roleName.IsNullOrEmpty())
where = where.And(x => x.RoleName.Contains(search.roleName));
var page = await GetIQueryable()
.Where(where)
.ProjectTo<Base_RoleInfoDTO>(_mapper.ConfigurationProvider)
.GetPageResultAsync(input);
await SetProperty(page.Data);
return page;
async Task SetProperty(List<Base_RoleInfoDTO> _list)
{
var allActionIds = await Db.GetIQueryable<Base_Action>().Select(x => x.Id).ToListAsync();
var ids = _list.Select(x => x.Id).ToList();
var roleActions = await Db.GetIQueryable<Base_RoleAction>()
.Where(x => ids.Contains(x.RoleId))
.ToListAsync();
_list.ForEach(aData =>
{
if (aData.RoleName == RoleTypes..ToString())
aData.Actions = allActionIds;
else
aData.Actions = roleActions.Where(x => x.RoleId == aData.Id).Select(x => x.ActionId).ToList();
});
}
}
public async Task<Base_RoleInfoDTO> GetTheDataAsync(string id)
{
return (await GetDataListAsync(new PageInput<RolesInputDTO> { Search = new RolesInputDTO { roleId = id } })).Data.FirstOrDefault();
}
[DataAddLog(UserLogType.系统角色管理, "RoleName", "角色")]
[DataRepeatValidate(new string[] { "RoleName" }, new string[] { "角色名" })]
public async Task AddDataAsync(Base_RoleInfoDTO input)
{
await InsertAsync(_mapper.Map<Base_Role>(input));
await SetRoleActionAsync(input.Id, input.Actions);
}
[DataEditLog(UserLogType.系统角色管理, "RoleName", "角色")]
[DataRepeatValidate(new string[] { "RoleName" }, new string[] { "角色名" })]
[Transactional]
public async Task UpdateDataAsync(Base_RoleInfoDTO input)
{
await UpdateAsync(_mapper.Map<Base_Role>(input));
await SetRoleActionAsync(input.Id, input.Actions);
}
[DataDeleteLog(UserLogType.系统角色管理, "RoleName", "角色")]
[Transactional]
public async Task DeleteDataAsync(List<string> ids)
{
await DeleteAsync(ids);
await Db.DeleteAsync<Base_RoleAction>(x => ids.Contains(x.RoleId));
}
#endregion
#region 私有成员
private async Task SetRoleActionAsync(string roleId, List<string> actions)
{
var roleActions = (actions ?? new List<string>())
.Select(x => new Base_RoleAction
{
Id = IdHelper.GetId(),
ActionId = x,
CreateTime = DateTime.Now,
RoleId = roleId
}).ToList();
await Db.DeleteAsync<Base_RoleAction>(x => x.RoleId == roleId);
await Db.InsertAsync(roleActions);
}
#endregion
#region 数据模型
#endregion
}
}

166
src/Coldairarrow.Business/Base_Manage/Base_UserBusiness.cs

@ -0,0 +1,166 @@
using AutoMapper;
using Coldairarrow.Business.Cache;
using Coldairarrow.Entity;
using Coldairarrow.Entity.Base_Manage;
using Coldairarrow.IBusiness;
using Coldairarrow.Util;
using EFCore.Sharding;
using LinqKit;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Threading.Tasks;
namespace Coldairarrow.Business.Base_Manage
{
public class Base_UserBusiness : BaseBusiness<Base_User>, IBase_UserBusiness, ITransientDependency
{
readonly IOperator _operator;
readonly IMapper _mapper;
public Base_UserBusiness(
IDbAccessor db,
IBase_UserCache userCache,
IOperator @operator,
IMapper mapper
)
: base(db)
{
_userCache = userCache;
_operator = @operator;
_mapper = mapper;
}
IBase_UserCache _userCache { get; }
protected override string _textField => "RealName";
#region 外部接口
public async Task<PageResult<Base_UserDTO>> GetDataListAsync(PageInput<Base_UsersInputDTO> input)
{
Expression<Func<Base_User, Base_Department, Base_UserDTO>> select = (a, b) => new Base_UserDTO
{
DepartmentName = b.Name
};
var search = input.Search;
select = select.BuildExtendSelectExpre();
var q_User = search.all ? Db.GetIQueryable<Base_User>() : GetIQueryable();
var q = from a in q_User.AsExpandable()
join b in Db.GetIQueryable<Base_Department>() on a.DepartmentId equals b.Id into ab
from b in ab.DefaultIfEmpty()
select @select.Invoke(a, b);
q = q.WhereIf(!search.userId.IsNullOrEmpty(), x => x.Id == search.userId);
if (!search.keyword.IsNullOrEmpty())
{
var keyword = $"%{search.keyword}%";
q = q.Where(x =>
EF.Functions.Like(x.UserName, keyword)
|| EF.Functions.Like(x.RealName, keyword));
}
var list = await q.GetPageResultAsync(input);
await SetProperty(list.Data);
return list;
async Task SetProperty(List<Base_UserDTO> users)
{
//补充用户角色属性
List<string> userIds = users.Select(x => x.Id).ToList();
var userRoles = await (from a in Db.GetIQueryable<Base_UserRole>()
join b in Db.GetIQueryable<Base_Role>() on a.RoleId equals b.Id
where userIds.Contains(a.UserId)
select new
{
a.UserId,
RoleId = b.Id,
b.RoleName
}).ToListAsync();
users.ForEach(aUser =>
{
var roleList = userRoles.Where(x => x.UserId == aUser.Id);
aUser.RoleIdList = roleList.Select(x => x.RoleId).ToList();
aUser.RoleNameList = roleList.Select(x => x.RoleName).ToList();
});
}
}
public async Task<Base_UserDTO> GetTheDataAsync(string id)
{
if (id.IsNullOrEmpty())
return null;
else
{
PageInput<Base_UsersInputDTO> input = new PageInput<Base_UsersInputDTO>
{
Search = new Base_UsersInputDTO
{
all = true,
userId = id
}
};
return (await GetDataListAsync(input)).Data.FirstOrDefault();
}
}
[DataAddLog(UserLogType.系统用户管理, "RealName", "用户")]
[DataRepeatValidate(
new string[] { "UserName" },
new string[] { "用户名" })]
[Transactional]
public async Task AddDataAsync(UserEditInputDTO input)
{
await InsertAsync(_mapper.Map<Base_User>(input));
await SetUserRoleAsync(input.Id, input.RoleIdList);
}
[DataEditLog(UserLogType.系统用户管理, "RealName", "用户")]
[DataRepeatValidate(
new string[] { "UserName" },
new string[] { "用户名" })]
[Transactional]
public async Task UpdateDataAsync(UserEditInputDTO input)
{
if (input.Id == GlobalAssemblies.ADMINID && _operator?.UserId != input.Id)
throw new BusException("禁止更改超级管理员!");
await UpdateAsync(_mapper.Map<Base_User>(input));
await SetUserRoleAsync(input.Id, input.RoleIdList);
await _userCache.UpdateCacheAsync(input.Id);
}
[DataDeleteLog(UserLogType.系统用户管理, "RealName", "用户")]
[Transactional]
public async Task DeleteDataAsync(List<string> ids)
{
if (ids.Contains(GlobalAssemblies.ADMINID))
throw new BusException("超级管理员是内置账号,禁止删除!");
await DeleteAsync(ids);
await _userCache.UpdateCacheAsync(ids);
}
#endregion
#region 私有成员
private async Task SetUserRoleAsync(string userId, List<string> roleIds)
{
roleIds = roleIds ?? new List<string>();
var userRoleList = roleIds.Select(x => new Base_UserRole
{
Id = IdHelper.GetId(),
CreateTime = DateTime.Now,
UserId = userId,
RoleId = x
}).ToList();
await Db.DeleteAsync<Base_UserRole>(x => x.UserId == userId);
await Db.InsertAsync(userRoleList);
}
#endregion
}
}

35
src/Coldairarrow.Business/Base_Manage/Base_UserLogBusiness.cs

@ -0,0 +1,35 @@
using Coldairarrow.Entity.Base_Manage;
using Coldairarrow.Util;
using EFCore.Sharding;
using LinqKit;
using System.Linq;
using System.Threading.Tasks;
namespace Coldairarrow.Business.Base_Manage
{
public class Base_UserLogBusiness : BaseBusiness<Base_UserLog>, IBase_UserLogBusiness, ITransientDependency
{
public Base_UserLogBusiness(IDbAccessor db)
: base(db)
{
}
public async Task<PageResult<Base_UserLog>> GetLogListAsync(PageInput<UserLogsInputDTO> input)
{
var whereExp = LinqHelper.True<Base_UserLog>();
var search = input.Search;
if (!search.logContent.IsNullOrEmpty())
whereExp = whereExp.And(x => x.LogContent.Contains(search.logContent));
if (!search.logType.IsNullOrEmpty())
whereExp = whereExp.And(x => x.LogType == search.logType);
if (!search.opUserName.IsNullOrEmpty())
whereExp = whereExp.And(x => x.CreatorRealName.Contains(search.opUserName));
if (!search.startTime.IsNullOrEmpty())
whereExp = whereExp.And(x => x.CreateTime >= search.startTime);
if (!search.endTime.IsNullOrEmpty())
whereExp = whereExp.And(x => x.CreateTime <= search.endTime);
return await GetIQueryable().Where(whereExp).GetPageResultAsync(input);
}
}
}

220
src/Coldairarrow.Business/Base_Manage/BuildCodeBusiness.cs

@ -0,0 +1,220 @@
using Coldairarrow.Entity.Base_Manage;
using Coldairarrow.Util;
using EFCore.Sharding;
using Microsoft.Extensions.Hosting;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
namespace Coldairarrow.Business.Base_Manage
{
public class BuildCodeBusiness : BaseBusiness<Base_DbLink>, IBuildCodeBusiness, ITransientDependency
{
public BuildCodeBusiness(IDbAccessor db, IHostEnvironment evn)
: base(db)
{
var projectPath = evn.ContentRootPath;
_solutionPath = Directory.GetParent(projectPath).ToString();
}
private static readonly List<string> ignoreProperties =
new List<string> { "Id", "CreateTime", "CreatorId", "CreatorRealName", "Deleted" };
#region 外部接口
/// <summary>
/// 获取所有数据库连接
/// </summary>
/// <returns></returns>
public List<Base_DbLink> GetAllDbLink()
{
return GetList();
}
/// <summary>
/// 获取数据库所有表
/// </summary>
/// <param name="linkId">数据库连接Id</param>
/// <returns></returns>
public List<DbTableInfo> GetDbTableList(string linkId)
{
if (linkId.IsNullOrEmpty())
return new List<DbTableInfo>();
else
return GetTheDbHelper(linkId).GetDbAllTables();
}
public void Build(BuildInputDTO input)
{
string linkId = input.linkId;
string areaName = input.areaName;
List<string> tables = input.tables;
List<int> buildTypes = input.buildTypes;
_areaName = areaName;
//内部成员初始化
_dbHelper = GetTheDbHelper(linkId);
GetDbTableList(linkId).ForEach(aTable =>
{
_dbTableInfoDic.Add(aTable.TableName, aTable);
});
tables.ForEach(aTable =>
{
var tableFieldInfo = _dbHelper.GetDbTableInfo(aTable);
//实体名
string entityName = aTable;
//业务逻辑参数名
string busName = $"{entityName.ToFirstLowerStr()}Bus";
//业务逻辑变量名
string _busName = $"_{busName}";
List<string> selectOptionsList = new List<string>();
List<string> listColumnsList = new List<string>();
List<string> formColumnsList = new List<string>();
tableFieldInfo.Where(x => !ignoreProperties.Contains(x.Name)).ToList().ForEach(aField =>
{
if (_dbHelper.DbTypeStr_To_CsharpType(aField.Type) == typeof(string))
selectOptionsList.Add(
$" <a-select-option key=\"{aField.Name}\">{aField.Description}</a-select-option>");
listColumnsList.Add(
$" {{ title: '{aField.Description}', dataIndex: '{aField.Name}', width: '10%' }},");
formColumnsList.Add(
$@" <a-form-model-item label=""{aField.Description}"" prop=""{aField.Name}"">
<a-input v-model=""entity.{aField.Name}"" autocomplete=""off"" />
</a-form-model-item>");
Dictionary<string, string> renderParamters = new Dictionary<string, string>
{
{$"%{nameof(areaName)}%",areaName },
{$"%{nameof(entityName)}%",entityName },
{$"%{nameof(busName)}%",busName },
{$"%{nameof(_busName)}%",_busName },
{$"%selectOptions%",string.Join("\r\n",selectOptionsList) },
{$"%listColumns%",string.Join("\r\n",listColumnsList) },
{$"%formColumns%",string.Join("\r\n",formColumnsList) }
};
//buildTypes,实体层=0,业务层=1,接口层=2,页面层=3
//实体层
if (buildTypes.Contains(0))
{
BuildEntity(tableFieldInfo, aTable);
}
string tmpFileName = string.Empty;
string savePath = string.Empty;
//业务层
if (buildTypes.Contains(1))
{
//接口
tmpFileName = "IBusiness.txt";
savePath = Path.Combine(
_solutionPath,
"Coldairarrow.IBusiness",
areaName,
$"I{entityName}Business.cs");
WriteCode(renderParamters, tmpFileName, savePath);
//实现
tmpFileName = "Business.txt";
savePath = Path.Combine(
_solutionPath,
"Coldairarrow.Business",
areaName,
$"{entityName}Business.cs");
WriteCode(renderParamters, tmpFileName, savePath);
}
//接口层
if (buildTypes.Contains(2))
{
tmpFileName = "Controller.txt";
savePath = Path.Combine(
_solutionPath,
"Coldairarrow.Api",
"Controllers",
areaName,
$"{entityName}Controller.cs");
WriteCode(renderParamters, tmpFileName, savePath);
}
//页面层
if (buildTypes.Contains(3))
{
//表格页
tmpFileName = "List.txt";
savePath = Path.Combine(
_solutionPath,
"Coldairarrow.Web",
"src",
"views",
areaName,
entityName,
"List.vue");
WriteCode(renderParamters, tmpFileName, savePath);
//表单页
tmpFileName = "EditForm.txt";
savePath = Path.Combine(
_solutionPath,
"Coldairarrow.Web",
"src",
"views",
areaName,
entityName,
"EditForm.vue");
WriteCode(renderParamters, tmpFileName, savePath);
}
});
});
}
#endregion
#region 私有成员
readonly string _solutionPath;
private string _areaName { get; set; }
private void BuildEntity(List<TableInfo> tableInfo, string tableName)
{
string nameSpace = $@"Coldairarrow.Entity.{_areaName}";
string filePath = Path.Combine(_solutionPath, "Coldairarrow.Entity", _areaName, $"{tableName}.cs");
_dbHelper.SaveEntityToFile(tableInfo, tableName, _dbTableInfoDic[tableName].Description, filePath, nameSpace);
}
private DbHelper GetTheDbHelper(string linkId)
{
var theLink = GetTheLink(linkId);
DbHelper dbHelper = DbHelperFactory.GetDbHelper(theLink.DbType.ToEnum<DatabaseType>(), theLink.ConnectionStr);
return dbHelper;
}
private Base_DbLink GetTheLink(string linkId)
{
Base_DbLink resObj = new Base_DbLink();
var theModule = GetIQueryable().Where(x => x.Id == linkId).FirstOrDefault();
resObj = theModule ?? resObj;
return resObj;
}
private DbHelper _dbHelper { get; set; }
private Dictionary<string, DbTableInfo> _dbTableInfoDic { get; set; } = new Dictionary<string, DbTableInfo>();
private void WriteCode(Dictionary<string, string> paramters, string templateFileName, string savePath)
{
string content = File.ReadAllText(Path.Combine(_solutionPath, "Coldairarrow.Api", "BuildCodeTemplate", templateFileName));
paramters.ForEach(aParamter =>
{
content = content.Replace(aParamter.Key, aParamter.Value);
});
var dir = Path.GetDirectoryName(savePath);
if (!Directory.Exists(dir))
{
Directory.CreateDirectory(dir);
}
File.WriteAllText(savePath, content, Encoding.UTF8);
}
#endregion
#region 数据模型
#endregion
}
}

52
src/Coldairarrow.Business/Base_Manage/HomeBusiness.cs

@ -0,0 +1,52 @@
using AutoMapper;
using Coldairarrow.Business.Cache;
using Coldairarrow.Entity.Base_Manage;
using Coldairarrow.IBusiness;
using Coldairarrow.Util;
using EFCore.Sharding;
using Microsoft.EntityFrameworkCore;
using System.Linq;
using System.Threading.Tasks;
namespace Coldairarrow.Business.Base_Manage
{
public class HomeBusiness : BaseBusiness<Base_User>, IHomeBusiness, ITransientDependency
{
readonly IOperator _operator;
readonly IMapper _mapper;
private readonly IBase_UserCache _base_UserCache;
public HomeBusiness(IDbAccessor db, IOperator @operator, IMapper mapper, IBase_UserCache base_UserCache)
: base(db)
{
_operator = @operator;
_mapper = mapper;
_base_UserCache = base_UserCache;
}
public async Task<string> SubmitLoginAsync(LoginInputDTO input)
{
input.password = input.password.ToMD5String();
var theUser = await GetIQueryable()
.Where(x => x.UserName == input.userName && x.Password == input.password)
.FirstOrDefaultAsync();
if (theUser.IsNullOrEmpty())
throw new BusException("账号或密码不正确!");
return theUser.Id;
}
public async Task ChangePwdAsync(ChangePwdInputDTO input)
{
var theUser = _operator.Property;
if (theUser.Password != input.oldPwd?.ToMD5String())
throw new BusException("原密码错误!");
theUser.Password = input.newPwd.ToMD5String();
await UpdateAsync(_mapper.Map<Base_User>(theUser));
//更新缓存
await _base_UserCache.UpdateCacheAsync(theUser.Id);
}
}
}

71
src/Coldairarrow.Business/Base_Manage/PermissionBusiness.cs

@ -0,0 +1,71 @@
using Coldairarrow.Entity;
using Coldairarrow.Entity.Base_Manage;
using Coldairarrow.Util;
using EFCore.Sharding;
using LinqKit;
using Microsoft.EntityFrameworkCore;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Coldairarrow.Business.Base_Manage
{
class PermissionBusiness : BaseBusiness<Base_Action>, IPermissionBusiness, ITransientDependency
{
public PermissionBusiness(IDbAccessor db, IBase_ActionBusiness actionBus, IBase_UserBusiness userBus)
: base(db)
{
_actionBus = actionBus;
_userBus = userBus;
}
IBase_ActionBusiness _actionBus { get; }
IBase_UserBusiness _userBus { get; }
async Task<string[]> GetUserActionIds(string userId)
{
var where = LinqHelper.False<Base_Action>();
var theUser = await _userBus.GetTheDataAsync(userId);
//不需要权限的菜单
where = where.Or(x => x.NeedAction == false);
if (userId == GlobalAssemblies.ADMINID || theUser.RoleType.HasFlag(RoleTypes.))
where = where.Or(x => true);
else
{
var actionIds = from a in Db.GetIQueryable<Base_UserRole>()
join b in Db.GetIQueryable<Base_RoleAction>() on a.RoleId equals b.RoleId
where a.UserId == userId
select b.ActionId;
where = where.Or(x => actionIds.Contains(x.Id));
}
return await GetIQueryable().Where(where).Select(x => x.Id).ToArrayAsync();
}
public async Task<List<Base_ActionDTO>> GetUserMenuListAsync(string userId)
{
var actionIds = await GetUserActionIds(userId);
return await _actionBus.GetTreeDataListAsync(new Base_ActionsInputDTO
{
types = new ActionType[] { ActionType., ActionType. },
ActionIds = actionIds,
checkEmptyChildren = true
});
}
public async Task<List<string>> GetUserPermissionValuesAsync(string userId)
{
var actionIds = await GetUserActionIds(userId);
return (await _actionBus
.GetDataListAsync(new Base_ActionsInputDTO
{
types = new ActionType[] { ActionType. },
ActionIds = actionIds
}))
.Select(x => x.Value)
.ToList();
}
}
}

60
src/Coldairarrow.Business/Cache/BaseCache.T.cs

@ -0,0 +1,60 @@
using Coldairarrow.Util;
using Microsoft.Extensions.Caching.Distributed;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Coldairarrow.Business.Cache
{
public abstract class BaseCache<T> : IBaseCache<T> where T : class
{
readonly IDistributedCache _cache;
public BaseCache(IDistributedCache cache)
{
_cache = cache;
}
#region 私有成员
protected abstract Task<T> GetDbDataAsync(string key);
protected string BuildKey(string idKey)
{
return $"Cache_{GetType().FullName}_{idKey}";
}
#endregion
#region 外部接口
public async Task<T> GetCacheAsync(string idKey)
{
if (idKey.IsNullOrEmpty())
return null;
string cacheKey = BuildKey(idKey);
var cache = (await _cache.GetStringAsync(cacheKey))?.ToObject<T>();
if (cache == null)
{
cache = await GetDbDataAsync(idKey);
if (cache != null)
await _cache.SetStringAsync(cacheKey, cache.ToJson());
}
return cache;
}
public async Task UpdateCacheAsync(string idKey)
{
await _cache.RemoveAsync(BuildKey(idKey));
}
public async Task UpdateCacheAsync(List<string> idKeys)
{
foreach (var aKey in idKeys)
{
await UpdateCacheAsync(aKey);
}
}
#endregion
}
}

36
src/Coldairarrow.Business/Cache/Base_UserCache.cs

@ -0,0 +1,36 @@
using Coldairarrow.Business.Base_Manage;
using Coldairarrow.Entity;
using Coldairarrow.Util;
using Microsoft.Extensions.Caching.Distributed;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Linq;
using System.Threading.Tasks;
namespace Coldairarrow.Business.Cache
{
class Base_UserCache : BaseCache<Base_UserDTO>, IBase_UserCache, ITransientDependency
{
readonly IServiceProvider _serviceProvider;
public Base_UserCache(IServiceProvider serviceProvider, IDistributedCache cache)
: base(cache)
{
_serviceProvider = serviceProvider;
}
protected override async Task<Base_UserDTO> GetDbDataAsync(string key)
{
PageInput<Base_UsersInputDTO> input = new PageInput<Base_UsersInputDTO>
{
Search = new Base_UsersInputDTO
{
all = true,
userId = key
}
};
var list = await _serviceProvider.GetService<IBase_UserBusiness>().GetDataListAsync(input);
return list.Data.FirstOrDefault();
}
}
}

12
src/Coldairarrow.Business/Cache/IBaseCache.T.cs

@ -0,0 +1,12 @@
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Coldairarrow.Business.Cache
{
public interface IBaseCache<T> where T : class
{
Task<T> GetCacheAsync(string idKey);
Task UpdateCacheAsync(string idKey);
Task UpdateCacheAsync(List<string> idKeys);
}
}

9
src/Coldairarrow.Business/Cache/IBase_UserCache.cs

@ -0,0 +1,9 @@
using Coldairarrow.Entity;
namespace Coldairarrow.Business.Cache
{
public interface IBase_UserCache : IBaseCache<Base_UserDTO>
{
}
}

204
src/Coldairarrow.Business/HuiYan/catsBusiness.cs

@ -0,0 +1,204 @@
using Coldairarrow.Entity.DTO;
using Coldairarrow.Entity.HuiYan;
using Coldairarrow.Util;
using EFCore.Sharding;
using LinqKit;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Dynamic.Core;
using System.Threading.Tasks;
namespace Coldairarrow.Business.HuiYan
{
public class catsBusiness : BaseBusiness<cats>, IcatsBusiness, ITransientDependency
{
public catsBusiness(IDbAccessor db)
: base(db)
{
}
#region 外部接口
public async Task<List<CatTreeDTO>> GetTreeDataListAsync(CatsTreeInputDTO input)
{
var where = LinqHelper.True<cats>();
if (!input.parentId.IsNullOrEmpty())
where = where.And(x => x.ParentId == input.parentId);
var list = await GetIQueryable().Where(where).ToListAsync();
var treeList = list
.Select(x => new CatTreeDTO
{
Id = x.Id,
ParentId = x.ParentId,
Text = x.Name,
Value = x.Id
}).ToList();
return TreeHelper.BuildTree(treeList);
}
public AjaxResult GetParentCatList()
{
var list = GetIQueryable().Where(c => string.IsNullOrEmpty(c.ParentId)).ToList();
return Success(list);
}
public AjaxResult AddKeyWord(CatDto model)
{
var result= Db.RunTransaction(() =>
{
/*
///判断是否需要添加一级类目
*/
cats oneCat = null;
if (!string.IsNullOrEmpty(model.OneCat.Id))
{
oneCat = GetIQueryable().FirstOrDefault(c => c.Id == model.OneCat.Id);
}
if (oneCat == null)
{
oneCat = new cats()
{
Id = IdHelper.GetId(),
CreateTime = DateTime.Now,
CreatorId = "admin",
Deleted = false,
Name = model.OneCat.Text,
ParentId = null
};
int row = Db.Insert(oneCat);
if (row <= 0)
{
throw new Exception("一级类目添加失败!");
}
}
/*
///判断是否需要添加二级类目
*/
cats twoCat = null;
if (!string.IsNullOrEmpty(model.TwoCat.Id))
{
twoCat = GetIQueryable().FirstOrDefault(c => c.Id == model.TwoCat.Id);
}
if (twoCat == null)
{
twoCat = new cats()
{
Id = IdHelper.GetId(),
CreateTime = DateTime.Now,
CreatorId = "admin",
Deleted = false,
Name = model.TwoCat.Text,
ParentId = oneCat.Id
};
int row= Db.Insert(twoCat);
if (row <= 0)
{
throw new Exception("二级类目添加失败!");
}
}
/*
///判断是否需要添加三级类目
*/
cats lastCat = null;
if (!string.IsNullOrEmpty(model.LastCat.Id))
{
lastCat = GetIQueryable().FirstOrDefault(c => c.Id == model.LastCat.Id);
}
if (lastCat == null)
{
lastCat = new cats()
{
Id = IdHelper.GetId(),
CreateTime = DateTime.Now,
CreatorId = "admin",
Deleted = false,
Name = model.LastCat.Text,
ParentId = twoCat.Id
};
int row = Db.Insert(lastCat);
if (row <= 0)
{
throw new Exception("三级类目添加失败!");
}
}
var list = new List<cats>();
model.KeyWords.ForEach(key => {
list.Add(new cats() {
Id = IdHelper.GetId(),
CreateTime = DateTime.Now,
CreatorId = "admin",
Deleted = false,
Name = key,
ParentId = lastCat.Id
});
});
Db.BulkInsert(list);
});
if(result.Success)
{
return Success();
}
return Error();
}
public async Task<PageResult<cats>> GetDataListAsync(PageInput<ConditionDTO> input)
{
var q = GetIQueryable();
var where = LinqHelper.True<cats>();
var search = input.Search;
//筛选
if (!search.Condition.IsNullOrEmpty() && !search.Keyword.IsNullOrEmpty())
{
var newWhere = DynamicExpressionParser.ParseLambda<cats, bool>(
ParsingConfig.Default, false, $@"{search.Condition}.Contains(@0)", search.Keyword);
where = where.And(newWhere);
}
return await q.Where(where).GetPageResultAsync(input);
}
public async Task<cats> GetTheDataAsync(string id)
{
return await GetEntityAsync(id);
}
public async Task AddDataAsync(cats data)
{
await InsertAsync(data);
}
public async Task UpdateDataAsync(cats data)
{
await UpdateAsync(data);
}
public async Task DeleteDataAsync(List<string> ids)
{
await DeleteAsync(ids);
}
#endregion
#region 私有成员
#endregion
}
}

21
src/Coldairarrow.Entity/02.Coldairarrow.Entity.csproj

@ -0,0 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<RootNamespace>Coldairarrow.Entity</RootNamespace>
<AssemblyName>Coldairarrow.Entity</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<NoWarn>1701;1702;CS1591</NoWarn>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Coldairarrow.Util\01.Coldairarrow.Util.csproj" />
</ItemGroup>
</Project>

75
src/Coldairarrow.Entity/Base_Manage/Base_Action.cs

@ -0,0 +1,75 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Coldairarrow.Entity.Base_Manage
{
/// <summary>
/// 系统权限表
/// </summary>
[Table("Base_Action")]
public class Base_Action
{
/// <summary>
/// 主键
/// </summary>
[Key, Column(Order = 1)]
public String Id { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
/// <summary>
/// 创建人Id
/// </summary>
public String CreatorId { get; set; }
/// <summary>
/// 否已删除
/// </summary>
public Boolean Deleted { get; set; }
/// <summary>
/// 父级Id
/// </summary>
public String ParentId { get; set; }
/// <summary>
/// 类型,菜单=0,页面=1,权限=2
/// </summary>
public ActionType Type { get; set; }
/// <summary>
/// 权限名/菜单名
/// </summary>
public String Name { get; set; }
/// <summary>
/// 菜单地址
/// </summary>
public String Url { get; set; }
/// <summary>
/// 权限值
/// </summary>
public String Value { get; set; }
/// <summary>
/// 是否需要权限(仅页面有效)
/// </summary>
public bool NeedAction { get; set; }
/// <summary>
/// 图标
/// </summary>
public string Icon { get; set; }
/// <summary>
/// 排序
/// </summary>
public int Sort { get; set; }
}
}

51
src/Coldairarrow.Entity/Base_Manage/Base_AppSecret.cs

@ -0,0 +1,51 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Coldairarrow.Entity.Base_Manage
{
/// <summary>
/// 应用密钥表
/// </summary>
[Table("Base_AppSecret")]
public class Base_AppSecret
{
/// <summary>
/// 自然主键
/// </summary>
[Key, Column(Order = 1)]
public String Id { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
/// <summary>
/// 创建人Id
/// </summary>
public String CreatorId { get; set; }
/// <summary>
/// 否已删除
/// </summary>
public Boolean Deleted { get; set; }
/// <summary>
/// 应用Id
/// </summary>
public String AppId { get; set; }
/// <summary>
/// 应用密钥
/// </summary>
public String AppSecret { get; set; }
/// <summary>
/// 应用名
/// </summary>
public String AppName { get; set; }
}
}

50
src/Coldairarrow.Entity/Base_Manage/Base_DbLink.cs

@ -0,0 +1,50 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Coldairarrow.Entity.Base_Manage
{
/// <summary>
/// 数据库连接表
/// </summary>
[Table("Base_DbLink")]
public class Base_DbLink
{
/// <summary>
/// 自然主键
/// </summary>
[Key, Column(Order = 1)]
public String Id { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
/// <summary>
/// 创建人Id
/// </summary>
public String CreatorId { get; set; }
/// <summary>
/// 否已删除
/// </summary>
public Boolean Deleted { get; set; }
/// <summary>
/// 连接名
/// </summary>
public String LinkName { get; set; }
/// <summary>
/// 连接字符串
/// </summary>
public String ConnectionStr { get; set; }
/// <summary>
/// 数据库类型
/// </summary>
public String DbType { get; set; }
}
}

46
src/Coldairarrow.Entity/Base_Manage/Base_Department.cs

@ -0,0 +1,46 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Coldairarrow.Entity.Base_Manage
{
/// <summary>
/// 部门表
/// </summary>
[Table("Base_Department")]
public class Base_Department
{
/// <summary>
/// 主键
/// </summary>
[Key, Column(Order = 1)]
public String Id { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
/// <summary>
/// 创建人Id
/// </summary>
public String CreatorId { get; set; }
/// <summary>
/// 否已删除
/// </summary>
public Boolean Deleted { get; set; }
/// <summary>
/// 部门名
/// </summary>
public String Name { get; set; }
/// <summary>
/// 上级部门Id
/// </summary>
public String ParentId { get; set; }
}
}

41
src/Coldairarrow.Entity/Base_Manage/Base_Role.cs

@ -0,0 +1,41 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Coldairarrow.Entity.Base_Manage
{
/// <summary>
/// 系统角色表
/// </summary>
[Table("Base_Role")]
public class Base_Role
{
/// <summary>
/// 主键
/// </summary>
[Key, Column(Order = 1)]
public String Id { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
/// <summary>
/// 创建人Id
/// </summary>
public String CreatorId { get; set; }
/// <summary>
/// 否已删除
/// </summary>
public Boolean Deleted { get; set; }
/// <summary>
/// 角色名
/// </summary>
public String RoleName { get; set; }
}
}

46
src/Coldairarrow.Entity/Base_Manage/Base_RoleAction.cs

@ -0,0 +1,46 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Coldairarrow.Entity.Base_Manage
{
/// <summary>
/// 角色权限表
/// </summary>
[Table("Base_RoleAction")]
public class Base_RoleAction
{
/// <summary>
/// 主键
/// </summary>
[Key, Column(Order = 1)]
public String Id { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
/// <summary>
/// 创建人Id
/// </summary>
public String CreatorId { get; set; }
/// <summary>
/// 否已删除
/// </summary>
public Boolean Deleted { get; set; }
/// <summary>
/// 用户Id
/// </summary>
public String RoleId { get; set; }
/// <summary>
/// 权限Id
/// </summary>
public String ActionId { get; set; }
}
}

75
src/Coldairarrow.Entity/Base_Manage/Base_User.cs

@ -0,0 +1,75 @@
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Coldairarrow.Entity.Base_Manage
{
/// <summary>
/// 系统用户表
/// </summary>
[Table("Base_User")]
public class Base_User
{
/// <summary>
/// 主键
/// </summary>
[Key, Column(Order = 1)]
public String Id { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
/// <summary>
/// 创建人Id
/// </summary>
public String CreatorId { get; set; }
/// <summary>
/// 否已删除
/// </summary>
public Boolean Deleted { get; set; }
/// <summary>
/// 用户名
/// </summary>
public String UserName { get; set; }
/// <summary>
/// 密码
/// </summary>
public String Password { get; set; }
/// <summary>
/// 姓名
/// </summary>
public String RealName { get; set; }
/// <summary>
/// 性别
/// </summary>
public Sex Sex { get; set; }
/// <summary>
/// 出生日期
/// </summary>
public DateTime? Birthday { get; set; }
/// <summary>
/// 所属部门Id
/// </summary>
public String DepartmentId { get; set; }
}
public enum Sex
{
[Description("男人")]
Man = 1,
[Description("女人")]
Woman = 0
}
}

44
src/Coldairarrow.Entity/Base_Manage/Base_UserLog.cs

@ -0,0 +1,44 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Coldairarrow.Entity.Base_Manage
{
/// <summary>
/// 操作记录表
/// </summary>
[Table("Base_UserLog")]
public class Base_UserLog
{
/// <summary>
/// 自然主键
/// </summary>
[Key, Column(Order = 1)]
public String Id { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
/// <summary>
/// 创建人Id
/// </summary>
public String CreatorId { get; set; }
/// <summary>
/// 创建人姓名
/// </summary>
public String CreatorRealName { get; set; }
/// <summary>
/// 日志类型
/// </summary>
public String LogType { get; set; }
/// <summary>
/// 日志内容
/// </summary>
public String LogContent { get; set; }
}
}

46
src/Coldairarrow.Entity/Base_Manage/Base_UserRole.cs

@ -0,0 +1,46 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Coldairarrow.Entity.Base_Manage
{
/// <summary>
/// 用户角色表
/// </summary>
[Table("Base_UserRole")]
public class Base_UserRole
{
/// <summary>
/// 主键
/// </summary>
[Key, Column(Order = 1)]
public String Id { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
/// <summary>
/// 创建人Id
/// </summary>
public String CreatorId { get; set; }
/// <summary>
/// 否已删除
/// </summary>
public Boolean Deleted { get; set; }
/// <summary>
/// 用户Id
/// </summary>
public String UserId { get; set; }
/// <summary>
/// 角色Id
/// </summary>
public String RoleId { get; set; }
}
}

33
src/Coldairarrow.Entity/DTO/Base_UserDTO.cs

@ -0,0 +1,33 @@
using Coldairarrow.Entity.Base_Manage;
using Coldairarrow.Util;
using System.Collections.Generic;
namespace Coldairarrow.Entity
{
[Map(typeof(Base_User))]
public class Base_UserDTO : Base_User
{
public string RoleNames { get => string.Join(",", RoleNameList ?? new List<string>()); }
public List<string> RoleIdList { get; set; }
public List<string> RoleNameList { get; set; }
public RoleTypes RoleType
{
get
{
int type = 0;
var values = typeof(RoleTypes).GetEnumValues();
foreach (var aValue in values)
{
if (RoleNames.Contains(aValue.ToString()))
type += (int)aValue;
}
return (RoleTypes)type;
}
}
public string DepartmentName { get; set; }
public string SexText { get => Sex.GetDescription(); }
public string BirthdayText { get => Birthday?.ToString("yyyy-MM-dd"); }
}
}

32
src/Coldairarrow.Entity/DTO/CatDto.cs

@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Coldairarrow.Entity.DTO
{
public class CatDto
{
public CatModel OneCat { get; set; }
public CatModel TwoCat { get; set; }
public CatModel LastCat { get; set; }
public List<string> KeyWords { get; set; }
}
public class CatModel
{
/// <summary>
/// 类目ID
/// </summary>
public string Id { get; set; }
/// <summary>
/// 类目名称
/// </summary>
public string Text { get; set; }
}
}

12
src/Coldairarrow.Entity/Enum/ActionType.cs

@ -0,0 +1,12 @@
namespace Coldairarrow.Entity
{
/// <summary>
/// 类型,菜单=0,页面=1,权限=2
/// </summary>
public enum ActionType
{
= 0,
= 1,
= 2
}
}

14
src/Coldairarrow.Entity/Enum/RoleTypes.cs

@ -0,0 +1,14 @@
using System;
namespace Coldairarrow.Entity
{
/// <summary>
/// 系统角色类型
/// </summary>
[Flags]
public enum RoleTypes
{
= 1,
= 2
}
}

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save