如何實(shí)現(xiàn)ssm分頁

這篇文章主要介紹如何實(shí)現(xiàn)ssm分頁,文中介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們一定要看完!

為四平等地區(qū)用戶提供了全套網(wǎng)頁設(shè)計(jì)制作服務(wù),及四平網(wǎng)站建設(shè)行業(yè)解決方案。主營業(yè)務(wù)為成都網(wǎng)站建設(shè)、網(wǎng)站設(shè)計(jì)、四平網(wǎng)站設(shè)計(jì),以傳統(tǒng)方式定制建設(shè)網(wǎng)站,并提供域名空間備案等一條龍服務(wù),秉承以專業(yè)、用心的態(tài)度為用戶提供真誠的服務(wù)。我們深信只要達(dá)到每一位用戶的要求,就會(huì)得到認(rèn)可,從而選擇與我們長期合作。這樣,我們也可以走得更遠(yuǎn)!

頁面用bootstrapTable實(shí)現(xiàn)(配置查詢的參數(shù)即可),前提得引入bootstrapTable的css,js

function load() {
    var typeid = $("#typeid").val();
    $('#exampleTable').bootstrapTable({
                        method : 'get', // 服務(wù)器數(shù)據(jù)的請(qǐng)求方式 get or post
                        url : "xxx/base/supSupt/list", // 服務(wù)器數(shù)據(jù)的加載地址
                        iconSize : 'outline',
                        toolbar : '#exampleToolbar',
                        striped : true, // 設(shè)置為true會(huì)有隔行變色效果
                        dataType : "json", // 服務(wù)器返回的數(shù)據(jù)類型
                        pagination : true, // 設(shè)置為true會(huì)在底部顯示分頁條
                        singleSelect : false, // 設(shè)置為true將禁止多選
                        pageSize : 10, // 如果設(shè)置了分頁,每頁數(shù)據(jù)條數(shù)
                        pageNumber : 1, // 如果設(shè)置了分布,首頁頁碼
                        search : true, // 是否顯示搜索框,給參數(shù)就可以搜索了
                        showColumns : false, // 是否顯示內(nèi)容下拉框(選擇顯示的列)
                        clickToSelect:true,
                        sortOrder: "desc",
                        sidePagination : "server", // 設(shè)置在哪里進(jìn)行分頁,可選值為"client" 或者
                        queryParams : function(params) {//后臺(tái)有個(gè)Query類,只要添加了鍵值對(duì)而且是表中有的他會(huì)自動(dòng)弄進(jìn)去

                            return {
                                // 說明:傳入后臺(tái)的參數(shù)包括offset開始索引,limit步長,sort排序列,order:desc或者,以及所有列的鍵值對(duì)
                                limit : params.limit,
                                offset : params.offset,
sort:"createdat",根據(jù)創(chuàng)建時(shí)間(對(duì)應(yīng)映射文件的條件)
                                                    order:"desc",排序
                                type:typeid
                            };
                        },
                        columns : [
                                {
                                    checkbox : true
                                },
                                {
                                    field : 'code',
                                    title : '編碼'
                                                    },
                                {
                                    field : 'comp',
                                    title : '公司名'
                                },
                                {
                                    field : 'busilicence',
                                    title : '信用代碼'
                                },
                                {
                                    field : 'law',
                                    title : '法定代表人'
                                },
                                {
                                    field : 'tel',
                                    title : '聯(lián)系電話'
                                }]
    })
}

2.控制器

@ResponseBody
    @GetMapping("/list")
    @RequiresPermissions("base:supSupt:add")
    public PageUtils list(@RequestParam Map<String, Object> params){
        //查詢列表數(shù)據(jù)
        Query query = new Query(params);
        List<SupSuptSupVO> supSuptList = supSuptService.getSupListExcludeSuptpyeId(query);
        int total = supSuptService.getSupListCountExcludeSuptpyeId(query);
        PageUtils pageUtils = new PageUtils(supSuptList, total);
        return pageUtils;
    }
  1. 工具類
    分頁的工具類
  2. 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>

以上是“如何實(shí)現(xiàn)ssm分頁”這篇文章的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對(duì)大家有幫助,更多相關(guān)知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!

當(dāng)前標(biāo)題:如何實(shí)現(xiàn)ssm分頁
網(wǎng)頁鏈接:http://bm7419.com/article6/jdihog.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供響應(yīng)式網(wǎng)站、用戶體驗(yàn)、網(wǎng)站改版、企業(yè)網(wǎng)站制作網(wǎng)站內(nèi)鏈、企業(yè)建站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

網(wǎng)站托管運(yùn)營