/// <summary> /// 筛选员工信息 /// </summary> /// <param name="model">员工model</param> /// <returns></returns> public List <ReturnDataEmployee> GetEnployeeList(EmployeeConditions model) { int pageSize = int.Parse(ConfigurationManager.AppSettings["pageSize"].ToString()); DataTable dt = employeedal.GetEnployeeList(model); List <ReturnDataEmployee> list = new List <ReturnDataEmployee>(); if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { ReturnDataEmployee emp = new ReturnDataEmployee(); emp.employeeId = dt.Rows[i][0].ToString(); emp.realName = dt.Rows[i][1].ToString(); emp.sex = dt.Rows[i][2].ToString(); emp.age = dt.Rows[i][3].ToString(); emp.idNumber = dt.Rows[i][4].ToString(); emp.mobilephone = dt.Rows[i][5].ToString(); emp.customerName = dt.Rows[i][6].ToString(); emp.post = dt.Rows[i][7].ToString(); emp.emppersonnelpro = dt.Rows[i][8].ToString(); emp.state = dt.Rows[i][9].ToString(); emp.employeeType = dt.Rows[i][10].ToString(); emp.stratTime = dt.Rows[i][11].ToString(); emp.leaveTime = dt.Rows[i][12].ToString(); emp.customerId = dt.Rows[i][13].ToString(); emp.rn = dt.Rows[i][14].ToString(); emp.totalCount = Math.Ceiling(int.Parse(dt.Rows[i][15].ToString()) * 1.0 / pageSize).ToString(); list.Add(emp); } } return(list); }
/// <summary> /// 筛选员工信息 /// </summary> /// <param name="model">员工model</param> /// <returns></returns> public DataTable GetEnployeeList(EmployeeConditions model) { if (string.IsNullOrEmpty(model.current) || model.current == "0") { model.current = "1"; } int pageSize = int.Parse(ConfigurationManager.AppSettings["pageSize"].ToString()); string customerId = model.customerId; string customerids = FairhrForeign.Others.Function.GetParentCustomerID(ref customerId); string sql = @"select t.* from (select distinct b.employeeid, b.realname, b.sex, b.age, b.idnumber, b.mobilephone, c.customername, a.post, decode(b.EMPPERSONNELPRO,'1','派遣','2','代理','3','其他','4','外包') as EMPPERSONNELPRO, decode(b.islevel,'0','在职','1','已离职') as state, decode(b.EMPLOYEETYPE,'1','全日制','2','非全日制') as EMPLOYEETYPE, to_char(nvl(b.servicetime,b.addtime),'yyyy-MM-dd') as startTime, to_char(b.LEAVETIME,'yyyy-MM-dd') as leavetime, a.customerid, row_number() over(order by to_char(nvl(b.servicetime, b.addtime), 'yyyy-MM-dd') desc) rn, count(*) over() totalCount from em_employeecompany a left join em_employee b on a.employeeid = b.employeeid left join cu_customer c on c.customerid=a.customerid where a.isdelete = 0 and b.isdelete=0 and c.isdelete=0 and a.customerid in (" + customerids + ")"; if (!string.IsNullOrEmpty(model.sex)) { sql += "and b.sex='" + model.sex + "'"; } if (!string.IsNullOrEmpty(model.state)) { sql += "and b.islevel='" + model.state + "'"; } if (!string.IsNullOrEmpty(model.emppersonnelpro)) { sql += "and b.EMPPERSONNELPRO='" + model.emppersonnelpro + "'"; } if (!string.IsNullOrEmpty(model.employeeType)) { sql += "and b.EMPLOYEETYPE='" + model.employeeType + "'"; } sql += "order by to_char(nvl(b.servicetime, b.addtime), 'yyyy-MM-dd') desc"; sql += ")t where t.rn between (" + model.current + " -1) * " + pageSize + " and " + model.current + " *" + pageSize; return(FairHR.Common.DbHelperOra.Query(sql).Tables[0]); }
public IHttpActionResult GetEnployeeList(EmployeeConditions model) { return(Json(employeeBll.GetEnployeeList(model))); }