From 945ecbf5668156e307a149e7e164aba19bd0517e Mon Sep 17 00:00:00 2001
From: fanwensheng <fanwensheng@foxmail.com>
Date: Thu, 10 Mar 2022 17:47:27 +0800
Subject: [PATCH] Add config controller

---
 04.系统编码/App/App.csproj                |  2 ++
 04.系统编码/App/App.csproj.user           |  2 +-
 .../App/Controllers/ConfigController.cs       | 25 +++++++++++++++++++
 04.系统编码/BLL/ConfigBLL.cs              |  5 ++++
 04.系统编码/DAL/ConfigDAL.cs              |  6 +++++
 5 files changed, 39 insertions(+), 1 deletion(-)
 create mode 100644 04.系统编码/App/Controllers/ConfigController.cs

diff --git a/04.系统编码/App/App.csproj b/04.系统编码/App/App.csproj
index 93dcdc4..d605670 100644
--- a/04.系统编码/App/App.csproj
+++ b/04.系统编码/App/App.csproj
@@ -129,6 +129,7 @@
     <Compile Include="App_Start\FilterConfig.cs" />
     <Compile Include="App_Start\RouteConfig.cs" />
     <Compile Include="Controllers\BaseController.cs" />
+    <Compile Include="Controllers\ConfigController.cs" />
     <Compile Include="Controllers\ConfigManagementController.cs" />
     <Compile Include="Controllers\OrgManagementController.cs" />
     <Compile Include="Controllers\PointController.cs" />
@@ -342,6 +343,7 @@
   <ItemGroup>
     <Folder Include="App_Data\" />
     <Folder Include="Models\" />
+    <Folder Include="Views\Config\" />
   </ItemGroup>
   <ItemGroup>
     <Content Include="Content\scripts\beijing\wind-template.json" />
diff --git a/04.系统编码/App/App.csproj.user b/04.系统编码/App/App.csproj.user
index c10b018..f62ca0f 100644
--- a/04.系统编码/App/App.csproj.user
+++ b/04.系统编码/App/App.csproj.user
@@ -16,7 +16,7 @@
     <WebStackScaffolding_IsReferencingScriptLibrariesSelected>False</WebStackScaffolding_IsReferencingScriptLibrariesSelected>
     <WebStackScaffolding_LayoutPageFile />
     <Controller_SelectedScaffolderID>MvcControllerEmptyScaffolder</Controller_SelectedScaffolderID>
-    <Controller_SelectedScaffolderCategoryPath>root/Controller</Controller_SelectedScaffolderCategoryPath>
+    <Controller_SelectedScaffolderCategoryPath>root/Common/MVC/Controller</Controller_SelectedScaffolderCategoryPath>
     <WebStackScaffolding_ControllerDialogWidth>600</WebStackScaffolding_ControllerDialogWidth>
     <WebStackScaffolding_IsAsyncSelected>False</WebStackScaffolding_IsAsyncSelected>
     <NameOfLastUsedPublishProfile>E:\2021\Metro\BeijingSafeguard\04.系统编码\App\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile>
diff --git a/04.系统编码/App/Controllers/ConfigController.cs b/04.系统编码/App/Controllers/ConfigController.cs
new file mode 100644
index 0000000..b8223df
--- /dev/null
+++ b/04.系统编码/App/Controllers/ConfigController.cs
@@ -0,0 +1,25 @@
+using System;
+using System.Web.Mvc;
+using System.Collections.Generic;
+
+using Pingchuan.BeijingSafeguard.BLL;
+using Pingchuan.BeijingSafeguard.Model;
+
+namespace Pingchuan.BeijingSafeguard.App.Controllers
+{
+    public class ConfigController : Controller
+    {
+        // GET: Config
+        public ActionResult Index()
+        {
+            return View();
+        }
+
+        [HttpPost]
+        public JsonResult All()
+        {
+            List<Config> configs = ConfigBLL.All();
+            return Json(configs);
+        }
+    }
+}
\ No newline at end of file
diff --git a/04.系统编码/BLL/ConfigBLL.cs b/04.系统编码/BLL/ConfigBLL.cs
index 070afd7..ed84637 100644
--- a/04.系统编码/BLL/ConfigBLL.cs
+++ b/04.系统编码/BLL/ConfigBLL.cs
@@ -17,5 +17,10 @@ namespace Pingchuan.BeijingSafeguard.BLL
         {
             return ConfigDAL.Query(pageIndex, pageSize);
         }
+
+        public static List<Config> All()
+        {
+            return ConfigDAL.All();
+        }
     }
 }
\ No newline at end of file
diff --git a/04.系统编码/DAL/ConfigDAL.cs b/04.系统编码/DAL/ConfigDAL.cs
index 9e58322..ffe96b6 100644
--- a/04.系统编码/DAL/ConfigDAL.cs
+++ b/04.系统编码/DAL/ConfigDAL.cs
@@ -18,5 +18,11 @@ namespace Pingchuan.BeijingSafeguard.DAL
             Page<Config> page = db.Page<Config>(pageIndex, pageSize, sql);
             return page.Items;
         }
+
+        public static List<Config> All()
+        {
+            string sql = $@"select * from configs";
+            return db.Fetch<Config>(sql);
+        }
     }
 }
\ No newline at end of file