/// <summary> /// 用户列表 /// </summary> /// <param name="request"></param> /// <returns></returns> public static BasePageResponse <UserModel> GetUserList(UserListRequest request) { var response = new BasePageResponse <UserModel>(); var totalSql = "SELECT Count(1) FROM Sys_UserInfo ; "; var total = MysqlHelper.GetScalar <int>(totalSql); if (total > 0) { response.IsSuccess = 1; response.Total = total; response.List = new List <UserModel>(); var sql = "SELECT * FROM Sys_UserInfo "; sql += MysqlHelper.GetPageSql(request.PageIndex, request.PageSize); var list = MysqlHelper.GetList <Sys_UserInfoModel>(sql); list?.ForEach(x => { response.List.Add(new UserModel { Account = x.UIAccount, DepartId = x.UIDepartId, DepartName = x.UIDepartName, Id = x.Id, IsValid = x.UIIsValid, Name = x.UIName, R = x.UIResponsibility, Responsibility = GetResponsibility(x.UIResponsibility) }); }); } return(response); }
/// <summary> /// 用户列表 /// </summary> /// <param name="request"></param> /// <returns></returns> public static BasePageResponse <Sys_DepartInfoModel> GetDepartList(DepartistRequest request) { var response = new BasePageResponse <Sys_DepartInfoModel>(); var whereSql = string.Empty; if (request.IsValid >= 0) { whereSql += $" AND DIIsValid = {request.IsValid}"; } if (!String.IsNullOrEmpty(request.Name)) { whereSql += $" AND DIName Like '%{request.Name.Replace("'", string.Empty).Replace(" ", string.Empty).Trim()}%' "; } var totalSql = $" SELECT Count(1) FROM Sys_DepartInfo WHERE 1=1 {whereSql}; "; var total = MysqlHelper.GetScalar <int>(totalSql); if (total > 0) { response.IsSuccess = 1; response.Total = total; var sql = $" SELECT * FROM Sys_DepartInfo WHERE 1=1 {whereSql} "; sql += MysqlHelper.GetPageSql(request.PageIndex, request.PageSize); response.List = MysqlHelper.GetList <Sys_DepartInfoModel>(sql) ?? new List <Sys_DepartInfoModel>(); } return(response); }