From f2b71fe1d3c2b7651d525a5b5bbe66fad602ea06 Mon Sep 17 00:00:00 2001
From: 啊鑫 <t2856754968@163.com>
Date: 星期二, 09 九月 2025 18:46:28 +0800
Subject: [PATCH] 代码清理

---
 WebApi/Gs.BaseInfo/Services/MesStaffManager.cs |   93 ++++++++++++++--------------------------------
 1 files changed, 28 insertions(+), 65 deletions(-)

diff --git a/WebApi/Gs.BaseInfo/Services/MesStaffManager.cs b/WebApi/Gs.BaseInfo/Services/MesStaffManager.cs
index e427a48..d8cdc49 100644
--- a/WebApi/Gs.BaseInfo/Services/MesStaffManager.cs
+++ b/WebApi/Gs.BaseInfo/Services/MesStaffManager.cs
@@ -1,4 +1,5 @@
-锘縰sing Gs.Entity.BaseInfo;
+锘縰sing System.Text;
+using Gs.Entity.BaseInfo;
 using Gs.Entity.Sys;
 using Gs.Toolbox;
 using Gs.Toolbox.ApiCore.Abstract.Mvc;
@@ -7,10 +8,6 @@
 using Microsoft.AspNetCore.Http;
 using Microsoft.AspNetCore.Mvc;
 using SqlSugar;
-using System.Data;
-using System.Data.SqlClient;
-using System.Dynamic;
-using System.Text;
 
 namespace Gs.BaseInfo.Services;
 
@@ -20,6 +17,7 @@
     private readonly IHttpContextAccessor _http;
 
     private readonly string _userCode, _userGuid, _orgFids;
+
     public MesStaffManager(IHttpContextAccessor httpContextAccessor)
     {
         _http = httpContextAccessor;
@@ -42,24 +40,32 @@
             var _sbBy =
                 new StringBuilder(query.sortName + " " + query.sortOrder);
             var totalCount = 0;
-            var itemsList = Db.Queryable<MesStaff, SysOrganization, MesPosition>((a, org, c) =>
+            var itemsList = Db
+                .Queryable<MesStaff, SysOrganization,
+                    MesPosition>((a, org, c) =>
                     new object[]
                     {
                         JoinType.Left, a.FSubsidiary == org.Fid,
                         JoinType.Left, a.PositionCode == c.Id.ToString()
                     }).Select((a, org, c) => new MesStaff
-                    {
-                        FSubsidiary = "(" + org.FNumber + ")" + org.Name,
-                        PositionName = c.PositionName,
-                        FforbidStatus = a.FforbidStatus + ":" + (a.FforbidStatus == "A" ? "姝e父" : "绂佺敤"),
-                        DataType = a.DataType + ":"
-                        + SqlFunc.IF(a.DataType == "Z").Return("鏆傚瓨")
-                        .ElseIF(a.DataType == "A").Return("鍒涘缓")
-                        .ElseIF(a.DataType == "B").Return("瀹℃牳涓�")
-                        .ElseIF(a.DataType == "C").Return("宸插鏍�")
-                        .ElseIF(a.DataType == "D").Return("閲嶆柊瀹℃牳")
-                        .End(a.DataType)
-                    }, true)
+                {
+                    FSubsidiary = "(" + org.FNumber + ")" + org.Name,
+                    PositionName = c.PositionName,
+                    FforbidStatus = a.FforbidStatus + ":" +
+                                    (a.FforbidStatus == "A" ? "姝e父" : "绂佺敤"),
+                    DataType = a.DataType + ":"
+                                          + SqlFunc.IF(a.DataType == "Z")
+                                              .Return("鏆傚瓨")
+                                              .ElseIF(a.DataType == "A")
+                                              .Return("鍒涘缓")
+                                              .ElseIF(a.DataType == "B")
+                                              .Return("瀹℃牳涓�")
+                                              .ElseIF(a.DataType == "C")
+                                              .Return("宸插鏍�")
+                                              .ElseIF(a.DataType == "D")
+                                              .Return("閲嶆柊瀹℃牳")
+                                              .End(a.DataType)
+                }, true)
                 .Where(_sbWhere.ToString())
                 .OrderBy(_sbBy.ToString())
                 .ToPageList(query.currentPage, query.everyPageSize,
@@ -83,55 +89,12 @@
     /// <param name="guid"></param>
     /// <returns></returns>
     [RequestMethod(RequestMethods.POST)]
-    //public ReturnDto<MesStaff> GetModel([FromBody] MesStaff model)
-    //{
-    //    var m = base.GetById(model.Guid);
-    //    if (m != null)
-    //        return ReturnDto<MesStaff>.QuickReturn(m, ReturnCode.Success,
-    //            "璇诲彇鎴愬姛锛�");
-    //    return ReturnDto<MesStaff>.QuickReturn(m, ReturnCode.Default, "璇诲彇澶辫触锛�");
-    //}
-
-    public ReturnDto<ExpandoObject> GetModel([FromBody] dynamic model)
+    public ReturnDto<MesStaff> GetModel([FromBody] MesStaff model)
     {
-        string guid = model.guid.ToString();
-        dynamic m = new ExpandoObject();
-        m.list = new List<dynamic>();
-        m.list2 = new List<dynamic>();
-        SqlParameter[] parameters =
-        {
-            new("@inMainGuid", guid),
-            new("@inP1", ""),
-            new("@inP2", ""),
-            new("@inP3", ""),
-            new("@inP4", "")
-        };
-        var dset = new DataSet();
-        try
-        {
-            dset = DbHelperSQL.RunProcedure("[prc_staff_mx]", parameters, "0");
-            if (dset != null && dset.Tables.Count > 0 &&
-                dset.Tables[0].Rows.Count > 0)
-            {
-                var dr = dset.Tables[0].Rows[0];
-                m = dr.RowToDynamic();
-                var _tb = dset.Tables[1].TableToDynamicList();
-                m.list = _tb;
-                //var _tb2 = dset.Tables[2].TableToDynamicList();
-                //m.list2 = _tb2;
-            }
-        }
-        catch (Exception ex)
-        {
-            LogHelper.Debug(ToString(), ex.Message);
-        }
-
+        var m = base.GetById(model.Guid);
         if (m != null)
-            return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Success,
+            return ReturnDto<MesStaff>.QuickReturn(m, ReturnCode.Success,
                 "璇诲彇鎴愬姛锛�");
-        return ReturnDto<dynamic>.QuickReturn(m, ReturnCode.Default, "璇诲彇澶辫触锛�");
+        return ReturnDto<MesStaff>.QuickReturn(m, ReturnCode.Default, "璇诲彇澶辫触锛�");
     }
-
-
-
 }
\ No newline at end of file

--
Gitblit v1.9.3