use of com.akaxin.site.storage.bean.PluginBean in project openzaly by akaxincom.
the class SQLitePluginDao method queryPluginList.
/**
* 按照位置,分页查询
*
* @param pageNum
* @param pageSize
* @param position
* @return
* @throws SQLException
*/
public List<PluginBean> queryPluginList(int pageNum, int pageSize, int position) throws SQLException {
long startTime = System.currentTimeMillis();
List<PluginBean> pluginList = new ArrayList<PluginBean>();
String sql = //
"SELECT id," + //
"name," + //
"icon," + //
"url_page," + //
"api_url," + //
"sort," + //
"position," + //
"permission_status" + " FROM " + PLUGIN_TABLE + //
" WHERE " + "position=? ORDER BY sort LIMIT ?,?;";
int startNum = (pageNum - 1) * pageSize;
PreparedStatement preStatement = SQLiteJDBCManager.getConnection().prepareStatement(sql);
preStatement.setInt(1, position);
preStatement.setInt(2, startNum);
preStatement.setInt(3, pageSize);
ResultSet rs = preStatement.executeQuery();
while (rs.next()) {
PluginBean bean = new PluginBean();
bean.setId(rs.getInt(1));
bean.setName(rs.getString(2));
bean.setIcon(rs.getString(3));
bean.setUrlPage(rs.getString(4));
bean.setApiUrl(rs.getString(5));
bean.setSort(rs.getInt(6));
bean.setPosition(rs.getInt(7));
bean.setPermissionStatus(rs.getInt(8));
pluginList.add(bean);
}
LogUtils.dbDebugLog(logger, startTime, pluginList.size(), sql, position, startNum, pageSize);
return pluginList;
}
Aggregations