spring+springMVC+MyBatis 分页功能代码封装

2023-11-16

页面效果图展示:


分页工具类:Pagination

package com.wlsq.kso.util;

import java.io.Serializable;  
import java.util.ArrayList;  
import java.util.List;  
  
/** 
 * 储存分页处理工具类 在调用此类的方法之前需设置总页数(即得先从数据库查询到相应数据的数据量) 
 *  
 * @author ahomeeye 
 * @version 1.0 
 */  
public class Pagination implements Serializable {  
  
    private static final long serialVersionUID = 1L;  
    private int start; // start表示当前页开始的记录数,start=每页行数*(当前页数-1)  
    private int end; // 当前页结束的记录行数  
    private int totalCount; // 总行数  
    private int rowsPerPage = 1; // 每页行数,默认10  
    private int currentPage; // 当前页数  
    private int pageListSize = 6;// 页码列表大小,默认9  
    private List<Integer> pageNumList = new ArrayList<Integer>();  
  
    public Pagination() {  
        start = 0;  
        end = 0;  
        currentPage = 1;  
        this.totalCount = 0;  
    }  
  
    public Pagination(int totalCount) {  
        start = 0;  
        end = 0;  
        currentPage = 1;  
        this.totalCount = totalCount;  
    }  
  
    public Pagination(int totalCount, int numPerPage) {  
        start = 0;  
        end = 0;  
        this.totalCount = totalCount;  
        currentPage = 1;  
        if (numPerPage > 0) {  
            rowsPerPage = numPerPage;  
        }  
    }  
  
    /** 
     * 执行翻页动作 
     *  
     * @param currentPage 
     *            要翻到的目标页码 
     * @return 返回翻页对象 
     */  
    public Pagination doPagination(int currentPage) {  
        gotoPage(currentPage);  
        return this;  
    }  
  
    // 设置起始数  
    public int getStart() {  
        start = rowsPerPage * (currentPage - 1);  
        return start;  
    }  
  
    // 得到起始数  
    public void setStart(int start) {  
        if (start < 0) {  
            this.start = 0;  
        } else if (start >= this.totalCount) {  
            this.start = this.totalCount - 1;  
        } else {  
            this.start = start;  
        }  
    }  
  
    // 设置当前页的最后一行的在总记录中的顺序(从0开始)  
    public void setEnd(int end) {  
        this.end = end;  
    }  
  
    // 得到当前页的最后一行的在总记录中的顺序(从0开始)  
    public int getEnd() {  
        if (rowsPerPage * currentPage > this.totalCount) {  
            end = this.totalCount - 1;  
        } else {  
            end = rowsPerPage * currentPage - 1;  
        }  
        return end;  
    }  
  
    // 以下4个方法供控制器(struts)调用  
  
    // 判断能否到第一页;只要能到上一页,肯定就有第一页  
    public boolean firstEnable() {  
        return previousEnable();  
    }  
  
    // 判断能否到上一页  
    public boolean previousEnable() {  
        return currentPage > 1;// 只要不是第一页,就能到上一页  
    }  
  
    // 判断能否到下一页  
    public boolean nextEnable() {  
        return currentPage * rowsPerPage < this.totalCount;  
    }  
  
    // 判断能否到最后一页;只要有下一页,就肯定有最后一页.  
    public boolean lastEnable() {  
        return nextEnable();  
    }  
  
    // 跳到第一页  
    public void firstPage() {  
        currentPage = 1;  
    }  
  
    // 跳到上一页  
    public void previousPage(int cPage) {  
        currentPage = (cPage - 1) > 0 ? (cPage - 1) : 1;  
    }  
  
    // 跳到下一页  
    public void nextPage(int cPage) {  
        currentPage = cPage + 1;  
        if (currentPage * rowsPerPage > this.totalCount) {  
            lastPage();  
        }  
    }  
  
    // 跳到最后一页  
    public void lastPage() {  
        if (this.totalCount % rowsPerPage == 0) {  
            currentPage = this.totalCount / rowsPerPage;  
        } else {  
            currentPage = this.totalCount / rowsPerPage + 1;  
        }  
    }  
  
    // 跳到指定的某一页  
    public void gotoPage(int pageNumber) {  
        if (pageNumber <= 1) {  
            currentPage = 1;  
        } else if (getTotalCount() < this.getRowsPerPage()) {  
            currentPage = 1;  
        } else if (pageNumber * rowsPerPage >= this.totalCount) {  
            lastPage();  
        } else {  
            currentPage = pageNumber;  
        }  
    }  
  
    // 设置总行数  
    public void setTotalCount(int totalCount) {  
        this.totalCount = totalCount;  
    }  
  
    // 得到总行数  
    public int getTotalCount() {  
        return totalCount;  
    }  
  
    // 设置每页行数  
    public void setRowsPerPage(int rowsPerPage) {  
        this.rowsPerPage = rowsPerPage;  
    }  
  
    // 得到每页行数  
    public int getRowsPerPage() {  
        return rowsPerPage;  
    }  
  
    // 得到总页数  
    public int getPages() {  
        if (this.totalCount % rowsPerPage == 0)  
            return this.totalCount / rowsPerPage;  
        else  
            return this.totalCount / rowsPerPage + 1;  
    }  
  
    // 得到当前页数  
    public int getCurrentPage() {  
        return currentPage;  
    }  
  
    // 设置当前页数  
    public void setCurrentPage(int currentPage) {  
        this.currentPage = currentPage;  
    }  
  
    public int getPageListSize() {  
        return pageListSize;  
    }  
  
    // 设置页码列表大小  
    public void setPageListSize(int pageListSize) {  
        this.pageListSize = pageListSize;  
    }  
  
    // 得到页面列表  
    public List<Integer> getPageNumList() {  
        this.pageNumList.removeAll(this.pageNumList);// 设置之前先清空  
        int totalPage = getPages();  
        if (totalPage > this.pageListSize) {  
            int halfSize = this.pageListSize / 2;  
            int first = 1;  
            int end = 1;  
            if (this.currentPage - halfSize < 1) { // 当前页靠近最小数1  
                first = 1;  
                end = this.pageListSize;  
            } else if (totalPage - this.currentPage < halfSize) { // 当前页靠近最大数  
                first = totalPage - this.pageListSize + 1;  
                end = totalPage;  
            } else {  
                first = this.currentPage - halfSize;  
                end = this.currentPage + halfSize;  
            }  
            for (int i = first; i <= end; i++) {  
                this.pageNumList.add(i);  
            }  
        } else {  
            for (int i = 0; i < totalPage; i++) {  
                this.pageNumList.add(i + 1);  
            }  
        }  
  
        return pageNumList;  
    } 
}

分页样式和js文件(page.css/page.js)

page.js

$(function(){
	$(document).on("click",".page_num,.next_page,.prev_page,.first_page,.last_page",function(){
		var $self = $(this);
		if($self.parent().attr("class") == 'disabled'){
			return false;
		}
		$("#page_current").val($self.attr("data-pnum"));
		$("#page_form").submit();
	});
});

page.css

.pages{ width:100.5%; text-align:right; padding:10px 0; clear:both;}
.pages a,.pages b{ font-size:12px; font-family:Arial, Helvetica, 
sans-serif; margin:0 2px;}
.pages a,.pages b{ border:1px solid #5FA623; background:#fff; padding:2px 
6px; text-decoration:none}
.pages b,.pages a:hover{ background:#7AB63F; color:#fff;}


后台页面逻辑代码和数据库查询配置文件:

controller 文件

/*开发者查询列表*/
	@RequestMapping(value="/select.action" )	
	public  ModelAndView  Select(HttpServletRequest request){
		 ModelAndView modelAndView = new ModelAndView();
		 int pageSize = Integer
					.parseInt(request.getParameter("pageSize") == null ? "1"
							: request.getParameter("pageSize"));
		 int pageNum = Integer
 					.parseInt(request.getParameter("pageNum") == null ? "1"
							: request.getParameter("pageNum"));
			Map<String, Object> maps = new HashMap<String, Object>();
			maps.put("pageSize", pageSize);
			maps.put("pageNum", (pageNum-1) * pageSize);
			
	    Developer developer = new  Developer();
		List<Developer> develpers = developerService.selectByDeveloper(maps);
		int count = developerService.selectCountDevelopers();
		Pagination page = new Pagination(count);
		page.setCurrentPage(pageNum);
		modelAndView.addObject("pnums", page.getPageNumList());
		modelAndView.addObject("currentPage", pageNum);
		modelAndView.addObject("pnext_flag", page.nextEnable());
		modelAndView.addObject("plast_flag", page.lastEnable());
		page.lastPage();
		modelAndView.addObject("last_page", page.getCurrentPage());
		modelAndView.addObject("count", count);
		modelAndView.addObject("pageCount", page.getPages());
		if(develpers != null){
			modelAndView.setViewName("backstage/home");
			modelAndView.addObject("developers", develpers);
		}
		return modelAndView;
	}

mybatis配置文件(service 文件名与mybatis 配置文件名一致,这是我们公司老大提供的)

  <select id="selectByDeveloper" resultMap="extendResultMap">
       select 
           *
       from developer d,company_type c,s_province s,s_city city,s_district t
       where 1=1 and d.company_type_id = c.company_type_id and s.pid=d.pid and city.cid=d.cid and t.did=d.did
       limit #{maps.pageNum},#{maps.pageSize}
  </select>

项目页面源码:

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>统一认证平台管理后台</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">

<link rel="stylesheet" type="text/css"
	href="<%=basePath%>static/lib/bootstrap/css/bootstrap.css">
<link rel="stylesheet" type="text/css"
	href="<%=basePath%>static/lib/bootstrap/css/page.css">
<link rel="stylesheet" type="text/css"
	href="<%=basePath%>static/stylesheets/theme.css">
<link rel="stylesheet"
	href="<%=basePath%>static/lib/font-awesome/css/font-awesome.css">

<script src="<%=basePath%>static/lib/jquery-1.7.2.min.js"
	type="text/javascript"></script>
<script src="<%=basePath%>static/lib/page.js" type="text/javascript"></script>
<!-- Demo page code -->

<style type="text/css">
#line-chart {
	height: 300px;
	width: 800px;
	margin: 0px auto;
	margin-top: 1em;
}

.brand {
	font-family: georgia, serif;
}

.brand .first {
	color: #ccc;
	font-style: italic;
}

.brand .second {
	color: #fff;
	font-weight: bold;
}

</style>
<style>
.pages{ width:100.5%; text-align:right; padding:10px 0; clear:both;}
.pages a,.pages b{ font-size:12px; font-family:Arial, Helvetica, 
sans-serif; margin:0 2px;}
.pages a,.pages b{ border:1px solid #5FA623; background:#fff; padding:2px 
6px; text-decoration:none}
.pages b,.pages a:hover{ background:#7AB63F; color:#fff;}
</style>

<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
      <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->

<!-- Le fav and touch icons -->
<link rel="shortcut icon" href="../assets/ico/favicon.ico">
<link rel="apple-touch-icon-precomposed" sizes="144x144"
	href="../assets/ico/apple-touch-icon-144-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="114x114"
	href="../assets/ico/apple-touch-icon-114-precomposed.png">
<link rel="apple-touch-icon-precomposed" sizes="72x72"
	href="../assets/ico/apple-touch-icon-72-precomposed.png">
<link rel="apple-touch-icon-precomposed"
	href="../assets/ico/apple-touch-icon-57-precomposed.png">
</head>

<!--[if lt IE 7 ]> <body class="ie ie6"> <![endif]-->
<!--[if IE 7 ]> <body class="ie ie7 "> <![endif]-->
<!--[if IE 8 ]> <body class="ie ie8 "> <![endif]-->
<!--[if IE 9 ]> <body class="ie ie9 "> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!-->
<body class="">
	<jsp:include page="top.jsp" />
	<jsp:include page="menu.jsp" />





	<!--内容  -->
	<div class="content">
		<!--内容标题  -->
		<div class="header">
			<!--<div class="stats">
    <p class="stat"><span class="number">53</span>tickets</p>
    <p class="stat"><span class="number">27</span>tasks</p>
    <p class="stat"><span class="number">15</span>waiting</p>
</div>-->
			<!--当前功能模块  -->
			<h1 class="page-title">开发者管理</h1>
		</div>

		<ul class="breadcrumb">
			<li><a href="index.html">统一认证平台管理后台</a> <span class="divider">/</span>
			</li>
			<li class="active">开发者管理</li>
		</ul>

		<div class="container-fluid">
			<div class="row-fluid">

				<!--菜单项一  -->
				<div class="row-fluid">

					<div class="alert alert-info">
						<!--  <button type="button" class="close" data-dismiss="alert">×</button> -->
						<strong>新手指南:</strong> 新手指南手册点击此处!
					</div>

					<div class="block">
						<a href="#page-stats" class="block-heading" data-toggle="collapse">近期开发者数据统计</a>
						<div id="page-stats" class="block-body collapse in">

							<div class="stat-widget-container">
								<div class="stat-widget">
									<div class="stat-button">
										<p class="title">2,500</p>
										<p class="detail">开发者总数</p>
									</div>
								</div>

								<div class="stat-widget">
									<div class="stat-button">
										<p class="title">500</p>
										<p class="detail">新增开发者</p>
									</div>
								</div>

								<div class="stat-widget">
									<div class="stat-button">
										<p class="title">243</p>
										<p class="detail">活跃开发者</p>
									</div>
								</div>

								<div class="stat-widget">
									<div class="stat-button">
										<p class="title">100</p>
										<p class="detail">新增企业数</p>
									</div>
								</div>

							</div>
						</div>
					</div>
				</div>

				<!--菜单项二  -->
				<div class="row-fluid">
					<div class="block span12">
						<a href="#tablewidget" class="block-heading"
							data-toggle="collapse">开发者<span class="label label-warning">+10</span>
						</a>
						<div id="tablewidget" class="block-body collapse in">
							<table class="table">
								<thead>
									<tr>
										<th>开发者编号</th>
										<th>账户</th>
										<th>唯一编号</th>
										<th>真实姓名</th>
										<th>性别</th>
										<th>QQ</th>
										<th>联系电话</th>
										<th>邮箱</th>
										<th>用户类型</th>
										<th>公司名称</th>
										<th>公司类型</th>
										<th>操作</th>
									</tr>
								</thead>
								<tbody>
									<c:forEach var="developer" items="${developers}">
										<tr>
											<td><c:out value="${developer.acctId}" />
											</td>
											<td><c:out value="${developer.username}" />
											</td>
											<td><c:out value="${developer.openId}" />
											</td>
											<td><c:out value="${developer.acctRealNm}" />
											</td>
											<td><c:choose>
													<c:when test="${developer.acctSex == 0}">
														<c:out value="男" />
													</c:when>
													<c:otherwise>
														<c:out value="女" />
													</c:otherwise>
												</c:choose></td>
											<td><c:out value="${developer.acctQq}" />
											</td>
											<td><c:out value="${developer.acctPhone}" />
											</td>
											<td><c:out value="${developer.acctEmail}" />
											</td>
											<td><c:out value="${developer.userType}" />
											</td>
											<td><c:out value="${developer.companyName}" />
											</td>
											<td><c:out
													value="${developer.companyType.companyTypeName}" />
											</td>
											<td><a name="toUpdate" ids="${developer.openId }"
												href="javascript:;"><input type="submit" value="修改"
													class="button" /> </a> <a name="toDisable"
												ids="${developer.openId }" href="javascript:;"><input
													type="submit" value="禁用" class="button" /> </a> <a
												name="toCount" ids="${developer.openId }"
												href="javascript:;"><input type="submit" value="统计"
													class="button" /> </a></td>
										</tr>
									</c:forEach>
								</tbody>
							</table>
							
							 <form action="${pageContext.request.contextPath }/developer/select.action" method="get" id="page_form">
									<input type="hidden" id="page_current" name="pageNum" value="${currentPage }">
							 </form> 
							
							<div class="pages">
								<span style="font-size: 12px;color: #666;">共<font
									style="color: #09c;font-size: 20px;">${count }</font>条数据,<font
									style="color: #09c;font-size: 20px;">${pageCount }</font>页</span>
								<c:if test="${currentPage != 1 }">
										<b href="javascript:void(0)" class="first_page" data-pnum="1">首页<span class="sr-only"></span></b										
										<a aria-label="Previous" href="javascript:void(0)" class="prev_page" data-pnum="${currentPage -1 }"><span aria-hidden="true">«</span></a>
										
									</c:if>
									<c:if test="${currentPage == 1 }">
										<b href="javascript:void(0)" class="first_page" >首页<span class="sr-only"></span></b>									
										<a aria-label="Previous" href="javascript:void(0)"><span aria-hidden="true">«</span></a>
										
									</c:if>
									<c:forEach items="${pnums }" var="pa">
										<c:if test="${pa == currentPage }">
											<b href="javascript:void(0)"
												class="page_num" data-pnum="${pa }">${pa }<span
													class="sr-only"></span>
											</b>
											
										</c:if>
										<c:if test="${pa != currentPage }">
											<a href="javascript:void(0)" class="page_num"
												data-pnum="${pa }">${pa }<span class="sr-only"></span>
											</a>
											
										</c:if>

									</c:forEach>
									
									<c:if test="${pnext_flag }">
										<a href="javascript:void(0)" aria-label="Next"
											class="next_page" data-pnum="${currentPage + 1 }"><span
												aria-hidden="true">»</span>
										</a>
										
									</c:if>
									<c:if test="${!pnext_flag }">
										<a href="javascript:void(0)"
											aria-label="Next"><span aria-hidden="true">»</span>
										</a>
										
									</c:if>

									<c:if test="${plast_flag }">
										<a href="javascript:void(0)" class="last_page"
											data-pnum="${last_page }">尾页<span class="sr-only"></span>
										</a>
										
									</c:if>
									<c:if test="${!plast_flag }">
										<a href="javascript:void(0)" data-pnum="${last_page }"
											class="last_page">尾页<span class="sr-only"></span>
										</a>										
									</c:if>						
								
							
							</div>
							

						

						</div>
					</div>
				</div>



				<!--底部菜单栏  -->
				<footer>
				<hr>

				<!-- Purchase a site license to remove this link from the footer: http://www.portnine.com/bootstrap-themes -->
				<p class="pull-right">
					<a href="#" target="_blank">粤ICP备08106584号</a>
				</p>

				<p>
					&copy; 2015-2016 <a href="#" target="_blank">深圳未来社区有限公司</a>
				</p>
				</footer>

			</div>
		</div>
	</div>



	<script type="text/javascript"
		src="<%=basePath%>static/lib/bootstrap/js/bootstrap.js"></script>
	<script type="text/javascript">
		/*     $("[rel=tooltip]").tooltip();
		    $(function() {
		        $('.demo-cancel-click').click(function(){return false;});
		    }); */

		$(function() {
			//用户禁用操作
			$("[name='toDisable']").click(function() {

				if (confirm("确定要禁用该用户吗?")) {

					var id = $(this).attr("ids");
					//动态用户禁用					
					$.ajax({
						url : "developer/update.action",
						data : "open_id=" + id + "&open_type=update",
						dataType : "json",
						type : "POST",
						async : true,
						success : function(data) {
							var ajaxobj = eval(data);
							if (ajaxobj.error_code == "108") {
								//刷新当前页面
								window.location.reload();
							} else {
								alert("用户数据禁用失败!")
							}
						},
						error : function() {
							alert("用户数据禁用失败!")
						}
					});

				}
			});
			//用户统计
			$("[name='toCount']")
					.click(
							function() {
								var id = $(this).attr("ids");
								window.location.href = "/admin_back/toAddAgentBank.action?id="
										+ id;
							});

			//更新操作
			$("[name='toUpdate']")
					.click(
							function() {
								var id = $(this).attr("ids");
								window.location.href = "developer/develop_update.action?openId="
										+ id;
							});

		})
	</script>

</body>
</html>





本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

spring+springMVC+MyBatis 分页功能代码封装 的相关文章

  • ply格式文件导出

    ply格式导出代码片段 注意vertex 和tri都是 N 3 格式 三角形编号从1开始 def dump to ply vertex tri wfp index in tri should begin from 1 vertex in s
  • 【Vue】Vue基础自用笔记&Day04_①Vue组件②Vue插槽

    Vue基础 Day04 1 Vue组件 component 定义全局组件 定义私有组件 组件中数据和方法的调用 组件动画 父组件传值子组件 子组件传值父组件 2 Vue插槽 slot 如果出现具名插槽没有效果 但是也没有报错 极有可能是Vu
  • C语言——IIC协议概述+PCF8591

    IIC协议 SCL必须由主机发送 在SCL 1 高电平 时 SDA下跳则 判罚 为 起始信号 SDA上跳则 判罚 为 停止信号P 每个字节后应该由对方回送一个应答信号ACK做为对方在线的标志 非应答信号一般在所有字节的最后一个字节后 一般要
  • 【RabbitMQ教程】springboot整合rabbitmq(topic模式)

    下面还是模拟注册服务当用户注册成功后 向短信和邮件服务推送消息的场景 搭建SpringBoot环境 创建两个工程 mq rabbitmq producer和mq rabbitmq consumer 分别配置1 2 3 第三步本例消费者用注解
  • 如何利用FPGA生成SPWM调制信号

    如何利用FPGA生成SPWM调制信号 实验目标 稍微说一下原理 SPWM即正弦波宽度脉冲调制 冲量等效原理 双极性的的SPWM信号 具体步骤 1 用matlab生成三角波和正弦波的coe文件 2 调用ROM的ip读取coe文件 3 调用pl

随机推荐

  • IDEA使用小技巧

    一 添加javadoc注释 在方法声明前面输入 再按回车 就会自动生成 二 自动生成setter和getter方法 首先创建出你的实体类 或者准备好你要生成getter和setter方法的属性 然后再空白处点击右键 会出现这个界面 然后点G
  • 克鲁斯卡尔算法小结(使用查并集)

    克鲁斯卡尔算法 最小生成树 1 基本思想 先构造一个只含 n 个顶点 而边集为空的子图 把子图中各个顶点看成各棵树上的根结点 之后 从网的边集 E 中选取一条权值最小的边 若该条边的两个顶点分属不同的树 则将其加入子图 即把两棵树合成一棵树
  • Python脚本的简单编写(if语句,逻辑运算符,for循环,游戏的编写)

    1 利用python求平均成绩 gt gt gt gt gt gt gt gt 题目要求 输入学生姓名 依次输入学生的三门科目成绩 计算该学生的平均成绩 并打印 平均成绩保留一位小数 计算该学生语文成绩占总成绩的百分比 并打印 gt gt
  • 解决CHM文件打开无法显示网页的问题

    解决CHM文件打开无法显示网页的问题 chm的设计者的初衷是用来做帮助文档 其本质是一堆html网页文件的组合 后来有了专门的编 译器 反编译器 人们发现chm这东西具有的html的特性 使其用来做电子书实在是又好又方便 连html里面的脚
  • 使用config-overrides.js修改react项目的大包路径的正确方式

    create react app创建之后 默认的打包路径为build文件夹 如果想要更改 不使用yarn eject暴露配置项的琴况下 可以使用config overrides js修改打包的路径 代码如下 const path requi
  • C/C++配置使用windows msys2中的gcc/g++编译器

    介绍 比较常见的 可以在Windows上安装各种工具链来编译C和C 应用程序 如果是专门为Windows开发的 那是推荐Microsoft 免费提供的Visual Studio Community 出色的IDE工具 对于那些需要或喜欢跨平台
  • LeetCode 45 跳跃游戏 II(Java)

    题目 给你一个非负整数数组 nums 你最初位于数组的第一个位置 数组中的每个元素代表你在该位置可以跳跃的最大长度 你的目标是使用最少的跳跃次数到达数组的最后一个位置 假设你总是可以到达数组的最后一个位置 示例1 输入 nums 2 3 1
  • 前端 华为OBS 上传图片和查看图片

    前提是OBS 使用的是SDK BrowserJS 下载SDK BrowserJS 1 前提 npm config set registry https registry npmjs org 2 esdk obs browserjs 3 20
  • 【转】Visual Studio 2010下配置PC-Lint 9.0i

    转自 http blog csdn net jbcjay article details 7389543 首先下载PC Lint安装包 可以到CSDN资源区搜索下载 或者直接到我上传的资源区下载 一 安装过程 下载完安装包后可以直接点击pc
  • 仅需四步,整合SpringSecurity+JWT实现登录认证 !

    学习过我的mall项目的应该知道 mall admin模块是使用SpringSecurity JWT来实现登录认证的 而mall portal模块是使用的SpringSecurity基于Session的默认机制来实现登陆认证的 很多小伙伴都
  • Redis( stringRedisTemplate)添加缓存数据

    在redis中添加缓存数据大致思路 1 从redis中获取数据 如果存在 直接返回客户端 2 不存在 查询数据库 并写入redis缓存 3 如果从数据库查询为空 返回错误信息 4 写入redis缓存并返回数据 通过String类型添加商品数
  • Java如何用JDBC操作数据库(新手入门级)

    引入相关依赖包 想要用JDBC操作数据库 我们就必须要下载JDBC相关的依赖 这些依赖其实就是我们用来操作数据库的代码 那么什么是JDBC呢 JDBC就是 Java DataBase Connectivity 的简称 是数据库连接的意思 J
  • MapXtreme 2005 for .Net系列------MapControl初尝

    这一段时间在闲暇时看看mapXtreme 2005 for net 自己觉得与AE庞大复杂的结构相比 mapXtreme 可谓简单点 由于规模比较小 所以理解起来比较简单 本来先发一篇综述的帖子 不过由于条件的限制 自己现将这篇帖子发出来
  • 独家

    翻译 张媛 校对 卢苗苗 本文共8269字 建议阅读10分钟 用代码将你的数据集进行多维可视化 介绍 描述性分析是与数据科学或特定研究相关的任何分析生命周期中的核心组成部分之一 数据聚合 汇总与可视化是支撑数据分析这一领域的主要支柱
  • 通过css设置filter 属性,使整个页面呈现灰度效果,让整个网页变灰

    通过css设置filter 属性设置页面整体置灰 效果图 通过设置 filter 属性为 grayscale 100 页面中的所有元素都会被应用灰色滤镜效果 使整个页面呈现灰度效果 filter 属性是用来给元素添加不同的滤镜 graysc
  • Qt自定义界面类并提升(提升的窗口部件),把OpenGL绘制的图形显示在QT的ui界面上

    编译环境 Qt Creator 5 4 0 mingw 最近利用QT做一个上位机界面 想用OpenGL将STL文件还原成三维模型 并将模型显示出来 那么问题来了 最简单的显示就直接创建一个窗口显示模型 根本就 没有用到QT的ui界面 现在的
  • JAVA区块链实战教程-杨长江-专题视频课程

    JAVA区块链实战教程 256人已学习 课程介绍 国内第一套以java语言讲解区块链原理的教程 包含实际项目和代码 让java从业人员 快速了解区块链和区块链原理 课程收益 1 区块链理论 以node js例子区块链原理有深刻理解 2 区块
  • 一个简单的外部系统调用接口日志记录demo

    一 实现思想 抽取接口共方法 作为抽象类 然后不同业务实现类继承此抽象类 实现具体业务 分析可知公共部分就是将外系统入参和接口返回参数记录到数据库 将其抽取出来 作为基础抽象类的公共方法 业务类继承此抽象类 使得不用在每一个业务实现类里面重
  • Selenium基础 — Selenium自动化测试框架介绍

    1 什么是selenium Selenium是一个用于Web应用程序测试的工具 只要在测试用例中把预期的用户行为与结果都描述出来 我们就得到了一个可以自动化运行的功能测试套件 Selenium测试套件直接运行在浏览器中 就像真正的用户在操作
  • spring+springMVC+MyBatis 分页功能代码封装

    页面效果图展示 分页工具类 Pagination package com wlsq kso util import java io Serializable import java util ArrayList import java ut