| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676 |
- using CallCenter.Utility;
- using CallCenterApi.Common;
- using CallCenterApi.DB;
- using CallCenterApi.Interface.Controllers.Base;
- using CallCenterApi.Interface.Controllers.Sms;
- using CallCenterApi.Interface.Models.Input;
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Linq;
- using System.Text.RegularExpressions;
- using System.Web;
- using System.Web.Mvc;
- namespace CallCenterApi.Interface.Controllers
- {
- [Authority]
- public class UserAccountController : BaseController
- {
- private BLL.T_Sys_UserAccount sysUserAccountBll = new BLL.T_Sys_UserAccount();
- private BLL.T_Sys_Department departmentBLL = new BLL.T_Sys_Department();
- private BLL.T_Sys_DictionaryValue dicValueBLL = new BLL.T_Sys_DictionaryValue();
- //用户列表
- //[Authority]
- public ActionResult GetList(int isdc=0)
- {
-
-
- DataTable dt = new DataTable();
- string sql = " ";
- try
- {
- //用户管理中,加个筛选项根据角色筛选(筛选二级单位时,可以看到该二级单位下的所有人员)
- string roleId = RequestString.GetQueryString("roleId");
- string rolecode = RequestString.GetQueryString("rolecode");
- //用户管理中,加个筛选项根据角色筛选(筛选二级单位时,可以看到该二级单位下的所有人员)
- string Key = RequestString.GetQueryString("Key");
- int Id = RequestString.GetInt("Id", 0);
- int activation = RequestString.GetInt("activation", -1);
- string strpageindex = RequestString.GetQueryString("page");
- int pageindex = 1;
- string strpagesize = RequestString.GetQueryString("pagesize");
- int pagesize = 10;
- if (Id > 0)
- {
- sql += " and F_DeptId=" + Id;
- }
- if (User.F_RoleCode == "GLY" || User.F_RoleCode == "YSZY" || User.F_RoleCode == "ZXLD" || User.F_RoleCode == "ZXHWY"|| User.F_RoleCode == "MTDD" || User.F_RoleCode == "DMTSH")
- {
- }
- else
- {
- sql += "and F_DeptId in (select F_DeptId from T_Sys_Department where F_State=0 and ( F_DeptId='" + User.F_DeptId + "' or F_PartentId='" + User.F_DeptId + "'))";
- }
- if (!string.IsNullOrWhiteSpace(Key))
- {
- // sql = "";
- string str = string.Format(" and (F_UserCode like '%{0}%' or F_UserName like '%{1}%')", Key, Key);
- sql += str;
- }
- if (activation>-1)
- {
- if (activation==0)
- {
- sql += "and F_LastActiveTime=F_CreateOn";
- }
- else
- {
- sql += "and F_LastActiveTime>F_CreateOn";
- }
- }
- if (!string.IsNullOrWhiteSpace(roleId))
- {
- // sql = "";
- string str = string.Format(" and (F_RoleId = '{0}' )", roleId);
- sql += str;
- }
- if (!string.IsNullOrWhiteSpace(rolecode))
- {
- // sql = "";
- string str = string.Format(" and F_RoleId in ({0})", rolecode);
- sql += str;
- }
- if (strpageindex.Trim() != "")
- {
- pageindex = Convert.ToInt32(strpageindex);
- }
- if (strpagesize.Trim() != "")
- {
- pagesize = Convert.ToInt32(strpagesize);
- }
- if (isdc==1)
- {
- var dtdc = DbHelperSQL.Query(" select F_UserCode 工号, F_UserName 姓名,F_Company 单位,F_Department 科室,F_Post 职务, F_Mobile 手机号码,F_Telephone 办公电话 from T_Sys_UserAccount WITH(NOLOCK) where 1=1 " + sql).Tables[0];
- var msg = new NPOIHelper().ExportToExcel("单位信息列表", dtdc);
- if (msg == "")
- {
- return Success("导出成功");
- }
- else
- {
- return Error("导出失败");
- }
- }
- if (isdc ==2)
- {
- var dtdc = DbHelperSQL.Query("select F_UserCode 坐席工号, F_UserName 用户名称, F_Telephone 用户电话, F_Mobile 用户手机, (select F_RoleName from T_Sys_RoleInfo where F_RoleId = a.F_RoleId ) 用户角色,(select F_DeptName from T_Sys_Department where F_DeptId = a.F_DeptId ) 用户部门,(case F_DeleteFlag when 0 then '正常' else '禁用' end ) 用户状态 ,(case when a.F_CreateOn =a.F_LastActiveTime then '未激活' when a.F_LastActiveTime > a.F_CreateOn then '已激活' else '未激活' end) 是否激活 ,F_CreateOn 创建时间 from T_Sys_UserAccount a WITH(NOLOCK) where 1=1 " + sql).Tables[0];
- var msg = new NPOIHelper().ExportToExcel("用户列表", dtdc);
- if (msg == "")
- {
- return Success("导出成功");
- }
- else
- {
- return Error("导出失败");
- }
- }
- else
- {
- int recordCount = 0;
- dt = BLL.PagerBLL.GetListPager(
- "T_Sys_UserAccount",
- "F_UserId",
- "*",
- sql,
- "ORDER BY F_UserId desc",
- pagesize,
- pageindex,
- true,
- out recordCount);
- List<Model.UserAccount> modelList = new BLL.UserAccount().DataTableToList(dt);
- var obj = new
- {
- rows = modelList.Select(x => new
- {
- F_UserId = x.F_UserId,
- F_UserCode = x.F_UserCode,
- F_ExtensionNumber = x.F_ExtensionNumber,
- F_UserName = x.F_UserName,
- F_GroupName = x.F_GroupName,
- F_DeptId = x.F_DeptId,
- F_RoleId = x.F_RoleId,
- F_GroupId = x.F_GroupId,
- F_SeatFlag = x.F_SeatFlag,
- F_SeatRight = x.F_SeatRight,
- F_SeatLevel = x.F_SeatLevel,
- F_SexFlag = x.F_SexFlag,
- F_RemindFlag = x.F_RemindFlag,
- F_Remark = x.F_Remark,
- F_Telephone = x.F_Telephone,
- F_Mobile = x.F_Mobile,
- F_HomePhone = x.F_HomePhone,
- F_Birthday = x.F_Birthday,
- F_CreateOn = x.F_CreateOn,
- F_CancelOn = x.F_CancelOn,
- F_DeleteFlag = x.F_DeleteFlag,
- F_APPOnFlag = x.F_APPOnFlag,
- F_LastActiveTime = x.F_LastActiveTime,
- F_See = x.F_See,
- F_HJType = x.F_HJType,
- F_PId = x.F_PId,
- F_TmId = x.F_TmId,
- F_RoleName = x.F_RoleName,
- F_DeptName = x.F_DeptName,
- F_WorkNumber = x.F_WorkNumber,
- F_Company = x.F_Company,
- F_Department = x.F_Department,
- F_Post = x.F_Post,
- F_IsSms=x.F_IsSms,
- F_SeartGroupCode = x.F_SeartGroupCode
- }),
- total = recordCount
- };
- return Content(obj.ToJson());
- }
-
- }
- catch (Exception err)
- {
- return Error("错误:" + err.ToString());
- }
- finally
- {
- dt.Clear();
- dt.Dispose();
- }
- }
- //获取用户信息
- //[Authority]
- public ActionResult GetUser(int userId = 0, string userCode = "")
- {
- string sql = "";
- if (userId > 0)
- {
- sql += " and F_UserId=" + userId;
- }
- if (!string.IsNullOrWhiteSpace(userCode))
- {
- sql += " and F_UserCode='" + userCode+"'";
- }
- if (string.IsNullOrWhiteSpace(sql))
- return Error("获取失败");
- Model.T_Sys_UserAccount User = sysUserAccountBll.GetModelList(" 1=1 " + sql).FirstOrDefault();
- if (User == null) return Error("获取失败");
- var depModel = departmentBLL.GetModel(User.F_DeptId);
- var zxzModel = dicValueBLL.GetModel(User.F_GroupId ?? 0);
- return Success("获取成功", new
- {
- F_UserId = User.F_UserId,
- F_UserCode = User.F_UserCode,
- F_ExtensionNumber = User.F_ExtensionNumber,
- F_UserName = User.F_UserName,
- F_DeptId = User.F_DeptId,
- F_RoleId = User.F_RoleId,
- F_GroupId = User.F_GroupId,
- F_SeatFlag = User.F_SeatFlag,
- F_SeatRight = User.F_SeatRight,
- F_SeatLevel = User.F_SeatLevel,
- F_SexFlag = User.F_SexFlag,
- F_RemindFlag = User.F_RemindFlag,
- F_Remark = User.F_Remark,
- F_Telephone = User.F_Telephone,
- F_Mobile = User.F_Mobile,
- F_HomePhone = User.F_HomePhone,
- F_Birthday = (User.F_Birthday ?? DateTime.MinValue).ToString("yyyy-MM-dd"),
- F_CreateOn = User.F_CreateOn,
- F_CancelOn = User.F_CancelOn,
- F_DeleteFlag = User.F_DeleteFlag,
- F_APPOnFlag = User.F_APPOnFlag,
- F_LastActiveTime = User.F_LastActiveTime,
- F_See = User.F_See,
- F_HJType = User.F_HJType ?? 0,
- F_PId = User.F_PId,
- F_TmId = User.F_TmId,
- F_WorkNumber = User.F_WorkNumber,
- F_Name= User.F_Name ,
- F_Company = User.F_Company ,
- F_Department = User.F_Department ,
- F_Post = User.F_Post ,
- F_IsSms = User.F_IsSms,
- //zxzname = zxzModel?.F_Name ?? "",
- depname = depModel?.F_DeptName ?? "",
- F_SeartGroupCode = User.F_SeartGroupCode,
- F_SeartGroupID = User.F_SeartGroupID
- });
- }
- //[Authority]
- //添加用户信息
- public ActionResult AddUsers(UserAccountInput input)
- {
- Regex reg = new Regex(@"^[1-9]\d*$");
- if (!reg.IsMatch(input.Usercode.Trim()))
- {
- return Error("工号必须为正整数");
- }
- Model.T_Sys_UserAccount userAccountModel = new Model.T_Sys_UserAccount();
- userAccountModel.F_UserCode = input.Usercode.Trim();
- userAccountModel.F_UserName = input.Username.Trim();
- userAccountModel.F_Password = input.Password.Trim();
- //userAccountModel.F_ExtensionNumber = input.Extno.Trim();
- userAccountModel.F_WorkNumber = input.Usercode;
- userAccountModel.F_DeptId = input.DeptId;
- userAccountModel.F_RoleId = input.RoleId;
- userAccountModel.F_GroupId = input.GroupId;
- userAccountModel.F_SeatFlag = input.IsSeat;
- userAccountModel.F_SeatRight = input.SearRight;
- userAccountModel.F_SexFlag = input.Sex;
- userAccountModel.F_Remark = input.Remark;
- userAccountModel.F_Mobile = input.Mobile;
- userAccountModel.F_Telephone = input.Telphone;
- userAccountModel.F_Birthday = input.Birth;
- userAccountModel.F_CreateOn = DateTime.Now;
- userAccountModel.F_DeleteFlag = 0;
- userAccountModel.F_ModifytTime = DateTime.Now;
- userAccountModel.F_LastActiveTime = DateTime.Now;
- userAccountModel.F_IsSms = input.F_IsSms;
- //userAccountModel.F_HJType = input.HjType;
- var model = sysUserAccountBll.GetModel(input.Usercode);
- if (model != null)
- return Error("当前员工工号存在,请更换!");
- if (input.GroupId != 0)
- {
- userAccountModel.F_SeartGroupID = input.GroupId;
- Model.T_Sys_SeatGroup sm = new BLL.T_Sys_SeatGroup().GetModel(input.GroupId);
- if (sm != null)
- {
- userAccountModel.F_SeartGroupCode = sm.F_ZXZName;
- }
- }
- if (input.IsSeat)
- {
- // userAccountModel.F_WorkNumber = input.Usercode.Trim();
- if (input.ClassId.Value > 0)
- {
- var cls = new BLL.T_Sys_Class().GetModel(input.ClassId.Value);
- userAccountModel.F_ClassCode = (cls != null ? cls.F_Code : "");
- }
- SysConfigController sys = new SysConfigController();
- //话务人员限制权限判断
- if (sys.IsValidSeatPermission())
- {
- if (sysUserAccountBll.Add(userAccountModel) > 0)
- return Success("新增成功!");
- else
- return Error("新增失败!");
- }
- else
- {
- return Error("话务人员数量已超!");
- }
- }
- if (sysUserAccountBll.Add(userAccountModel) > 0)
- return Success("新增成功!");
- else
- return Error("新增失败!");
-
- }
- //[Authority]
- //修改用户信息
- public ActionResult EditUsers(UserAccountInput input)
- {
- Regex reg = new Regex(@"^[1-9]\d*$");
- if (!reg.IsMatch(input.Usercode.Trim()))
- {
- return Error("工号必须为正整数");
- }
- BLL.T_Sys_UserAccount sysUserAccountBll = new BLL.T_Sys_UserAccount();
- Model.T_Sys_UserAccount userAccountModel = sysUserAccountBll.GetModelList(" F_UserId = " + input.UserId).FirstOrDefault();
- if (userAccountModel == null)
- return Error("获取用户失败");
- userAccountModel.F_UserCode = input.Usercode.Trim();
- userAccountModel.F_UserName = input.Username.Trim();
- //userAccountModel.F_Password = input.Password.Trim();
- //userAccountModel.F_ExtensionNumber = input.Extno.Trim();
- userAccountModel.F_WorkNumber = input.Usercode;
- userAccountModel.F_DeptId = input.DeptId;
- userAccountModel.F_RoleId = input.RoleId;
- // userAccountModel.F_GroupId = input.GroupId;
- userAccountModel.F_SeatFlag = input.IsSeat;
- userAccountModel.F_SeatRight = input.SearRight;
- userAccountModel.F_SexFlag = input.Sex;
- userAccountModel.F_Remark = input.Remark;
- userAccountModel.F_Mobile = input.Mobile;
- userAccountModel.F_Telephone = input.Telphone;
- userAccountModel.F_Birthday = input.Birth;
- userAccountModel.F_IsSms = input.F_IsSms;
- userAccountModel.F_ModifytTime = DateTime.Now;
- //userAccountModel.F_DeleteFlag = 0;
- //userAccountModel.F_HJType = input.HjType;
- if (input.GroupId != 0)
- {
- userAccountModel.F_SeartGroupID = input.GroupId;
- Model.T_Sys_SeatGroup sm = new BLL.T_Sys_SeatGroup().GetModel(input.GroupId);
- if (sm != null)
- {
- userAccountModel.F_SeartGroupCode = sm.F_ZXZName;
- }
- }
- if (input.IsSeat)
- {
- //userAccountModel.F_WorkNumber = input.Usercode.Trim();
- if (input.ClassId.Value > 0)
- {
- var cls = new BLL.T_Sys_Class().GetModel(input.ClassId.Value);
- userAccountModel.F_ClassCode = (cls != null ? cls.F_Code : "");
- }
- SysConfigController sys = new SysConfigController();
- //话务人员限制权限判断
- if (sys.IsValidSeatPermission())
- {
- if (sysUserAccountBll.Update(userAccountModel))
- return Success("编辑成功!");
- else
- return Error("编辑失败!");
- }
- else
- {
- return Error("话务人员数量已超!");
- }
- }
- if (sysUserAccountBll.Update(userAccountModel))
- return Success("编辑成功!");
- else
- return Error("编辑失败!");
- }
- //[Authority]
- //删除/禁用/启用 用户
- public ActionResult DelUsers(string[] ids, int state = 0)
- {
- if (ids == null || ids.Length <= 0)
- return Error("请选择用户");
- var idStr = string.Join(",", ids);
- if (string.IsNullOrEmpty(idStr))
- return Error("请选择用户");
- SysConfigController sys = new SysConfigController();
- //话务人员限制权限判断
- if (state == 0) {
- if (sys.IsValidSeatPermission())
- {
- if (sysUserAccountBll.DeleteList(idStr, state))
- return Success("设置成功");
- else
- return Error("设置失败");
- }
- else
- {
- return Error("话务人员数量已超!");
- }
- }
- if (sysUserAccountBll.DeleteList(idStr, state))
- return Success("设置成功");
- else
- return Error("设置失败");
- }
- //[Authority]
- //删除用户
- public ActionResult WLDelUsers(string[] ids)
- {
- if (ids == null || ids.Length <= 0)
- return Error("请选择用户");
- var idStr = string.Join(",", ids);
- if (string.IsNullOrEmpty(idStr))
- return Error("请选择用户");
- if (sysUserAccountBll.DeleteList(idStr))
- return Success("删除成功");
- else
- return Error("删除失败");
- }
- //获取坐席列表
- public ActionResult GetSeatList()
- {
- //List<Model.T_Sys_UserAccount> userSeartList = sysUserAccountBll.GetModelList(" f_seatflag=1 ");
- var drs = sysUserAccountBll.GetModelList ("f_seatflag=1");
- var userSeartList = from r in drs select new {
- F_UserId =r .F_UserId ,
- F_UserName = r.F_UserName,
- F_UserCode = r.F_UserCode
- };
- // var result = userSeartList.OrderBy(p => p.F_UserName.Substring(p.F_UserName.Length - 1)).ToList();
- return Success("列表加载成功", userSeartList);
- }
- //根据角色获取用户
- public ActionResult GetUsersList(string rolecode)
- {
- var sql = " 1=1 ";
- if (!string.IsNullOrWhiteSpace(rolecode.Trim()))
- {
- string F_RoleId = DbHelperSQL.GetSingle("select F_RoleId from T_Sys_RoleInfo with(nolock) where F_RoleCode='" + rolecode.Trim() + "'")?.ToString() ?? "0";
- sql += " and F_RoleId = " + F_RoleId;
- }
- //List<Model.T_Sys_UserAccount> userList = sysUserAccountBll.GetModelList(sql, " f_userid desc ");
- var userList = sysUserAccountBll.GetList(sql, " f_userid desc ").Tables[0];
- return Success("列表加载成功", userList);
- }
- //根据部门获取用户
- public ActionResult GetDeptUserList(int deptid = 0)
- {
- var DeptUserList = sysUserAccountBll.GetList("F_DeptId='" + deptid + "' ", " f_userid desc ");
- return Success("列表加载成功", DeptUserList);
- }
- //[Authority]
- //获取当前用户信息
- public ActionResult GetNowUser()
- {
- if (User == null)
- return Error("获取失败");
- Model.T_Sys_RoleInfo roleModel = new BLL.T_Sys_RoleInfo().GetModel(User.F_RoleId);
- var obj = new
- {
- user = User,
- role = roleModel
- };
- return Success("获取成功", obj);
- }
- //[Authority]
- /// <summary>
- /// 重置密码
- /// </summary>
- /// <param name="usercode"></param>
- /// <param name="pwd"></param>
- /// <returns></returns>
- public ActionResult ResetPwd(string usercode = "", string pwd = "")
- {
- if (string.IsNullOrWhiteSpace(pwd))
- return Error("请输入密码");
- var model = sysUserAccountBll.GetModel(usercode);
- if (model == null) return Error("此用户不存在");
- model.F_Password = pwd;
- if (sysUserAccountBll.Update(model))
- return Success("重置密码成功");
- else
- return Error("重置密码失败");
- }
- public class VerificationCode
- {
- public string mobile { set; get; }
- public string code { set; get; }
- public DateTime Time { set; get; }
- }
- public ActionResult SendCode(string mobile)
- {
- if (string .IsNullOrEmpty (mobile))
- {
- return Error("请输入将要发送的号码");
- }
- int codes = new Random().Next(1000, 9999);
- // string msg = codes.ToString ();
- // bool n = SMSController.AddSmS(0, msg, "你的验证码是"+ codes+".十分钟有效.", mobile, "168411", "");
- string mag = "[\"" + codes.ToString() + "\"]";
- string v = SmsNewController.AddSmS(0, "你的验证码是" + codes + ".十分钟有效.", mobile, "681240638956277760", mag,
- "");
- if (v=="")
- {
- return Success("发送成功");
- }
- else
- return Error ("发送失败");
- }
- public ActionResult GetUserModify( )
- {
- if (string.IsNullOrEmpty(User.F_Mobile))
- return Error("请填写手机号");
- if (string.IsNullOrEmpty(User.F_Company) || string.IsNullOrEmpty(User.F_Department) || string.IsNullOrEmpty(User.F_Post))
- return Error("用户信息不完整");
- if (User.F_ModifytTime!=null )
- {
- if (((DateTime )User.F_ModifytTime).Month != DateTime.Now.Month)
- {
- if (DateTime.Now.Day >= 5)
- {
- return Error("请及时修改密码");
- }
- }
- }
- return Success("成功");
- }
- public ActionResult UpdatePwd(string name , string company,string department,string post,
- string mobile,string phone, string code, string usercode = "", string pwd = "", string oldPwd = ""
- )
- {
- //if (string.IsNullOrEmpty(code))
- // return Error("请输入短信验证码");
- if (string.IsNullOrWhiteSpace(pwd))
- return Error("请输入密码");
- if (string.IsNullOrEmpty(company) || string.IsNullOrEmpty(department) || string.IsNullOrEmpty(post)|| string.IsNullOrEmpty(name))
- return Error("用户信息不完整");
- var model = sysUserAccountBll.GetModel(usercode);
- if (model == null) return Error("此用户不存在");
- if (pwd.Equals(oldPwd))
- return Error("新密码不能和原密码相同");
- if (!model.F_Password.Equals(oldPwd)) return Error("原密码不正确");
- if (string.IsNullOrEmpty(mobile))
- return Error("请输入手机号码");
- //string msgcount = "你的验证码是" + code + ".十分钟有效.";
- //var sms = new BLL.T_SMS_RecvSMS().GetModelList("Content='"+ msgcount+ "' and CallerNum='"+ mobile+ "'order by RecvTime desc");
- //if (sms != null&& sms.Count >0)
- //{
- // var modelSms = sms.First();
- // if ((DateTime.Now - modelSms.RecvTime ).Minutes > 10)
- // {
- // return Error("验证码已失效");
- // }
- //}
- //else
- // return Error("请获取验证码");
- model.F_Password = pwd;
- if (!string.IsNullOrEmpty(name))
- model.F_UserName = name;
- if (!string.IsNullOrEmpty(company))
- model.F_Company = company;
- if (!string.IsNullOrEmpty(department))
- model.F_Department = department;
- if (!string.IsNullOrEmpty(post))
- model.F_Post = post;
- if (!string.IsNullOrEmpty(mobile))
- model.F_Mobile = mobile;
- if (!string.IsNullOrEmpty(phone))
- model.F_Telephone = phone;
- model.F_ModifytTime = DateTime.Now;
- if (sysUserAccountBll.Update(model))
- return Success("修改成功");
- else
- return Error("修改失败");
- }
- #region App手机端 用户列表
- /// <summary>
- /// App手机端 用户列表
- /// </summary>
- /// <returns></returns>
- //[Authority]
- public ActionResult GetAppUserList()
- {
- DataTable dt = new DataTable();
- string sql = " 1=1 and F_RoleId=2 ";
- try
- {
- string Key = RequestString.GetQueryString("Key");
- if (!string.IsNullOrWhiteSpace(Key))
- {
- string str = string.Format(" and (F_DeptId IN (SELECT F_DeptId FROM dbo.T_Sys_Department WHERE F_DeptName like '%{0}%') or F_UserName like '%{1}%' or F_Mobile like '%{2}%' or F_Telephone like '%{3}%' or F_HomePhone like '%{3}%')", Key, Key, Key, Key, Key);
- sql += str;
- }
- dt = sysUserAccountBll.GetListNoCache(sql).Tables[0];
- List<Model.UserAccount> modelList = new BLL.UserAccount().DataTableToList(dt);
- return Success("获取成功",
- modelList.Select(x => new
- {
- F_UserId = x.F_UserId,
- F_UserCode = x.F_UserCode,
- F_UserName = x.F_UserName,
- F_DeptId = x.F_DeptId,
- F_SexFlag = x.F_SexFlag,
- F_Remark = x.F_Remark,
- F_Telephone = x.F_Telephone,
- F_Mobile = x.F_Mobile,
- F_HomePhone = x.F_HomePhone,
- F_Birthday = x.F_Birthday,
- F_CreateOn = x.F_CreateOn,
- F_APPOnFlag = x.F_APPOnFlag,
- F_LastActiveTime = x.F_LastActiveTime,
- F_RoleName = x.F_RoleName,
- F_DeptName = x.F_DeptName
- })
- );
- }
- catch (Exception err)
- {
- return Error("错误:" + err.ToString());
- }
- finally
- {
- dt.Clear();
- dt.Dispose();
- }
- }
- #endregion
- }
- }
|