分页

ssm分页

旧时模样 提交于 2020-02-21 11:27:22
pom.xml配置文件中增加相关的插件。 <dependency> <groupId>com.github.pagehelper</groupId> <artifactId>pagehelper</artifactId> <version>5.1.7</version> </dependency> <!--配置分页插件--> <plugins> <plugin interceptor="com.github.pagehelper.PageInterceptor" /> </plugins> 调用PageHelper插件的方法,它只会对下面的一行代码起作用。 第一个参数是页数,第二个参数是条数,简单来说就是每一页有几条数据。 1、这是一种物理分页(就是直接通过SQL进行在数据库中直接分页,得到的数据就是我们想要分页之后的数据),假设你使用的是mysql数据库,在执行查询语气的时候,它会自动的在sql语法后面加 limit 来源: https://www.cnblogs.com/weibanggang/p/10074232.html

常见SQL分页方式效率比较

房东的猫 提交于 2020-02-20 01:03:45
结一下。 1.创建测试环境,(插入100万条数据大概耗时5分钟)。 create database DBTestuse DBTest--创建测试表create table pagetest(id int identity(1,1) not null,col01 int null,col02 nvarchar(50) null,col03 datetime null)--1万记录集declare @i intset @i=0while(@i<10000)begin insert into pagetest select cast(floor(rand()*10000) as int),left(newid(),10),getdate() set @i=@i+1end 2.几种典型的分页sql,下面例子是每页50条,198*50=9900,取第199页数据。 --写法1,not in/topselect top 50 * from pagetest where id not in (select top 9900 id from pagetest order by id)order by id--写法2,not existsselect top 50 * from pagetest where not exists (select 1 from (select top 9900 id

几种常见SQL分页方式效率比较

别等时光非礼了梦想. 提交于 2020-02-20 00:59:31
原文地址: 几种常见SQL分页方式效率比较 分页很重要,面试会遇到。不妨再回顾总结一下。 1.创建测试环境,(插入100万条数据大概耗时5分钟)。 create database DBTestuse DBTest--创建测试表create table pagetest(id int identity(1,1) not null,col01 int null,col02 nvarchar(50) null,col03 datetime null)--1万记录集declare @i intset @i=0while(@i<10000)begin insert into pagetest select cast(floor(rand()*10000) as int),left(newid(),10),getdate() set @i=@i+1end 2.几种典型的分页sql,下面例子是每页50条,198*50=9900,取第199页数据。 --写法1,not in/topselect top 50 * from pagetest where id not in (select top 9900 id from pagetest order by id)order by id--写法2,not existsselect top 50 * from pagetest where not

几种常见SQL分页方式效率比较

风格不统一 提交于 2020-02-20 00:56:15
分页很重要,面试会遇到。不妨再回顾总结一下。 1.创建测试环境,(插入100万条数据大概耗时5分钟)。 create database DBTestuse DBTest--创建测试表create table pagetest(id int identity(1,1) not null,col01 int null,col02 nvarchar(50) null,col03 datetime null)--1万记录集declare @i intset @i=0while(@i<10000)begin insert into pagetest select cast(floor(rand()*10000) as int),left(newid(),10),getdate() set @i=@i+1end 2.几种典型的分页sql,下面例子是每页50条,198*50=9900,取第199页数据。 --写法1,not in/topselect top 50 * from pagetest where id not in (select top 9900 id from pagetest order by id)order by id--写法2,not existsselect top 50 * from pagetest where not exists (select 1 from

数据库理论知识

感情迁移 提交于 2020-02-19 05:02:59
数据库理论知识 1、oracle游标: oracle中游标分为隐式和显式两种游标 隐式游标:在对数据库进行增删改查的时候,plsql自动定义的 显示游标:需要自己定义,步骤分为:定义游标,开启游标,使用游标,关闭游标 2、数据库分页 oracle中是使用rownum来进行分页,mysql使用limit进行分页的 oracle分页的代码为:select *from (select rownum r,a from teb where rownum<=20) mysql分页的代码为:select * from teb limit 0 , 5; 3、oracle中where条件查询和排序 oracle中使用索引的条件和严格,只有满足一定条件才可以使用 1.不能有空值 2.order by中的列索引的顺序和排序必须一致 4、笔记truncate和delete命令 delete删除不能腾出表空间 truncate不能对视图等操作 5、游标的好处和缺点 好处: 1、增强了数据的灵活性 2、加快了执行速度 3、保证了数据的安全 缺点: 1、占用服务器端资源,对服务器造成很大的压力 2、可读性和可维护性较差 6、创建索引的优点和缺点 索引有四种类型:标准索引,唯一索引,组合索引,反向键索引 好处: 创建唯一索引,保证每一行数据的唯一性 加快了检索速度 加速表与表的连接 缺点: 索引只能在表上创建

ajax,分页器

旧巷老猫 提交于 2020-02-18 02:09:59
一:ajax请求数据 ''' $.ajax({ url: '/ajax/', # 请求路径 type: 'post', # 请求方式 data: { # get和post都以data字典方式携带数据 usr: $('.usr').val(), # 获取输入框内容 pwd: $('.pwd').val(), }, success: function (data) { console.log(typeof(data), data); # 得到后台返回的数据(普通字符串 | json类型数据) } }) ''' ''' # ajax请求,后台只需要返回信息,所以不会出现render、redirect def ajax(request): print(request.is_ajax()) # 是否是ajax请求 if request.method == 'GET': # 获取get请求数据 usr = request.GET.get('usr', None) pwd = request.GET.get('pwd', None) if request.method == 'POST': # 获取post请求数据 usr = request.POST.get('usr', None) pwd = request.POST.get('pwd', None) # 返回字符串类型数据 #

nginx高并发配置

你。 提交于 2020-02-16 17:40:08
一、这里的优化主要是指对nginx的配置优化,一般来说nginx配置文件中对优化比较有作用的主要有以下几项: 1.nginx进程数,建议按照cpu数目来指定,一般跟cpu核数相同或为它的倍数。 worker_processes 8; 2.为每个进程分配cpu,上例中将8个进程分配到8个cpu,当然可以写多个,或者将一个进程分配到多个cpu。 worker_cpu_affinity 00000001 00000010 00000100 00001000 00010000 00100000 01000000 10000000; 3.下面这个指令是指当一个nginx进程打开的最多文件描述符数目,理论值应该是系统的最多打开文件数(ulimit-n)与nginx进程数相除,但是nginx分配请求并不是那么均匀,所以最好与ulimit -n的值保持一致。 worker_rlimit_nofile 65535; 4.使用epoll的I/O模型,用这个模型来高效处理异步事件 use epoll; 5.每个进程允许的最多连接数,理论上每台nginx服务器的最大连接数为worker_processes*worker_connections。 worker_connections 65535; 6.http连接超时时间,默认是60s,功能是使客户端到服务器端的连接在设定的时间内持续有效

MyBatis(6)——分页的实现

我们两清 提交于 2020-02-16 13:43:23
分页的实现 a)通过mysql的分页查询语句: 说明:sql的分页语句格式为select * from aaa limit #{startIndex},#{pageSize} //------------映射文件------------// //*设置传入参数类型为Map,parameterType="Map" <!--查询语句,分页查询--> <!-- 因为字段名不一致,此处的resultType换成结果集映射resultMap --> <select id="selectAll" parameterType="Map" resultMap="UserMap"> select * from users limit #{startIndex},#{pageSize} </select> //------------实体逻辑处理类:dao------------// //*新建Map参数并传入 public List<User> getAll(int currentPage,int pageSize) throws IOException { SqlSession session=MyBatisUtil.getSession(); Map<String, Integer> map=new HashMap<String, Integer>(); map.put("startIndex"

Python+Mongodb+Flask 分页

最后都变了- 提交于 2020-02-16 11:33:26
近期项目需要制作一个数据分页查询,因为数据量较大,因此需要进行分页。 第一:关于分页样式,可以自行在网上去找,大把的模板,少量修改既可以。 第二:关于数据,本次项目使用的MongoDB,与MySQL或者Oracle查询语句是有区别的; 第三:python 配合Flask,确实很香。具体代码如下: @app . route ( '/' ) # 定义路由(Views),可以理解为定义页面的URL def index ( ) : getsrc = request . args . get ( 'src' ) p = request . args . get ( 'p' ) if getsrc == None : src = 'xxxxx' else : src = getsrc show_status = 0 if not p : p = 1 else : p = int ( p ) if p > 1 : show_status = 1 limit_start = ( p - 1 ) * 10 result = db . fiancenews . find ( { 'src' : src } ) . sort ( [ ( "published" , - 1 ) ] ) . limit ( 10 ) . skip ( limit_start ) total = db .

DEDECMS之二 如何修改模板页

六月ゝ 毕业季﹏ 提交于 2020-02-16 07:36:23
使用织梦系统最经常是为了仿站,那么模板应该怎么改? 这里主要谈谈关于比较常用的几个模板页 网站主页、列表页、内容页、栏目的调用 1.主页模板 常用组合方法:index.htm + head.htm + footer.htm 嵌套语句:{dede:include filename="head.htm"/} head.htm :网站头部(顶部+导航栏),所以也可继续拆分。一般顶部内容为从body后开始至导航栏。 导航栏 (自动获取栏目信息)<div id="navtabs"> <a href="{dede:global.cfg_cmsurl/}/" class="current">首页</a>    {dede:channel type='top' row='10' currentstyle="<a href='~typelink~' >~typename~</a>"} <a href='[field:typeurl/]' >[field:typename/]</a> {/dede:channel} </div>二级栏目:直接指定所有二级链接,原网站都有js控制,直接拿来用就行 footer.htm:网站底部,包含版权信息,具体看实际的布局,大部分网站的友情链接作为独立模块在底部,包含进来更方便。 首页调用文章列表的方法,通过标签进行嵌套就行 示例: {dede:arclist row