src/common/pager/PagerController.java

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

package common.pager;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import com.fhd.bean.AccountBean;
import com.fhd.bean.ItemsBean;
import com.fhd.bean.UserBean;
import com.fhd.conn.DBConnection;

public class PagerController {
	public Pager getPageController(String tableName, String currentPage,String pagerMethod) {
		int totalRows = 0;
		Pager pager = null;
		Connection conn = null;
		conn = DBConnection.getConnection();
		String sqls = "";
		String tableId = "";
		if (tableName.equals("User")) {
			sqls = "select count(*) as allCount from [User]";
			tableId = "userId";
		} else if (tableName.equals("Items")) {
			sqls = "select count(*) as allCount from Items";
			tableId = "itemsId";
		} else if (tableName.equals("Account")) {
			sqls = "select count(*) as allCount from Account";
			tableId = "accountId";
		} else if (tableName.equals("AccountSearch")) {
			sqls = "select count(*) as allCount from Account";
			tableId = "accountId";
		}
		try {
			PreparedStatement pstmt = conn.prepareStatement(sqls);
			ResultSet rs = pstmt.executeQuery();
			if (rs.next()) {
				totalRows = rs.getInt("allCount");
			}
			rs.close();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		pager = new Pager(totalRows);

		if (currentPage != null) {
			pager.refresh(Integer.parseInt(currentPage));
		}
		if (pagerMethod != null) {
			if (pagerMethod.equals("first")) {
				pager.first();
			} else if (pagerMethod.equals("previous")) {
				pager.previous();
			} else if (pagerMethod.equals("next")) {
				pager.next();
			} else if (pagerMethod.equals("last")) {
				pager.last();
后面还有 59 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。