yl
2023-06-17 5b4fb9c56426b5096555560a44dd365b02853ad4
VueWebApi/DLL/DAL/LoginDAL.cs
@@ -28,7 +28,9 @@
        {
            //执行sql
            strProcName = "select *  from [dbo].[TUser] where usercode=@username and password=@password and is_delete='0'";
            strProcName = @"select *  from TUser U
                            left join TOrganization T on U.stu_torgcode = T.org_code
                            where U.usercode =@username and U.password =@password and U.is_delete = '0'";
            //创建参数
            listStr.Add(new SqlParameter("@username", username));
            listStr.Add(new SqlParameter("@password", password));
@@ -40,18 +42,19 @@
        #endregion
        #region [写入登录记录表]
        public static ToMessage LoginBas(string usercode, string usertype)
        public static ToMessage LoginBas(string usercode, string usertype,string stu_torgcode)
        {
            var sql = "";
            var cont = 0;
            var dynamicParams = new DynamicParameters();
            try
            {
                sql = @"insert into T_Bas_Login(usercode,status,indate,origin)
                            values(@usercode,'Y',@indate,@usertype)";
                sql = @"insert into T_Bas_Login(usercode,status,indate,origin,torg_code)
                            values(@usercode,'Y',@indate,@usertype,@stu_torgcode)";
                dynamicParams.Add("@usercode", usercode);
                dynamicParams.Add("@usertype", usertype);
                dynamicParams.Add("@indate", DateTime.Now.ToString());
                dynamicParams.Add("@stu_torgcode", stu_torgcode);
                cont = DapperHelper.SQL(sql, dynamicParams);
                if (cont > 0)
                {
@@ -301,7 +304,7 @@
        #endregion
        #region[PC登出]
        public static ToMessage LoginOut(int userid, string usercode, string username, string usertype)
        public static ToMessage LoginOut(int userid, string usercode, string username, string usertype,string stu_torgcode)
        {
            var sql = "";
            var cont = 0;
@@ -309,15 +312,16 @@
            RedisHelper redis = new RedisHelper();
            try
            {
                sql = @"insert into T_Bas_Login(usercode,status,outdate,origin)
                            values(@usercode,'N',@outdate,@usertype)";
                sql = @"insert into T_Bas_Login(usercode,status,outdate,origin,torg_code)
                            values(@usercode,'N',@outdate,@usertype,@stu_torgcode)";
                dynamicParams.Add("@usercode", usercode);
                dynamicParams.Add("@usertype", usertype);
                dynamicParams.Add("@outdate", DateTime.Now.ToString());
                dynamicParams.Add("@stu_torgcode", stu_torgcode);
                cont = DapperHelper.SQL(sql, dynamicParams);
                if (cont > 0)
                {
                    redis.Remove(Enterprise + "LoginUserID" + usertype + userid, 0); //删除redis
                    redis.Remove(Enterprise + stu_torgcode + "LoginUserID" + usertype + userid, 0); //删除redis
                    mes.code = "200";
                    mes.count = 0;
                    mes.Message = "登出成功!";
@@ -399,7 +403,7 @@
                        left  join TOrganization T on B.wkshp_code=T.org_code 
                        left  join TAnDonType D on A.type=d.code
                        left  join TUser U on A.resp_user=U.usercode
                        where A.resp_user=@usercode and B.status='START' and U.rid=@rid  and T.description='W'";
                        where A.resp_user=@usercode and B.status='START' and U.rid=@rid";
                dynamicParams.Add("@usercode", usercode);
                dynamicParams.Add("@rid", rid);
                var data = DapperHelper.selectdata(sql, dynamicParams);