/// <summary> /// 查找指定条件的员工集合 /// </summary> /// <param name="employeeSearcher">员工查询对象</param> /// <returns>返回员工实体对象集合</returns> public IList<Employee> FindList(EmployeeSearcher employeeSearcher) { PageList<Employee> pageList = this.FindList(employeeSearcher, null, null); return pageList == null ? null : pageList.RecordList; }
public void FindEmployeeByNotLikeConditionStringTest() { EmployeeSearcher empSearcher = new EmployeeSearcher(); // 这句应该写入Dal进行控制,这里用于测试 empSearcher.Name.ConditionString = "LOWER(" + SQLPlaceholder.ColName + ")"; empSearcher.Name.NotLike("emp"); IList<Employee> employeeList = OrgHandler.FindEmployeeList(empSearcher); int allCount = 0; Assert.AreEqual(allCount, employeeList == null ? 0 : employeeList.Count); }
public void FindEmployeeBySingleSortTest() { EmployeeSearcher employeeSearcher = new EmployeeSearcher(); employeeSearcher.Rand.SortOrder = SortOrder.Desc; IList<Employee> employeeList = OrgHandler.FindEmployeeList(employeeSearcher); Assert.IsTrue(employeeList[0].Rand >= employeeList[1].Rand); }
public void FindEmployeeByNotInColumnTest() { EmployeeSearcher empSearcher = new EmployeeSearcher(); empSearcher.JoinDate.NotIn(new SearchColumn[] { empSearcher.StartWorkDate }); IList<Employee> employeeList = OrgHandler.FindEmployeeList(empSearcher); bool isSucc = employeeList == null ? false : (employeeList.Count >= 1 ? true : false); Assert.AreEqual(true, isSucc); }
public void FindEmployeeByNotInTest() { EmployeeSearcher empSearcher = new EmployeeSearcher(); empSearcher.EmployeeCode.NotIn(QueryTest.EmployeeCodeList.ToArray()); IList<Employee> employeeList = OrgHandler.FindEmployeeList(empSearcher); int allCount = 770; Assert.AreEqual(allCount, employeeList == null ? 0 : employeeList.Count); }
public void FindEmployeeByMultipleSortStringTest() { EmployeeSearcher employeeSearcher = new EmployeeSearcher(); // 这句应该写入Dal进行控制,这里用于测试 employeeSearcher.EmployeeCode.SortString = "SUBSTRING(" + SQLPlaceholder.ColName + ", 1, 6)"; employeeSearcher.EmployeeCode.SortOrder = SortOrder.Desc; employeeSearcher.EmployeeCode.SortIndex = 1; employeeSearcher.Rand.SortOrder = SortOrder.Desc; employeeSearcher.Rand.SortIndex = 2; IList<Employee> employeeList = OrgHandler.FindEmployeeList(employeeSearcher); Assert.IsTrue(employeeList[0].CompanyId.Equals(employeeList[1].CompanyId)); Assert.IsTrue(employeeList[0].Rand >= employeeList[1].Rand); }
public void FindEmployeeByNotEqualConditionStringTest() { EmployeeSearcher empSearcher = new EmployeeSearcher(); // 这句应该写入Dal进行控制,这里用于测试 empSearcher.Birthday.ConditionString = "MONTH(" + SQLPlaceholder.ColName + ")"; empSearcher.Birthday.NotEqual(10); IList<Employee> employeeList = OrgHandler.FindEmployeeList(empSearcher); int allCount = 779; Assert.AreEqual(allCount, 779); }
public void FindEmployeeByConditionGroupTest2() { EmployeeSearcher employeeSearcher = new EmployeeSearcher(); employeeSearcher.CurrCompany = new CompanySearcher(); Group.And(Group.Or(employeeSearcher.EmployeeCode.Equal(QueryTest.EmployeeCodeList[4]), employeeSearcher.EmployeeCode.Equal(QueryTest.EmployeeCodeList[5]), Group.Or(employeeSearcher.EmployeeCode.Equal(QueryTest.EmployeeCodeList[0]), employeeSearcher.EmployeeCode.Equal(QueryTest.EmployeeCodeList[1])), Group.Or(employeeSearcher.EmployeeCode.Equal(QueryTest.EmployeeCodeList[2]), employeeSearcher.EmployeeCode.Equal(QueryTest.EmployeeCodeList[3]))), Group.Or(employeeSearcher.CurrCompany.CompanyCode.Equal("10201"), employeeSearcher.CurrCompany.CompanyCode.Equal("10301"), Group.Or(employeeSearcher.EmployeeCode.Equal(QueryTest.EmployeeCodeList[6]), employeeSearcher.EmployeeCode.Equal(QueryTest.EmployeeCodeList[7])))); IList<Employee> employeeList = OrgHandler.FindEmployeeList(employeeSearcher); int allCount = 6; Assert.AreEqual(allCount, employeeList == null ? 0 : employeeList.Count); }
public void FindEmployeeBySQLNotInTest() { EmployeeSearcher empSearcher = new EmployeeSearcher(); // SQL应该写入Dal进行控制,这里用于测试 StringBuilder subQuery = new StringBuilder(); subQuery.Append("SELECT "); subQuery.Append(" DSub.DepartmentId "); subQuery.Append("FROM "); subQuery.Append(" Department DSub "); subQuery.Append("WHERE "); subQuery.Append(" DSub.CurrCompany.CompanyCode = '10401' "); empSearcher.CurrDepartment = new DepartmentSearcher(); empSearcher.CurrDepartment.DepartmentId.SQLNotIn(subQuery.ToString()); IList<Employee> employeeList = OrgHandler.FindEmployeeList(empSearcher); int allCount = 624; Assert.AreEqual(allCount, employeeList == null ? 0 : employeeList.Count); }
/// <summary> /// 查找指定ID的员工 /// </summary> /// <param name="employeeId">员工ID</param> /// <param name="tran">中间事务对象</param> /// <returns>返回员工实体对象</returns> public Employee FindSingle(string employeeId, ICTransaction tran) { EmployeeSearcher employeeSearcher = new EmployeeSearcher(); employeeSearcher.EmployeeId.Equal(employeeId); IList<Employee> employeeList = this.FindList(employeeSearcher); return (employeeList == null || employeeList.Count == 0) ? null : employeeList[0]; }
public void FindEmployeeBySQLNotInConditionStringTest() { EmployeeSearcher empSearcher = new EmployeeSearcher(); // SQL应该写入Dal进行控制,这里用于测试 StringBuilder subQuery = new StringBuilder(); subQuery.Append("SELECT "); subQuery.Append(" DSub.DepartmentId "); subQuery.Append("FROM "); subQuery.Append(" Department DSub "); subQuery.Append("LEFT JOIN "); subQuery.Append(" Company CSub ON(CSub.CompanyId=DSub.CompanyId) "); subQuery.Append("WHERE "); subQuery.Append(" CSub.CompanyCode = '10401' "); empSearcher.CurrDepartment = new DepartmentSearcher(); empSearcher.CurrDepartment.DepartmentId.ConditionString = "LOWER(" + SQLPlaceholder.ColName + ")"; empSearcher.CurrDepartment.DepartmentId.SQLNotIn(subQuery.ToString()); IList<Employee> employeeList = OrgHandler.FindEmployeeList(empSearcher); int allCount = 624; Assert.AreEqual(allCount, employeeList == null ? 0 : employeeList.Count); }
/// <summary> /// 查找指定条件的员工分页集合 /// </summary> /// <param name="employeeSearcher">员工查询对象</param> /// <param name="pager">分页对象</param> /// <param name="tran">中间事务对象</param> /// <returns>返回查找到的分页集合,包括按条件可查询到的所有记录数和当前分页的对象集合</returns> public PageList<Employee> FindList(EmployeeSearcher employeeSearcher, Pager pager, ICTransaction tran) { PageList<Employee> resultList = new PageList<Employee>(); PageDataTable pageDataTable = this.FindDataTable(employeeSearcher, pager, tran); Employee ele = null; if (pageDataTable != null) { resultList = new PageList<Employee>(); resultList.PageIndex = pageDataTable.PageIndex; resultList.TotalCount = pageDataTable.TotalCount; if (pageDataTable.RecordList != null && pageDataTable.RecordList.Rows.Count > 0) { foreach (DataRow aRow in pageDataTable.RecordList.Rows) { ele = new Employee(); if (!(aRow["EmployeeId"] is DBNull)) { ele.EmployeeId = aRow["EmployeeId"].ToString(); } if (!(aRow["CompanyId"] is DBNull)) { ele.CompanyId = aRow["CompanyId"].ToString(); } if (!(aRow["DepartmentId"] is DBNull)) { ele.DepartmentId = aRow["DepartmentId"].ToString(); } if (!(aRow["PositionId"] is DBNull)) { ele.PositionId = aRow["PositionId"].ToString(); } if (!(aRow["EmployeeCode"] is DBNull)) { ele.EmployeeCode = aRow["EmployeeCode"].ToString(); } if (!(aRow["CreaterId"] is DBNull)) { ele.CreaterId = aRow["CreaterId"].ToString(); } if (!(aRow["CreateTime"] is DBNull)) { ele.CreateTime = Convert.ToDateTime(aRow["CreateTime"]); } if (!(aRow["Name"] is DBNull)) { ele.Name = aRow["Name"].ToString(); } if (!(aRow["RVersion"] is DBNull)) { ele.RVersion = Convert.ToInt32(aRow["RVersion"]); } if (!(aRow["Status"] is DBNull)) { ele.Status = Convert.ToInt32(aRow["Status"]); } if (!(aRow["UpdateTime"] is DBNull)) { ele.UpdateTime = Convert.ToDateTime(aRow["UpdateTime"]); } if (!(aRow["UpdatorId"] is DBNull)) { ele.UpdatorId = aRow["UpdatorId"].ToString(); } if (!(aRow["Birthday"] is DBNull)) { ele.Birthday = Convert.ToDateTime(aRow["Birthday"]); } if (!(aRow["JoinDate"] is DBNull)) { ele.JoinDate = Convert.ToDateTime(aRow["JoinDate"]); } if (!(aRow["Rand"] is DBNull)) { ele.Rand = Convert.ToInt32(aRow["Rand"]); } if (!(aRow["Sex"] is DBNull)) { ele.Sex = Convert.ToInt32(aRow["Sex"]); } if (!(aRow["StartWorkDate"] is DBNull)) { ele.StartWorkDate = Convert.ToDateTime(aRow["StartWorkDate"]); } resultList.RecordList.Add(ele); } } } return resultList; }
/// <summary> /// 查找指定条件的员工分页集合 /// </summary> /// <param name="employeeSearcher">员工查询对象</param> /// <param name="pager">分页对象</param> /// <returns>返回查找到的分页集合,包括按条件可查询到的所有记录数和当前分页的对象集合</returns> public PageList<Employee> FindList(EmployeeSearcher employeeSearcher, Pager pager) { return this.FindList(employeeSearcher, pager, null); }
/// <summary> /// 查找指定条件的员工集合 /// </summary> /// <param name="employeeSearcher">员工查询对象</param> /// <param name="tran">中间事务对象</param> /// <returns>返回员工实体对象集合</returns> public IList<Employee> FindList(EmployeeSearcher employeeSearcher, ICTransaction tran) { PageList<Employee> pageList = this.FindList(employeeSearcher, null, tran); return pageList == null ? null : pageList.RecordList; }
public void FindEmployeeByLessThanTest() { EmployeeSearcher empSearcher = new EmployeeSearcher(); empSearcher.Rand.LessThan(15); IList<Employee> employeeList = OrgHandler.FindEmployeeList(empSearcher); int allCount = 750; Assert.AreEqual(allCount, employeeList == null ? 0 : employeeList.Count); }
public void FindEmployeeForPagerTest() { EmployeeSearcher empSearcher = new EmployeeSearcher(); empSearcher.CurrPosition = new PositionSearcher(); empSearcher.CurrPosition.PositionCode.Equal("3102010003"); Pager pager = new Pager(); pager.CurrentPage = 2; pager.PageSize = 15; PageList<Employee> employeeList = OrgHandler.FindEmployeeList(empSearcher, pager); int pageCount = 15; int allCount = 30; Assert.AreEqual(pageCount, employeeList.RecordList.Count); Assert.AreEqual(allCount, employeeList.TotalCount); }
public void FindEmployeeByLikeTest() { EmployeeSearcher empSearcher = new EmployeeSearcher(); empSearcher.Name.Like("Emp"); IList<Employee> employeeList = OrgHandler.FindEmployeeList(empSearcher); int allCount = 780; Assert.AreEqual(allCount, employeeList == null ? 0 : employeeList.Count); empSearcher = new EmployeeSearcher(); empSearcher.EmployeeCode.Like("510201"); employeeList = OrgHandler.FindEmployeeList(empSearcher); allCount = 156; Assert.AreEqual(allCount, employeeList == null ? 0 : employeeList.Count); }
public void AddDataTest() { #region Clear All Data OrgHandler.DeleteEmployee(new EmployeeSearcher()); OrgHandler.DeletePosition(new PositionSearcher()); OrgHandler.DeleteDepartment(new DepartmentSearcher()); OrgHandler.DeleteCompany(new CompanySearcher()); #endregion string companyName = " Com. Ltd."; Company company = null; Department department = null; Position position = null; Employee employee = null; int depCode = 1; int posCode = 1; int empCode = 1; int empCount = 30; Random rand = new Random(DateTime.Now.Hour); string[][] companyNamePool = new string[][] { new string[]{"ABC","10201"}, new string[]{"DEF","10301"}, new string[]{"GHI","10202"}, new string[]{"JKL","10203"}, new string[]{"MNO","10401"} }; string[] departmentNamePool = new string[]{ "GM", "Finance", "HR", "Sales", "Marketing", "Executive" }; string[] positionNamePool = new string[] { "GM", "Specialist" }; long allEmpCount = 780; foreach (string[] cName in companyNamePool) { company = new Company(); company.Name = cName[0] + companyName; company.CompanyCode = cName[1]; company.CreaterId = "00000000000"; company.UpdatorId = "00000000000"; company.RVersion = 1; company.Status = 1; OrgHandler.AddCompany(company); depCode = 1; empCode = 1; posCode = 1; foreach (string dName in departmentNamePool) { department = new Department(); department.CurrCompany = company; department.Name = dName; department.DepartmentCode = "2" + company.CompanyCode + string.Format("{0:0000}", depCode); department.CreaterId = "00000000000"; department.UpdatorId = "00000000000"; department.RVersion = 1; department.Status = 1; OrgHandler.AddDepartment(department); foreach (string pName in positionNamePool) { position = new Position(); position.CurrCompany = company; position.CurrDepartment = department; position.PositionCode = "3" + company.CompanyCode + string.Format("{0:0000}", posCode); position.CreaterId = "00000000000"; position.UpdatorId = "00000000000"; position.RVersion = 1; position.Status = 1; if (pName.Equals("GM")) { if (dName.Equals("GM")) { position.Name = pName; } else { position.Name = dName + " " + pName; } empCount = 1; } else { position.Name = dName + " " + pName; empCount = 30; } OrgHandler.AddPosition(position); for (int i = 1; i <= empCount; i++) { employee = new Employee(); employee.Name = "Emp" + Guid.NewGuid().ToString().ToLower().Replace("-", "").Substring(0, 5); employee.EmployeeCode = "5" + company.CompanyCode + string.Format("{0:000000}", empCode); employee.CurrCompany = company; employee.CurrDepartment = department; employee.CurrPosition = position; employee.CreaterId = "00000000000"; employee.UpdatorId = "00000000000"; employee.RVersion = 1; employee.Status = 1; employee.Birthday = Convert.ToDateTime("19" + rand.Next(70,90).ToString() + "-" + rand.Next(1, 9).ToString() + "-" + rand.Next(1, 28).ToString()); employee.Sex = rand.Next(1, 2); employee.StartWorkDate = Convert.ToDateTime(employee.Birthday).AddYears(20).AddMonths(rand.Next(1, 12)); employee.JoinDate = rand.Next(1, 10) > 6 ? employee.StartWorkDate : Convert.ToDateTime(employee.StartWorkDate).AddYears(rand.Next(1, 2)).AddMonths(rand.Next(1, 12)); if (dName.Equals("GM")) { employee.Rand = 20; } else if (pName.Equals("GM")) { employee.Rand = rand.Next(15, 19); } else { employee.Rand = rand.Next(5, 14); } OrgHandler.AddEmployee(employee); if(QueryTest.EmployeeIdList.Count < 10 && !dName.Equals("GM") && !pName.Equals("GM")) { QueryTest.EmployeeIdList.Add(employee.EmployeeId); QueryTest.EmployeeCodeList.Add(employee.EmployeeCode); } empCode++; } posCode++; if (dName.Equals("GM")) { break; } } depCode++; } } EmployeeSearcher empSearcher = new EmployeeSearcher(); long newDataCount = OrgHandler.CountEmployee(empSearcher); Assert.AreEqual(allEmpCount, newDataCount); }
public void FindEmployeeByMultipleSortTest() { EmployeeSearcher employeeSearcher = new EmployeeSearcher(); employeeSearcher.CurrCompany = new CompanySearcher(); employeeSearcher.CurrCompany.CompanyCode.SortOrder = SortOrder.Desc; employeeSearcher.CurrCompany.CompanyCode.SortIndex = 1; employeeSearcher.Rand.SortOrder = SortOrder.Desc; employeeSearcher.Rand.SortIndex = 2; IList<Employee> employeeList = OrgHandler.FindEmployeeList(employeeSearcher); Assert.IsTrue(employeeList[0].CurrCompany.CompanyCode.Equals(employeeList[1].CurrCompany.CompanyCode)); Assert.IsTrue(employeeList[0].Rand >= employeeList[1].Rand); }
public void DeleteDataByConditionTest() { EmployeeSearcher employeeSearcher = new EmployeeSearcher(); employeeSearcher.CurrCompany = new CompanySearcher(); employeeSearcher.CurrCompany.CompanyCode.Equal("10401"); OrgHandler.DeleteEmployee(employeeSearcher); long count = OrgHandler.CountEmployee(employeeSearcher); Assert.AreEqual(0, count); }
public void FindEmployeeByNotEqualTest() { EmployeeSearcher empSearcher = new EmployeeSearcher(); empSearcher.CurrPosition = new PositionSearcher(); empSearcher.CurrPosition.PositionCode.NotEqual("3102010003"); IList<Employee> employeeList = OrgHandler.FindEmployeeList(empSearcher); int allCount = 750; Assert.AreEqual(allCount, employeeList == null ? 0 : employeeList.Count); }
public void FindEmployeeByBetweenColumnTest() { EmployeeSearcher empSearcher = new EmployeeSearcher(); empSearcher.JoinDate.Between(empSearcher.StartWorkDate, empSearcher.CreateTime); IList<Employee> employeeList = OrgHandler.FindEmployeeList(empSearcher); bool isSucc = employeeList == null ? false : (employeeList.Count >= 1 && employeeList.Count <= 780 ? true : false); Assert.AreEqual(true, isSucc); }
public void FindEmployeeByNotInConditionStringTest() { EmployeeSearcher empSearcher = new EmployeeSearcher(); // 这句应该写入Dal进行控制,这里用于测试 empSearcher.EmployeeCode.ConditionString = "LOWER(" + SQLPlaceholder.ColName + ")"; empSearcher.EmployeeCode.NotIn(QueryTest.EmployeeCodeList.ToArray()); IList<Employee> employeeList = OrgHandler.FindEmployeeList(empSearcher); Assert.AreEqual(770, employeeList == null ? 0 : employeeList.Count); }
public void FindEmployeeByBetweenTest() { EmployeeSearcher empSearcher = new EmployeeSearcher(); empSearcher.Birthday.Between(Convert.ToDateTime("1995-10-01"), Convert.ToDateTime("1995-11-01")); IList<Employee> employeeList = OrgHandler.FindEmployeeList(empSearcher); int exCount = 1; Assert.AreEqual(exCount, employeeList == null ? 0 : employeeList.Count); }
public void FindEmployeeByNotLikeColumnTest() { EmployeeSearcher empSearcher = new EmployeeSearcher(); empSearcher.CurrCompany = new CompanySearcher(); empSearcher.EmployeeCode.NotLike(empSearcher.CurrCompany.CompanyCode); IList<Employee> employeeList = OrgHandler.FindEmployeeList(empSearcher); int allCount = 0; Assert.AreEqual(allCount, employeeList == null ? 0 : employeeList.Count); }
public void FindEmployeeByConditionsTest() { EmployeeSearcher empSearcher = new EmployeeSearcher(); empSearcher.CurrCompany = new CompanySearcher(); empSearcher.EmployeeCode.Equal(ConditionRelation.Or, QueryTest.EmployeeCodeList[0]); empSearcher.EmployeeCode.Equal(ConditionRelation.Or, QueryTest.EmployeeCodeList[1]); empSearcher.EmployeeCode.Equal(ConditionRelation.Or, QueryTest.EmployeeCodeList[2]); empSearcher.CurrCompany.CompanyCode.Equal(ConditionRelation.Or, "10203"); empSearcher.Rand.LargeEqual(14); IList<Employee> employeeList = OrgHandler.FindEmployeeList(empSearcher); int allCount = 158; Assert.AreEqual(allCount, employeeList == null ? 0 : employeeList.Count); }
public void FindEmployeeByNotLikeTest() { EmployeeSearcher empSearcher = new EmployeeSearcher(); empSearcher.Name.NotLike("Emp"); IList<Employee> employeeList = OrgHandler.FindEmployeeList(empSearcher); int allCount = 0; Assert.AreEqual(allCount, employeeList == null ? 0 : employeeList.Count); }
public void FindEmployeeByLargeThanConditionStringTest() { EmployeeSearcher empSearcher = new EmployeeSearcher(); // 这句应该写入Dal进行控制,这里用于测试 empSearcher.Birthday.ConditionString = "MONTH(" + SQLPlaceholder.ColName + ")"; empSearcher.Birthday.LargeThan(9); IList<Employee> employeeList = OrgHandler.FindEmployeeList(empSearcher); int allCount = 1; Assert.AreEqual(allCount, employeeList == null ? 0 : employeeList.Count); }
public void FindEmployeeBySQLEqualConditionStringTest() { EmployeeSearcher empSearcher = new EmployeeSearcher(); // SQL应该写入Dal进行控制,这里用于测试 StringBuilder subQuery = new StringBuilder(); subQuery.Append("SELECT "); subQuery.Append(" DSub.CurrCompany.CompanyCode "); subQuery.Append("FROM "); subQuery.Append(" Department DSub "); subQuery.Append("WHERE "); subQuery.Append(" DSub.DepartmentCode = '2104010005' "); empSearcher.CurrCompany = new CompanySearcher(); empSearcher.EmployeeCode.ConditionString = "SUBSTRING(" + SQLPlaceholder.ColName + ", 2, 5)"; empSearcher.EmployeeCode.SQLEqual(subQuery.ToString()); IList<Employee> employeeList = OrgHandler.FindEmployeeList(empSearcher); int allCount = 156; Assert.AreEqual(allCount, employeeList == null ? 0 : employeeList.Count); }
/// <summary> /// 根据指定条件查找员工分页集合 /// </summary> /// <param name="employeeSearcher">员工查询对象</param> /// <param name="pager">分页对象</param> /// <param name="tran">中间事务对象</param> /// <returns>返回查找到的分页集合,包括按条件可查询到的所有记录数和当前分页的DataTable数据</returns> public PageDataTable FindDataTable(EmployeeSearcher employeeSearcher, Pager pager, ICTransaction tran) { EmployeeSearcher querySearcher = null; MysqlQueryParser queryParser = new MysqlQueryParser(); PageDataTable pDataTable = new PageDataTable(); DataSet resultSet = null; StringBuilder query = new StringBuilder(); StringBuilder joinQuery = new StringBuilder(); StringBuilder conditionQuery = new StringBuilder(); StringBuilder sortQuery = new StringBuilder(); if (employeeSearcher != null) { querySearcher = (EmployeeSearcher)employeeSearcher.Clone(); querySearcher.TableName = "E"; if (querySearcher.CurrCompany != null) { querySearcher.CurrCompany.TableName = "C"; joinQuery.AppendLine(@"LEFT JOIN "); joinQuery.AppendLine(@" `Company` C ON(C.CompanyId = E.CompanyId) "); } if (querySearcher.CurrDepartment != null) { querySearcher.CurrDepartment.TableName = "D"; joinQuery.AppendLine(@"LEFT JOIN "); joinQuery.AppendLine(@" `Department` D ON(D.DepartmentId = E.DepartmentId) "); } if (querySearcher.CurrPosition != null) { querySearcher.CurrPosition.TableName = "P"; joinQuery.AppendLine(@"LEFT JOIN "); joinQuery.AppendLine(@" `Position` P ON(P.PositionId = E.PositionId) "); } } queryParser.SearcherParse(querySearcher); if (!string.IsNullOrEmpty(queryParser.ConditionString)) { conditionQuery.AppendLine(@"WHERE "); conditionQuery.AppendLine(@" " + queryParser.ConditionString); } if (!string.IsNullOrEmpty(queryParser.SortString)) { sortQuery.AppendLine(@"ORDER BY "); sortQuery.AppendLine(@" " + queryParser.SortString); } query.AppendLine(@"SELECT "); query.AppendLine(@" E.`EmployeeId` "); query.AppendLine(@" ,E.`EmployeeCode` "); query.AppendLine(@" ,E.`Name` "); query.AppendLine(@" ,E.`Birthday` "); query.AppendLine(@" ,E.`Sex` "); query.AppendLine(@" ,E.`CompanyId` "); query.AppendLine(@" ,E.`DepartmentId` "); query.AppendLine(@" ,E.`PositionId` "); query.AppendLine(@" ,E.`Rand` "); query.AppendLine(@" ,E.`RVersion` "); query.AppendLine(@" ,E.`Status` "); query.AppendLine(@" ,E.`CreaterId` "); query.AppendLine(@" ,E.`CreateTime` "); query.AppendLine(@" ,E.`UpdatorId` "); query.AppendLine(@" ,E.`UpdateTime` "); query.AppendLine(@" ,E.`StartWorkDate` "); query.AppendLine(@" ,E.`JoinDate` "); query.AppendLine(@"FROM "); query.AppendLine(@" `Employee` E "); query.AppendLine(joinQuery.ToString()); query.AppendLine(conditionQuery.ToString()); query.AppendLine(sortQuery.ToString()); if (pager != null && pager.PageSize != 0 && pager.StartRecord >= 0) { query.AppendLine(@" LIMIT " + pager.StartRecord.ToString() + "," + pager.PageSize + " "); } query.AppendLine(@"; "); if (tran != null) { resultSet = MySqlHelper.ExecuteDataset((MySqlConnection)tran.Connection, query.ToString(), queryParser.ParamCollection.ToArray()); } else { resultSet = MySqlHelper.ExecuteDataset(this.CurrentConnectionString, query.ToString(), queryParser.ParamCollection.ToArray()); } if (resultSet != null) { if (pager != null) { pDataTable.PageIndex = pager.CurrentPage; } pDataTable.TotalCount = this.Count(employeeSearcher, tran); pDataTable.RecordList = resultSet.Tables[0]; } return pDataTable; }