From 59abbe4785268a10ec9390b8373cce3939c1d24b Mon Sep 17 00:00:00 2001
From: lg <999544862qq.com>
Date: 星期一, 02 九月 2024 15:42:22 +0800
Subject: [PATCH] 打印测试

---
 WebApi/Gs.User/Service/MenuActionController.cs |   83 ++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 81 insertions(+), 2 deletions(-)

diff --git a/WebApi/Gs.User/Service/MenuActionController.cs b/WebApi/Gs.User/Service/MenuActionController.cs
index 111766a..7318af5 100644
--- a/WebApi/Gs.User/Service/MenuActionController.cs
+++ b/WebApi/Gs.User/Service/MenuActionController.cs
@@ -9,13 +9,20 @@
 using System.Text;
 using System.Threading.Tasks;
 using Gs.User.Modes;
+using Microsoft.Extensions.Primitives;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Http.Connections.Features;
 
 namespace Gs.User.Service
 {
     [ApiGroup(ApiGroupNames.Auth)]
     public class MenuActionController : IRomteService
     {
-
+        private readonly IHttpContextAccessor _http;
+        public MenuActionController(IHttpContextAccessor httpContextAccessor)
+        {
+            _http = httpContextAccessor;
+        }
         /// <summary>
         /// 璇诲彇鍔熻兘鑿滃崟鍒楄〃锛屾敮鎸佸垎椤�
         /// </summary>
@@ -24,6 +31,8 @@
         [RequestMethod(RequestMethods.POST)]
         public ReturnDto<PageList<MenuAction>> GetListPage([FromBody] PageQuery model)
         {
+            (string userGuid, string orgGuid) = Gs.Toolbox.UtilityHelper.GetUserGuidAndOrgGuid(_http);
+            Gs.Toolbox.LogHelper.Debug(this.ToString(), "userGuid:" + userGuid + "锛宱rgGuid:" + orgGuid);
             int currentPage = model.currentPage;
             int everyPageSize = model.everyPageSize;
             string sortName = string.IsNullOrEmpty(model.sortName) ? "a.idx" : model.sortName;
@@ -127,7 +136,6 @@
         [RequestMethod(RequestMethods.POST)]
         public ReturnDto<int?> EditModel([FromBody] MenuAction model)
         {
-            string dddd = model.guid.ToString();
             Guid? guid = model.guid;
             Guid? upGuid = model.upGuid;
             string name = model.name;
@@ -214,5 +222,76 @@
                 return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Default, "璇诲彇澶辫触锛�");
             }
         }
+
+
+        /// <summary>
+        /// 璇诲彇鍔熻兘鑿滃崟鍒楄〃锛屽垎缁勭粐灞曠幇鏉冮檺鑿滃崟
+        /// </summary>
+        /// <returns></returns>
+        [RequestMethod(RequestMethods.POST)]
+        public ReturnDto<PageList<MenuAction>> GetListPageByOrg()
+        {
+            System.Text.StringBuilder _orgSql = new StringBuilder();
+            _orgSql.Append("select org.guid,null as upGuid,org.name,org.status from [dbo].[sys_Organization] org   where upGuid is not null ");
+            DataSet _orgDset = new DataSet();
+            System.Text.StringBuilder sbSql = new StringBuilder();
+            try
+            {
+                _orgDset = Gs.Toolbox.DbHelperSQL.Query(_orgSql.ToString());
+                foreach (DataRow row in _orgDset.Tables[0].Rows)
+                {
+                    if (sbSql.Length > 0)
+                        sbSql.Append(" union all");
+                    sbSql.Append(" select org.guid,null as upGuid,org.name,org.status,'" + row["guid"].ToString() + "' as orgGuid from [dbo].[sys_Organization] org where org.guid ='" + row["guid"].ToString() + "'");
+                    sbSql.Append(" union all");
+                    sbSql.Append(" select ma.guid,isnull(ma.upGuid,'" + row["guid"].ToString() + "') as upGuid,ma.name,ma.status,'" + row["guid"].ToString() + "' as orgGuid from sys_MenuAction ma");
+                }
+            }
+            catch (Exception ex)
+            {
+                Gs.Toolbox.LogHelper.Debug(this.ToString(), "GetListPage error锛�" + ex.Message);
+                return ReturnDto<PageList<MenuAction>>.QuickReturn(default(PageList<MenuAction>), ReturnCode.Exception, "璇诲彇澶辫触");
+            }
+            DataSet dset = new DataSet();
+            try
+            {
+                dset = Gs.Toolbox.DbHelperSQL.Query(sbSql.ToString());
+            }
+            catch (Exception ex)
+            {
+                Gs.Toolbox.LogHelper.Debug(this.ToString(), "GetListPage error锛�" + ex.Message);
+                return ReturnDto<PageList<MenuAction>>.QuickReturn(default(PageList<MenuAction>), ReturnCode.Exception, "璇诲彇澶辫触");
+            }
+            PageList<MenuAction> _pglist = new PageList<MenuAction>
+            {
+                total = 0,
+                everyPageSize = 0,
+                pages = 0,
+                list = new List<MenuAction>()
+            };
+            if (dset != null && dset.Tables.Count > 0 && dset.Tables[0].Rows.Count > 0)//鏈夋暟鎹�
+            {
+                int intTotal = 999;
+                int pages = 1;
+                _pglist.total = intTotal;
+                _pglist.everyPageSize = 1;
+                _pglist.pages = pages;
+                foreach (DataRow dr in dset.Tables[0].Rows)
+                {
+                    _pglist.list.Add(
+                        new MenuAction()
+                        {
+                            guid = Guid.Parse(dr["guid"].ToString()),
+                            upGuid = dr["upGuid"].ToString().Length > 0 ? Guid.Parse(dr["upGuid"].ToString()) : null,
+                            name = dr["name"].ToString(),
+                            status = int.Parse(dr["status"].ToString()),
+                            orgGuid = dr["orgGuid"].ToString(),
+                        }
+                    );
+                }
+            }
+            return ReturnDto<PageList<MenuAction>>.QuickReturn(_pglist, ReturnCode.Success, "璇诲彇鎴愬姛");
+        }
+
     }
 }

--
Gitblit v1.9.3