| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- using RMYY_CallCenter_Api.Utility;
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Linq;
- using System.Web;
- using System.Web.Mvc;
- namespace RMYY_CallCenter_Api.Controllers.System
- {
- public class UserAccountController : BaseController
- {
- // GET: UserAccount
- //用户列表
- [HttpPost]
- public ActionResult GetList()
- {
- DataTable dt = new DataTable();
- string sql = string.Empty;
- string rolecode = Request.Params["rolecode"];
- string deptcode = Request.Params["deptcode"];
- string key = Request.Params["key"];
- string strpageindex = Request.Params["page"];
- int pageindex = 1;
- string strpagesize = Request.Params["pagesize"];
- int pagesize = 10;
- if (!string.IsNullOrWhiteSpace(deptcode))
- {
- sql += " and F_DeptCode='" + deptcode + "'";
- }
- if (!string.IsNullOrWhiteSpace(rolecode))
- {
- sql += " and F_RoleCode='" + rolecode + "'";
- }
- if (!string.IsNullOrWhiteSpace(key))
- {
- sql += " and (F_UserCode like '%{0}%' or F_UserName like '%{1}%')";
- }
- if (!string.IsNullOrWhiteSpace(strpageindex))
- {
- pageindex = Convert.ToInt32(strpageindex);
- }
- if (!string.IsNullOrWhiteSpace(strpagesize))
- {
- pagesize = Convert.ToInt32(strpagesize);
- }
- int recordCount = 0;
- dt = Bll.PagerBll.GetListPager(
- "T_Sys_UserAccount",
- "F_UserId",
- "*",
- sql,
- "ORDER BY F_UserId desc",
- pagesize,
- pageindex,
- true,
- out recordCount);
- var obj = new
- {
- rows = dt,
- total = recordCount
- };
- return Content(obj.ToJson());
- }
- /// <summary>
- /// 获取用户信息
- /// </summary>
- /// <param name="userId"></param>
- /// <param name="userCode"></param>
- /// <returns></returns>
- public ActionResult GetUser(int userId = 0, string userCode = "")
- {
- string sql = " 1=1 ";
- 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 = new Bll.T_Sys_UserAccount().GetModelList(sql).FirstOrDefault();
- return Success("获取成功", User);
- }
- }
- }
|