function load() { var typeid = $("#typeid").val(); $('#exampleTable').bootstrapTable({ method : 'get', // 服务器数据的要求体式格局 get or post url : "xxx/base/supSupt/list", // 服务器数据的加载地点 iconSize : 'outline', toolbar : '#exampleToolbar', striped : true, // 设置为true会有隔行变色结果 dataType : "json", // 服务器返回的数据类型 pagination : true, // 设置为true会在底部显现分页条 singleSelect : false, // 设置为true将制止多选 pageSize : 10, // 假如设置了分页,每页数据条数 pageNumber : 1, // 假如设置了散布,首页页码 search : true, // 是不是显现搜刮框,给参数就能够搜刮了 showColumns : false, // 是不是显现内容下拉框(挑选显现的列) clickToSelect:true, sortOrder: "desc", sidePagination : "server", // 设置在那里举行分页,可选值为"client" 或许 queryParams : function(params) {//背景有个Query类,只需添加了键值对而且是表中有的他会自动弄进去 return { // 申明:传入背景的参数包含offset最先索引,limit步长,sort排序列,order:desc或许,以及一切列的键值对 limit : params.limit, offset : params.offset, sort:"createdat",依据建立时候(对应映照文件的前提) order:"desc",排序 type:typeid }; }, columns : [ { checkbox : true }, { field : 'code', title : '编码' }, { field : 'comp', title : '公司名' }, { field : 'busilicence', title : '信用代码' }, { field : 'law', title : '法定代表人' }, { field : 'tel', title : '联系电话' }] }) }
2.控制器
@ResponseBody @GetMapping("/list") @RequiresPermissions("base:supSupt:add") public PageUtils list(@RequestParam Map<String, Object> params){ //查询列表数据 Query query = new Query(params); List<SupSuptSupVO> supSuptList = supSuptService.getSupListExcludeSuptpyeId(query); int total = supSuptService.getSupListCountExcludeSuptpyeId(query); PageUtils pageUtils = new PageUtils(supSuptList, total); return pageUtils; }
- 东西类
分页的东西类 - mybatis映照文件
<select id="getSupListExcludeSuptpyeId" resultType="com.xxx.bid.base.vo.SupSuptVO"> select * from bid_sup where id not in ( select ss.supid from bid_sup_supt as ss inner join bid_sup as s on ss.supid = s.id <where> <if test="typeid != null and typeid != ''"> and ss.typeid = #{typeid} </if> </where> ) <choose> <when test="sort != null and sort.trim() != ''"> order by ${sort} ${order} </when> <otherwise> order by ls desc </otherwise> </choose> <if test="offset != null and limit != null"> limit #{offset}, #{limit} </if> </select> <select id="getSupListCountExcludeSuptpyeId" resultType="int"> select count(*) from bid_sup where id not in ( select ss.supid from bid_sup_supt as ss inner join bid_sup as s on ss.supid = s.id <where> <if test="typeid != null and typeid != ''"> and ss.typeid = #{typeid} </if> </where> ) </select>
本篇文章到这里就已悉数完毕了,更多其他精彩内容能够关注ki4网的MySQL教程视频栏目!
以上就是ssm分页的要领引见(代码示例)的细致内容,更多请关注ki4网别的相干文章!