From 0746808ea9b8e197b263f911fec116cadd0f34fb Mon Sep 17 00:00:00 2001 From: yanjinhui <3306209981@qq.com> Date: 星期日, 15 六月 2025 16:19:23 +0800 Subject: [PATCH] 1 --- 项目代码/后端/WCS/WIDESEAWCS_Server/WIDESEAWCS_SystemServices/Sys_UserService.cs | 92 +++++++++++++++++++++++++++++++--------------- 1 files changed, 62 insertions(+), 30 deletions(-) diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/\345\220\216\347\253\257/WCS/WIDESEAWCS_Server/WIDESEAWCS_SystemServices/Sys_UserService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/\345\220\216\347\253\257/WCS/WIDESEAWCS_Server/WIDESEAWCS_SystemServices/Sys_UserService.cs" index 8f4080e..15a7b55 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/\345\220\216\347\253\257/WCS/WIDESEAWCS_Server/WIDESEAWCS_SystemServices/Sys_UserService.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/\345\220\216\347\253\257/WCS/WIDESEAWCS_Server/WIDESEAWCS_SystemServices/Sys_UserService.cs" @@ -18,6 +18,8 @@ using System.Runtime.InteropServices; using System.IO; using WIDESEAWCS_DTO.Telescopic; +using System.Reflection.PortableExecutable; +using Microsoft.AspNetCore.Mvc; namespace WIDESEAWCS_SystemServices { @@ -724,6 +726,7 @@ public WebResponseContent DeleteUserData(string account) { try + { // 2. 鏌ヨ浜鸿劯搴撳垎缁� ID @@ -936,22 +939,27 @@ try { int totalCount = 0; - var Role = _RoleServer.Db.Queryable<Sys_Role>(); - var query = Role.InnerJoin<Sys_User>((a, b) => a.RoleId == b.Role_Id); + //var Role = _RoleServer.Db.Queryable<Sys_Role>(); + //var query = Role.InnerJoin<Sys_User>((a, b) => a.RoleId == b.Role_Id) + // .InnerJoin<Sys_UserFace>((a, b, c) => b.UserName == c.UserName); + + var User = BaseDal.Db.Queryable<Sys_User>(); //鏌ュ嚭鐢ㄦ埛琛� + var query = User.LeftJoin<Sys_UserFace>((a, b) => a.UserName == b.UserName); + //鎼滅储鍏抽敭瀛� if (!string.IsNullOrEmpty(pagination.searchKeyword)) { query = query.Where((a, b) => - b.UserName.Contains(pagination.searchKeyword) || - b.UserTrueName.Contains(pagination.searchKeyword) || - b.PhoneNo.Contains(pagination.searchKeyword) || + a.UserName.Contains(pagination.searchKeyword) || + a.UserTrueName.Contains(pagination.searchKeyword) || + a.PhoneNo.Contains(pagination.searchKeyword) || a.RoleName.Contains(pagination.searchKeyword)); } //鏃堕棿鏌ヨ if (pagination.startDate.HasValue && pagination.endDate.HasValue) { - query = query.Where((a, b) => b.CreateDate >= pagination.startDate.Value && b.CreateDate <= pagination.endDate.Value); + query = query.Where((a, b) => a.CreateDate >= pagination.startDate.Value && a.CreateDate <= pagination.endDate.Value); } //鎺掑簭 if (!string.IsNullOrEmpty(pagination.sortField)) @@ -961,38 +969,38 @@ { - "CreateDate" => isAcs ? query.OrderBy((a, b) => b.CreateDate) : query.OrderByDescending((a, b) => b.CreateDate), + "CreateDate" => isAcs ? query.OrderBy((a, b) => a.CreateDate) : query.OrderByDescending((a, b) => a.CreateDate), - _ => query.OrderByDescending((a, b) => b.Creater) // 榛樿鎸夊垱寤烘椂闂撮檷搴� + _ => query.OrderByDescending((a, b) => a.Creater) // 榛樿鎸夊垱寤烘椂闂撮檷搴� }; } else { - query = query.OrderByDescending((a, b) => b.Creater); + query = query.OrderByDescending((a, b) => a.Creater); } var reslut = query.Select((a, b) => new { - b.User_Id, - b.UserName, - b.UserTrueName, - b.Unit, - b.Userteam, - b.Role_Id, - b.IsLeader, - //b.RoleName, - b.CardNumber, - b.PhoneNo, - b.UserPwd, - b.DeptName, - b.Dept_Id, - b.Email, - b.Enable, - b.Gender, - b.HeadImageUrl, - b.Address, - b.CreateDate, - b.Creater, + a.User_Id, + a.UserName, + a.UserTrueName, + a.Unit, + a.Userteam, + a.Role_Id, + a.IsLeader, + a.CardNumber, + a.PhoneNo, + a.UserPwd, + a.DeptName, + a.Dept_Id, + a.Email, + a.Enable, + a.Gender, + //b.HeadImageUrl, + b.UserFaceImageName, + a.Address, + a.CreateDate, + a.Creater, a.RoleName, }).ToPageList(pagination.pageIndex, pagination.pageSize, ref totalCount); @@ -1017,7 +1025,31 @@ return new WebResponseContent { Status = false, Message = ex.Message }; } } - + + + /// <summary> + /// 鎵归噺鍒犻櫎 + /// </summary> + /// <param name="keys">鐢ㄦ埛id</param> + /// <returns></returns> + public WebResponseContent DelUserList(int[] keys) + { + WebResponseContent webResponse=new WebResponseContent(); + foreach (int key in keys) + { + var user = BaseDal.QueryData(x => x.User_Id == key).FirstOrDefault(); + if (user == null) + { + return webResponse.Error("娌℃湁鎵惧埌璇ョ敤鎴�"); + } + var main = _MainServer.QueryData(x => x.UserAccount == user.UserName).FirstOrDefault(); + + BaseDal.DeleteData(user); + _MainServer.DeleteData(main); + } + + return webResponse.OK(); + } } } -- Gitblit v1.9.3