public DataTable getDataTable(PaginationObj paginationObj, int schoolId, SearchCondition condition) { string sql = "select pr.id,pr.student_id,old_table.name,old_table.grade,old_table.sex, " + @" pr.red,pr.blue,pr.green,pr.yellow,rc.cn_name,pr.update_at,pr.print_count " + @" from pts_result pr " + @" inner join inside_student old_table on pr.student_id = old_table.id " + @" inner join result_const rc on pr.color = rc.color " + @" where old_table.school = " + schoolId + SearchCondictionStr.getString(condition); return BaseDao.getTableInfo(sql); }
public static string buildPaginationString(string tableName, PaginationObj paginationObj, int schoolId, SearchCondition condition) { return "select * from " + " (select old_table.*, ROW_NUMBER() over(order by update_at) as row_num from " + tableName + " old_table " + " where old_table.school=" + schoolId + SearchCondictionStr.getString(condition) + " ) new_table " + " where new_table.row_num between " + ((paginationObj.PageNum - 1) * paginationObj.NumPerPage + 1) + " and " + paginationObj.PageNum * paginationObj.NumPerPage; }
public DataTable getDataTable(PaginationObj paginationObj, int schoolId, SearchCondition condition) { string sql = Pagination.buildPaginationString("inside_student", paginationObj, schoolId, condition); return BaseDao.getTableInfo(sql); }