From 496dafd14e52483a117b9dbd0a9532b3357aabfc Mon Sep 17 00:00:00 2001
From: yl <ykxkd@outlook.com>
Date: 星期三, 12 十月 2022 10:03:24 +0800
Subject: [PATCH] 生产工单新增修改接口调整

---
 VueWebApi/DLL/DAL/LoginDAL.cs |   69 ++++++++++++++++++++++++++++++----
 1 files changed, 60 insertions(+), 9 deletions(-)

diff --git a/VueWebApi/DLL/DAL/LoginDAL.cs b/VueWebApi/DLL/DAL/LoginDAL.cs
index 4d96c4f..1782c02 100644
--- a/VueWebApi/DLL/DAL/LoginDAL.cs
+++ b/VueWebApi/DLL/DAL/LoginDAL.cs
@@ -18,14 +18,14 @@
         public static string strProcName = ""; //瀹氫箟鍏ㄥ眬sql鍙橀噺
         public static List<SqlParameter> listStr = new List<SqlParameter>(); //瀹氫箟鍏ㄥ眬鍙傛暟闆嗗悎
         public static SqlParameter[] parameters; //瀹氫箟鍏ㄥ眬SqlParameter鍙傛暟鏁扮粍
-        
+        public static string fileip = System.Configuration.ConfigurationManager.AppSettings["FileIP"];
 
         #region [鐧诲綍鏌ヨ]
         public static DataTable LoginSearch(string username, string password)
         {
 
             //鎵цsql
-            strProcName = "select *  from [dbo].[TUser] where usercode=@username and password=@password";
+            strProcName = "select *  from [dbo].[TUser] where usercode=@username and password=@password and is_delete='0'";
             //鍒涘缓鍙傛暟
             listStr.Add(new SqlParameter("@username", username));
             listStr.Add(new SqlParameter("@password", password));
@@ -106,7 +106,7 @@
         #endregion
 
         #region[鏌ヨ鑿滃崟鍔熻兘]
-        public static ToMessage LoginMenu(string usercode)
+        public static ToMessage LoginMenu(string usercode, string usertype)
         {
             string sql = "";
             var dynamicParams = new DynamicParameters();
@@ -114,28 +114,39 @@
             try
             {
                 //鑾峰彇鑿滃崟闆嗗悎(鏍规嵁鐧诲綍鐢ㄦ埛缂栫爜鏌ヨ鏉冮檺鍙嶆帹鑿滃崟)
-                sql = @"select distinct rt.right_code as code,rt.right_name as name,rt.right_seq,rt.is_delete as flag from TRight rt where rt.right_code in( 
+                sql = @"select distinct rt.right_code as code,rt.right_name as name,rt.right_seq,rt.is_delete as flag,imgurl from TRight rt where rt.right_code in( 
 							select A.parent_id  from TRight A
 							left join TRoleRightRelation B on B.right_code=A.right_code
 							left join TRole C on C.role_code=B.role_code
 							left join TUserRoleRelation D on D.role_code=C.role_code
 							left join TUser E on E.usercode=D.user_code
-							where E.usercode=@usercode)  and rt.Type='PC' order by rt.right_seq";
+							where E.usercode=@usercode)  and rt.Type=@usertype order by rt.right_seq";
                 dynamicParams.Add("@usercode", usercode);
+                dynamicParams.Add("@usertype", usertype);
                 var data = DapperHelper.select<TreeObejct>(sql, dynamicParams);
+                data = data.Select(c =>
+                {
+                    c.imgurl = fileip + c.imgurl;
+                    return c;
+                }).ToList();
                 for (int i = 0; i < data.Count; i++)
                 {
-                    sql = @"select distinct mu.right_code as code,mu.right_name as name,mu.right_seq,mu.is_delete as flag
+                    sql = @"select distinct mu.right_code as code,mu.right_name as name,mu.right_seq,mu.is_delete as flag,imgurl
 							from TRight mu
                             inner join TRoleRightRelation rl on mu.right_code=rl.right_code
                             inner join TUserRoleRelation ro on rl.role_code=ro.role_code
-                            where mu.type='PC' and ro.user_code=@usercode and mu.parent_id=@paent_id 
+                            where mu.type=@usertype and ro.user_code=@usercode and mu.parent_id=@paent_id 
 							order by mu.right_seq, mu.right_code";
                     dynamicParams.Add("@usercode", usercode);
+                    dynamicParams.Add("@usertype", usertype);
                     dynamicParams.Add("@paent_id", data[i].code);
                     var data0 = DapperHelper.select<TreeObejctCn>(sql, dynamicParams);
+                    data0 = data0.Select(c =>
+                    {
+                        c.imgurl = fileip + c.imgurl;
+                        return c;
+                    }).ToList();
                     data[i].children = data0;
-
                 }
                 mes.code = "200";
                 mes.Message = "鏌ヨ鎴愬姛!";
@@ -212,7 +223,7 @@
         }
         #endregion
 
-        #region[鐧诲嚭]
+        #region[PC鐧诲嚭]
         public static ToMessage LoginOut(int userid, string usercode, string username, string usertype)
         {
             var sql = "";
@@ -252,5 +263,45 @@
             return mes;
         }
         #endregion
+
+        #region[App鐧诲嚭]
+        public static ToMessage LoginAppOut(int userid, string usercode, string username, string usertype)
+        {
+            var sql = "";
+            var cont = 0;
+            var dynamicParams = new DynamicParameters();
+            RedisHelper redis = new RedisHelper();
+            try
+            {
+                sql = @"update T_Bas_Login set outdate=@outdate,status='N'  where usercode=@usercode and origin=@usertype";
+                dynamicParams.Add("@usercode", usercode);
+                dynamicParams.Add("@outdate", DateTime.Now.ToString());
+                dynamicParams.Add("@usertype", usertype);
+                cont = DapperHelper.SQL(sql, dynamicParams);
+                if (cont > 0)
+                {
+                    mes.code = "200";
+                    mes.count = 0;
+                    mes.Message = "鐧诲嚭鎴愬姛!";
+                    mes.data = null;
+                }
+                else
+                {
+                    mes.code = "300";
+                    mes.count = 0;
+                    mes.Message = "鐧诲嚭澶辫触!";
+                    mes.data = null;
+                }
+            }
+            catch (Exception e)
+            {
+                mes.code = "300";
+                mes.count = 0;
+                mes.Message = e.Message;
+                mes.data = null;
+            }
+            return mes;
+        }
+        #endregion
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3